結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-11 23:11:11 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 85 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 142,848 KB |
| 最終ジャッジ日時 | 2024-09-25 01:17:26 |
| 合計ジャッジ時間 | 25,593 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 TLE * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
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.reverse_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