Submission #732292


Source Code Expand

#!/usr/bin/env ruby

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

class Othello
  attr_reader :s
  def initialize(n)
    @s = "0" * n
  end

  def reverse(left, right)
    l = left.to_i - 1
    r = right.to_i - 1
    before = l > 0 ? @s.slice(0..l-1) : ""
    after  = @s.slice(r+1..@s.length)
    target = @s.slice(l..r).split(//).map{|s| s.to_i == 0 ? "1" : "0" }.join("")

    @s = "#{before}#{target}#{after}"
  end
end

o = Othello.new(num)

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

puts o.s

Submission Info

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

Compile Error

./Main.rb:3: warning: assigned but unused variable - count

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 60 / 60 0 / 40
Status
AC × 2
AC × 12
AC × 14
TLE × 20
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 87 ms 2172 KB
10_small_02.txt AC 27 ms 1788 KB
10_small_03.txt AC 18 ms 1788 KB
10_small_04.txt AC 54 ms 2172 KB
10_small_05.txt AC 22 ms 1788 KB
10_small_06.txt AC 60 ms 2172 KB
10_small_07.txt AC 24 ms 2044 KB
10_small_08.txt AC 17 ms 1788 KB
10_small_09.txt AC 24 ms 1788 KB
10_small_10.txt AC 24 ms 1788 KB
20_rand_01.txt TLE 2103 ms 13144 KB
20_rand_02.txt TLE 2102 ms 8748 KB
20_rand_03.txt TLE 2110 ms 33084 KB
20_rand_04.txt TLE 2103 ms 11216 KB
20_rand_05.txt TLE 2102 ms 4476 KB
20_rand_06.txt TLE 2108 ms 20176 KB
20_rand_07.txt TLE 2111 ms 35868 KB
20_rand_08.txt TLE 2106 ms 8632 KB
20_rand_09.txt TLE 2105 ms 3580 KB
20_rand_10.txt TLE 2107 ms 9568 KB
30_max_01.txt TLE 2111 ms 36176 KB
30_max_02.txt TLE 2113 ms 54268 KB
30_max_03.txt TLE 2109 ms 54188 KB
30_max_04.txt TLE 2109 ms 50888 KB
30_max_05.txt TLE 2110 ms 55740 KB
40_corner_01.txt AC 1606 ms 1788 KB
40_corner_02.txt TLE 2113 ms 52580 KB
40_corner_03.txt TLE 2113 ms 53792 KB
40_corner_04.txt TLE 2121 ms 132092 KB
40_corner_05.txt TLE 2107 ms 37156 KB
40_corner_06.txt AC 1618 ms 1788 KB
40_corner_07.txt TLE 2116 ms 85740 KB