Submission #738874


Source Code Expand

#!/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 Info

Submission Time
Task C - オセロ
User buty4649
Language Ruby (2.3.3)
Score 60
Code Size 462 Byte
Status TLE
Exec Time 2111 ms
Memory 72836 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 60 / 60 0 / 40
Status
AC × 2
AC × 12
AC × 23
TLE × 11
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
Subtask1 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 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
Case Name Status Exec Time Memory
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 2106 ms 10236 KB
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 2103 ms 10972 KB
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 2107 ms 44824 KB
30_max_02.txt TLE 2107 ms 45804 KB
30_max_03.txt TLE 2111 ms 43840 KB
30_max_04.txt TLE 2111 ms 43928 KB
30_max_05.txt TLE 2107 ms 44332 KB
40_corner_01.txt AC 424 ms 1788 KB
40_corner_02.txt TLE 2110 ms 72776 KB
40_corner_03.txt TLE 2110 ms 72776 KB
40_corner_04.txt TLE 2106 ms 32380 KB
40_corner_05.txt AC 657 ms 2556 KB
40_corner_06.txt AC 427 ms 1788 KB
40_corner_07.txt TLE 2108 ms 72836 KB