結果
問題 | No.769 UNOシミュレータ |
ユーザー | mai |
提出日時 | 2018-12-16 22:26:33 |
言語 | Ruby (3.2.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,161 bytes |
コンパイル時間 | 259 ms |
コンパイル使用メモリ | 11,560 KB |
実行使用メモリ | 35,128 KB |
最終ジャッジ日時 | 2023-08-14 11:52:14 |
合計ジャッジ時間 | 5,521 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
15,144 KB |
testcase_01 | AC | 79 ms
15,288 KB |
testcase_02 | AC | 81 ms
15,156 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 83 ms
15,252 KB |
testcase_06 | AC | 81 ms
15,156 KB |
testcase_07 | AC | 81 ms
15,160 KB |
testcase_08 | AC | 80 ms
15,064 KB |
testcase_09 | AC | 91 ms
15,604 KB |
testcase_10 | AC | 91 ms
15,596 KB |
testcase_11 | AC | 93 ms
15,472 KB |
testcase_12 | AC | 189 ms
21,812 KB |
testcase_13 | AC | 192 ms
21,708 KB |
testcase_14 | AC | 189 ms
21,604 KB |
testcase_15 | AC | 303 ms
29,488 KB |
testcase_16 | AC | 304 ms
29,316 KB |
testcase_17 | WA | - |
testcase_18 | AC | 413 ms
35,008 KB |
testcase_19 | AC | 414 ms
35,016 KB |
testcase_20 | AC | 414 ms
35,128 KB |
testcase_21 | AC | 415 ms
35,044 KB |
testcase_22 | AC | 80 ms
15,304 KB |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i); end N, M = ascan turn = 0 vec = 1 numcards = [1]*N lastturn = 0 commands = M.times.map{gets.chomp} idx = 0 while idx < M lastturn = turn c = commands[idx] case c when 'number' numcards[turn] += 1 turn += 1*vec when 'drawtwo' numcards[turn] += 1 d = 2 while commands[idx+1] == 'drawtwo' lastturn = turn turn = (turn + vec + N) % N numcards[turn] += 1 d += 2 idx += 1 end numcards[(turn+vec)%N] -= d turn += 2*vec when 'drawfour' numcards[turn] += 1 d = 4 while commands[idx+1] == 'drawfour' lastturn = turn turn = (turn + vec + N) % N numcards[turn] += 1 d += 4 idx += 1 end numcards[(turn+vec)%N] -= d turn += 2*vec when 'skip' numcards[turn] += 1 turn += 2*vec when 'reverse' numcards[turn] += 1 vec *= -1 turn += 1*vec end turn = (turn + N) % N idx += 1 end puts "#{lastturn+1} #{numcards[lastturn]-1}"