Submission #740034


Source Code Expand

#!/usr/bin/env ruby

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

class Othello
  def initialize(n)
    @n = n
    @board = Array.new(n+2, 0)
  end

  def reverse(left, right)
    @board[left]   += 1
    @board[right+1]-= 1
  end

  def to_s
    answer = ""
    (1..@n).each do |i|
      @board[i] += @board[i-1]
      answer <<= @board[i].even? ? "0" : "1"
    end
    answer
  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 100
Code Size 521 Byte
Status AC
Exec Time 459 ms
Memory 3836 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 60 / 60 40 / 40
Status
AC × 2
AC × 12
AC × 34
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 17 ms 1788 KB
10_small_01.txt AC 19 ms 1788 KB
10_small_02.txt AC 17 ms 1788 KB
10_small_03.txt AC 17 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 18 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 17 ms 1788 KB
10_small_10.txt AC 17 ms 1788 KB
20_rand_01.txt AC 222 ms 2172 KB
20_rand_02.txt AC 68 ms 1916 KB
20_rand_03.txt AC 76 ms 2940 KB
20_rand_04.txt AC 136 ms 2044 KB
20_rand_05.txt AC 67 ms 1788 KB
20_rand_06.txt AC 141 ms 2300 KB
20_rand_07.txt AC 78 ms 2940 KB
20_rand_08.txt AC 31 ms 2044 KB
20_rand_09.txt AC 90 ms 1788 KB
20_rand_10.txt AC 56 ms 2044 KB
30_max_01.txt AC 457 ms 3836 KB
30_max_02.txt AC 452 ms 3836 KB
30_max_03.txt AC 454 ms 3836 KB
30_max_04.txt AC 459 ms 3836 KB
30_max_05.txt AC 452 ms 3836 KB
40_corner_01.txt AC 313 ms 1788 KB
40_corner_02.txt AC 431 ms 3836 KB
40_corner_03.txt AC 434 ms 3836 KB
40_corner_04.txt AC 452 ms 3836 KB
40_corner_05.txt AC 423 ms 3836 KB
40_corner_06.txt AC 313 ms 1788 KB
40_corner_07.txt AC 435 ms 3836 KB