AtCoder Beginner Contest 035

Submission #732292

Source codeソースコード

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

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

Compiler messageコンパイルメッセージ

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

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 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
20_rand_02.txt TLE
20_rand_03.txt TLE
20_rand_04.txt TLE
20_rand_05.txt TLE
20_rand_06.txt TLE
20_rand_07.txt TLE
20_rand_08.txt TLE
20_rand_09.txt TLE
20_rand_10.txt TLE
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 1606 ms 1788 KB
40_corner_02.txt TLE
40_corner_03.txt TLE
40_corner_04.txt TLE
40_corner_05.txt TLE
40_corner_06.txt AC 1618 ms 1788 KB
40_corner_07.txt TLE