結果
問題 | No.769 UNOシミュレータ |
ユーザー |
![]() |
提出日時 | 2020-07-30 11:46:03 |
言語 | Crystal (1.14.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 1,116 bytes |
コンパイル時間 | 10,769 ms |
コンパイル使用メモリ | 297,068 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 20:50:49 |
合計ジャッジ時間 | 12,277 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n, m = read_line.split.map &.to_iindex, reverse = 0, 1draw_kind, draw_count = -1, 0count = [0] * nm.times do |time|l = read_lineif draw_kind != -1 && [l, draw_kind] != ["drawtwo", 2] && [l, draw_kind] != ["drawfour", 4]count[index] -= draw_countdraw_kind, draw_count = -1, 0index = (index + reverse) % nend# p! [l, index + 1, reverse, draw_kind, draw_count, count]reverse = 0 if time == m - 1case lwhen "number"count[index] += 1index = (index + reverse) % nwhen "drawtwo"if draw_kind == 2count[index] += 1draw_count += 2elsecount[index] += 1draw_kind, draw_count = 2, 2endindex = (index + reverse) % nwhen "drawfour"if draw_kind == 4count[index] += 1draw_count += 4elsecount[index] += 1draw_kind, draw_count = 4, 4endindex = (index + reverse) % nwhen "skip"count[index] += 1index = (index + reverse * 2) % nwhen "reverse"count[index] += 1reverse *= -1index = (index + reverse) % nendendputs [index + 1, count[index]].join(' ')