AtCoder Beginner Contest 035

Submission #738874

Source codeソースコード

#!/usr/bin/env ruby

num, _ = STDIN.gets.split.map(&:to_i)

class Othello
  def initialize(n)
    @s = 0
    @n = n
  end

  def reverse(left, right)
    num = right.to_i - left.to_i
    re = ("1" * (num+1)).to_i(2)
    @s ^= re << (left.to_i - 1)
  end

  def to_s
    s = @s.to_s(2)
    ("0" * (@n - s.length) + s).reverse
  end
end

o = Othello.new(num)

STDIN.each do |line|
  l, r = line.split
  o.reverse(l, r)
end

puts o.to_s

Submission

Task問題 C - オセロ
User nameユーザ名 buty4649
Created time投稿日時
Language言語 Ruby (2.3.3)
Status状態 TLE
Score得点 60
Source lengthソースコード長 462 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt
Subtask1 60 / 60 00_example_01.txt,00_example_02.txt,10_small_01.txt,10_small_02.txt,10_small_03.txt,10_small_04.txt,10_small_05.txt,10_small_06.txt,10_small_07.txt,10_small_08.txt,10_small_09.txt,10_small_10.txt
All 0 / 40 00_example_01.txt,00_example_02.txt,10_small_01.txt,10_small_02.txt,10_small_03.txt,10_small_04.txt,10_small_05.txt,10_small_06.txt,10_small_07.txt,10_small_08.txt,10_small_09.txt,10_small_10.txt,20_rand_01.txt,20_rand_02.txt,20_rand_03.txt,20_rand_04.txt,20_rand_05.txt,20_rand_06.txt,20_rand_07.txt,20_rand_08.txt,20_rand_09.txt,20_rand_10.txt,30_max_01.txt,30_max_02.txt,30_max_03.txt,30_max_04.txt,30_max_05.txt,40_corner_01.txt,40_corner_02.txt,40_corner_03.txt,40_corner_04.txt,40_corner_05.txt,40_corner_06.txt,40_corner_07.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_example_01.txt AC 17 ms 1788 KB
00_example_02.txt AC 17 ms 1788 KB
10_small_01.txt AC 22 ms 1916 KB
10_small_02.txt AC 18 ms 1788 KB
10_small_03.txt AC 16 ms 1788 KB
10_small_04.txt AC 18 ms 1788 KB
10_small_05.txt AC 18 ms 1788 KB
10_small_06.txt AC 19 ms 1788 KB
10_small_07.txt AC 17 ms 1788 KB
10_small_08.txt AC 17 ms 1788 KB
10_small_09.txt AC 18 ms 1788 KB
10_small_10.txt AC 17 ms 1788 KB
20_rand_01.txt TLE
20_rand_02.txt AC 434 ms 4860 KB
20_rand_03.txt AC 121 ms 20092 KB
20_rand_04.txt AC 1737 ms 7420 KB
20_rand_05.txt AC 239 ms 2556 KB
20_rand_06.txt TLE
20_rand_07.txt AC 315 ms 21628 KB
20_rand_08.txt AC 40 ms 4988 KB
20_rand_09.txt AC 279 ms 2300 KB
20_rand_10.txt AC 307 ms 5500 KB
30_max_01.txt TLE
30_max_02.txt TLE
30_max_03.txt TLE
30_max_04.txt TLE
30_max_05.txt TLE
40_corner_01.txt AC 424 ms 1788 KB
40_corner_02.txt TLE
40_corner_03.txt TLE
40_corner_04.txt TLE
40_corner_05.txt AC 657 ms 2556 KB
40_corner_06.txt AC 427 ms 1788 KB
40_corner_07.txt TLE