結果
問題 | No.769 UNOシミュレータ |
ユーザー | 👑 obakyan |
提出日時 | 2019-04-14 00:15:01 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 1,998 bytes |
コンパイル時間 | 458 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 09:18:04 |
合計ジャッジ時間 | 1,421 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 3 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 3 ms
5,248 KB |
testcase_08 | AC | 3 ms
5,248 KB |
testcase_09 | AC | 4 ms
5,248 KB |
testcase_10 | AC | 4 ms
5,248 KB |
testcase_11 | AC | 4 ms
5,248 KB |
testcase_12 | AC | 18 ms
5,248 KB |
testcase_13 | AC | 18 ms
5,248 KB |
testcase_14 | AC | 17 ms
5,248 KB |
testcase_15 | AC | 33 ms
5,248 KB |
testcase_16 | AC | 34 ms
5,248 KB |
testcase_17 | AC | 34 ms
5,248 KB |
testcase_18 | AC | 49 ms
5,248 KB |
testcase_19 | AC | 49 ms
5,248 KB |
testcase_20 | AC | 50 ms
5,248 KB |
testcase_21 | AC | 50 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
ソースコード
n, m = io.read("*n", "*n", "*l") cards = {} way = 1 prev_user = 1 current_user = 1 d2chain, d4chain = 0, 0 for i = 1, n do cards[i] = 0 end for i_m = 1, m do s = io.read() if(0 < d2chain) then if(s == "drawtwo") then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way d2chain = d2chain + 1 else prev_user = current_user cards[current_user] = cards[current_user] - 2 * d2chain current_user = current_user + way d2chain = 0 end end if(0 < d4chain) then if(s == "drawfour") then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way d4chain = d4chain + 1 else prev_user = current_user cards[current_user] = cards[current_user] - 4 * d4chain current_user = current_user + way d4chain = 0 end end current_user = current_user % n if(current_user == 0) then current_user = n end if(s == "number") then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way elseif(s == "skip") then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way * 2 elseif(s == "reverse") then prev_user = current_user cards[current_user] = cards[current_user] + 1 way = -way current_user = current_user + way elseif(s == "drawtwo" and d2chain == 0) then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way d2chain = d2chain + 1 elseif(s == "drawfour" and d4chain == 0) then prev_user = current_user cards[current_user] = cards[current_user] + 1 current_user = current_user + way d4chain = d4chain + 1 end current_user = current_user % n if(current_user == 0) then current_user = n end end print(string.format("%d %d", prev_user, cards[prev_user]))