結果
問題 | No.769 UNOシミュレータ |
ユーザー | rein4th |
提出日時 | 2018-12-17 10:58:23 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,481 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 58,240 KB |
最終ジャッジ日時 | 2024-11-22 08:47:29 |
合計ジャッジ時間 | 26,457 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
17,572 KB |
testcase_01 | AC | 31 ms
42,504 KB |
testcase_02 | AC | 30 ms
17,696 KB |
testcase_03 | AC | 30 ms
42,496 KB |
testcase_04 | AC | 34 ms
17,568 KB |
testcase_05 | AC | 33 ms
42,500 KB |
testcase_06 | AC | 33 ms
17,704 KB |
testcase_07 | AC | 33 ms
17,440 KB |
testcase_08 | AC | 37 ms
17,568 KB |
testcase_09 | AC | 73 ms
58,236 KB |
testcase_10 | AC | 72 ms
18,720 KB |
testcase_11 | AC | 73 ms
58,240 KB |
testcase_12 | AC | 1,234 ms
24,740 KB |
testcase_13 | AC | 1,222 ms
17,792 KB |
testcase_14 | AC | 1,229 ms
17,664 KB |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | AC | 30 ms
57,320 KB |
ソースコード
N,M = map(int,input().split()) L = [input() for i in range(M)] D = {} D_debt = {} for i in range(N) : D[i+1] = 0 D_debt[i+1] = 0 state = "" debt = 0 reverse = 0 turn = 1 def next() : global turn if reverse == 1 : turn -= 1 else : turn += 1 if turn == 0 : turn = N elif turn == N+1 : turn = 1 return turn def judge(L) : if len(L) == 0 : print(turn, D[turn]-D_debt[turn]) while True : if state == "skip" : state = "" turn = next() elif state == "drawtwo" : if L[0] == "drawtwo" : card = L.pop(0) D[turn] += 1 judge(L) debt += 2 else : D_debt[turn] += debt debt = 0 state = "" turn = next() elif state == "drawfour" : if L[0] == "drawfour" : card = L.pop(0) D[turn] += 1 judge(L) debt += 4 else : D_debt[turn] += debt debt = 0 state = "" turn = next() else : card = L.pop(0) D[turn] += 1 judge(L) if card in ("skip","drawtwo","drawfour") : state = card if card == "drawtwo" : debt = 2 elif card == "drawfour" : debt = 4 elif card == "reverse" : reverse = (reverse + 1) % 2 turn = next() if len(L) == 0 : break