Submission #739893


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 - left
    re = (1 << (num + 1)) -1
    @s ^= re << (left - 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.to_i, r.to_i)
end

puts o.to_s

Submission Info

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

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 60 / 60 0 / 40
Status
AC × 2
AC × 12
AC × 25
TLE × 9
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 16 ms 1788 KB
00_example_02.txt AC 16 ms 1788 KB
10_small_01.txt AC 20 ms 1916 KB
10_small_02.txt AC 16 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 17 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 16 ms 1788 KB
10_small_09.txt AC 17 ms 1788 KB
10_small_10.txt AC 16 ms 1788 KB
20_rand_01.txt AC 709 ms 7536 KB
20_rand_02.txt AC 137 ms 3964 KB
20_rand_03.txt AC 54 ms 15612 KB
20_rand_04.txt AC 362 ms 5316 KB
20_rand_05.txt AC 120 ms 2300 KB
20_rand_06.txt AC 409 ms 8572 KB
20_rand_07.txt AC 74 ms 13180 KB
20_rand_08.txt AC 28 ms 4092 KB
20_rand_09.txt AC 157 ms 2172 KB
20_rand_10.txt AC 102 ms 4732 KB
30_max_01.txt TLE 2105 ms 29116 KB
30_max_02.txt TLE 2108 ms 29116 KB
30_max_03.txt TLE 2108 ms 29356 KB
30_max_04.txt TLE 2105 ms 29288 KB
30_max_05.txt TLE 2108 ms 29560 KB
40_corner_01.txt AC 317 ms 1788 KB
40_corner_02.txt TLE 2111 ms 55648 KB
40_corner_03.txt TLE 2111 ms 56692 KB
40_corner_04.txt TLE 2106 ms 39448 KB
40_corner_05.txt AC 419 ms 2556 KB
40_corner_06.txt AC 318 ms 1788 KB
40_corner_07.txt TLE 2111 ms 54952 KB