結果

問題 No.351 市松スライドパズル
ユーザー Tsuneo YoshiokaTsuneo Yoshioka
提出日時 2016-03-11 23:06:28
言語 Ruby
(3.2.2)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 501 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 11,988 KB
実行使用メモリ 162,112 KB
最終ジャッジ日時 2023-10-25 05:48:51
合計ジャッジ時間 25,081 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 84 ms
16,176 KB
testcase_02 AC 84 ms
16,176 KB
testcase_03 AC 84 ms
16,176 KB
testcase_04 AC 85 ms
16,176 KB
testcase_05 AC 84 ms
16,176 KB
testcase_06 AC 84 ms
16,176 KB
testcase_07 AC 84 ms
16,176 KB
testcase_08 AC 85 ms
16,176 KB
testcase_09 AC 84 ms
16,176 KB
testcase_10 AC 84 ms
16,176 KB
testcase_11 AC 84 ms
16,176 KB
testcase_12 AC 84 ms
16,176 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

H,W=gets.split.map(&:to_i)
N = gets.to_i
ops = []
N.times{
    s,k=gets.split
    k = k.to_i
    ops << [s, k]
}
ops.reverse!
x=0
y=0
count = 0
ops.each{|op|
    if op[0] == 'R' && op[1] == y
        count +=1
        x = (x+W-1)%W
        if x==W-1 && W%2==1
            count +=1
        end
    elsif op[0] == 'C' && op[1] == x
        count += 1
        y = (y+H-1)%H
        if y==H-1 && H%2==1
            count +=1
        end
    end
}
if count%2==0
    puts 'white'
else
    puts 'black'
end
0