結果

問題 No.769 UNOシミュレータ
ユーザー TakoKurage
提出日時 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
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = [int(_) for _ in input().split()]
l = [input() for _ in range(M)]

hands = [0] * N
turn = 0
acc2 = 0
acc4 = 0
direction = +1

def next_player():
    global turn
    turn = (turn + direction * distance) % N

for i, li in enumerate(l):

    distance = 1

    if acc2 > 0 and li != "drawtwo":
        hands[turn] += acc2
        acc2 = 0
        next_player()

    if acc4 > 0 and li != "drawfour":
        hands[turn] += acc4
        acc4 = 0
        next_player()

    if li == "drawtwo":
        acc2 += 2

    if li == "drawfour":
        acc4 += 4

    if li == "number":
        pass

    if li == "skip":
        distance = 2

    if li == "reverse":
        direction *= -1

    hands[turn] -= 1

    if i == M - 1:
        print(turn + 1, -hands[turn])
    else:
        next_player()
0