結果
問題 | No.769 UNOシミュレータ |
ユーザー | yuruhiya |
提出日時 | 2020-07-30 11:42:54 |
言語 | Crystal (1.11.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 18,004 ms |
コンパイル使用メモリ | 254,392 KB |
実行使用メモリ | 5,476 KB |
最終ジャッジ日時 | 2023-09-13 11:32:19 |
合計ジャッジ時間 | 19,212 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 2 ms
4,480 KB |
testcase_02 | AC | 3 ms
4,380 KB |
testcase_03 | AC | 3 ms
4,412 KB |
testcase_04 | AC | 2 ms
4,504 KB |
testcase_05 | AC | 3 ms
4,644 KB |
testcase_06 | AC | 3 ms
4,396 KB |
testcase_07 | AC | 3 ms
4,404 KB |
testcase_08 | WA | - |
testcase_09 | AC | 4 ms
4,704 KB |
testcase_10 | AC | 4 ms
4,880 KB |
testcase_11 | AC | 4 ms
4,780 KB |
testcase_12 | AC | 17 ms
5,160 KB |
testcase_13 | AC | 17 ms
5,164 KB |
testcase_14 | WA | - |
testcase_15 | AC | 31 ms
5,292 KB |
testcase_16 | WA | - |
testcase_17 | AC | 31 ms
5,232 KB |
testcase_18 | WA | - |
testcase_19 | AC | 46 ms
5,476 KB |
testcase_20 | AC | 46 ms
5,196 KB |
testcase_21 | WA | - |
testcase_22 | AC | 3 ms
4,376 KB |
ソースコード
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(' ')