結果
| 問題 |
No.769 UNOシミュレータ
|
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2020-07-30 11:42:54 |
| 言語 | Crystal (1.14.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,116 bytes |
| コンパイル時間 | 11,393 ms |
| コンパイル使用メモリ | 296,976 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 20:50:18 |
| 合計ジャッジ時間 | 12,972 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 6 |
ソースコード
n, m = read_line.split.map &.to_i
index, reverse = 0, 1
draw_kind, draw_count = -1, 0
count = [0] * n
m.times do |time|
l = read_line
if draw_kind != -1 && [l, draw_kind] != ["drawtwo", 2] && [l, draw_kind] != ["drawfour", 4]
count[index] -= draw_count
draw_kind, draw_count = -1, 0
index = (index + reverse) % n
end
# p! [l, index + 1, reverse, draw_kind, draw_count, count]
case l
when "number"
count[index] += 1
index = (index + reverse) % n
when "drawtwo"
if draw_kind == 2
count[index] += 1
draw_count += 2
else
count[index] += 1
draw_kind, draw_count = 2, 2
end
index = (index + reverse) % n
when "drawfour"
if draw_kind == 4
count[index] += 1
draw_count += 4
else
count[index] += 1
draw_kind, draw_count = 4, 4
end
index = (index + reverse) % n
when "skip"
count[index] += 1
index = (index + reverse * 2) % n
when "reverse"
count[index] += 1
reverse *= -1
index = (index + reverse) % n
end
reverse = 0 if time == m - 2
end
puts [index + 1, count[index]].join(' ')
yuruhiya