結果
問題 | No.769 UNOシミュレータ |
ユーザー |
![]() |
提出日時 | 2018-12-28 22:32:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 878 ms / 2,000 ms |
コード長 | 798 bytes |
コンパイル時間 | 96 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 28,800 KB |
最終ジャッジ日時 | 2024-11-22 09:01:51 |
合計ジャッジ時間 | 7,780 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
N, M = [int(_) for _ in input().split()]l = [input() for _ in range(M)]hands = [0] * Nturn = 0acc2 = 0acc4 = 0direction = +1def next_player():global turnturn = (turn + direction * distance) % Nfor i, li in enumerate(l):distance = 1if acc2 > 0 and li != "drawtwo":hands[turn] += acc2acc2 = 0next_player()if acc4 > 0 and li != "drawfour":hands[turn] += acc4acc4 = 0next_player()if li == "drawtwo":acc2 += 2if li == "drawfour":acc4 += 4if li == "number":passif li == "skip":distance = 2if li == "reverse":direction *= -1hands[turn] -= 1if i == M - 1:print(turn + 1, -hands[turn])else:next_player()