結果

問題 No.769 UNOシミュレータ
ユーザー rein4th
提出日時 2018-12-17 12:52:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 58,192 KB
最終ジャッジ日時 2024-11-22 08:47:56
合計ジャッジ時間 26,694 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 2 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())

L = list(input() for i in range(M))
D = {}
D_debt = {}
for i in range(N) :
    D[i+1] = 0
    D_debt[i+1] = 0

turn = 1
reverse = 0
debt = 0
state = ""
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 len(L) != 0 :
    if state == "skip" :
        state = ""
    elif state == "drawtwo" :
        if L[0] == state :
            D[turn] += 1
            debt += 2
            L.pop(0)
        else :
            D_debt[turn] += debt
            debt = 0
            state = ""
    elif state == "drawfour" :
        if L[0] == state :
            D[turn] += 1
            debt += 4
            L.pop(0)
        else :
            D_debt[turn] += debt
            debt = 0
            state = ""
    else :
        state = L.pop(0)
        D[turn] += 1
    if state == "reverse" :
        reverse = (reverse + 1) % 2
        state = ""
    elif state == "drawtwo" :
        debt = 2
    elif state == "drawfour" :
        debt = 4
    judge(L)
    turn = next()
0