結果

問題 No.769 UNOシミュレータ
ユーザー rlangevinrlangevin
提出日時 2023-01-25 12:44:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 1,124 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 78,812 KB
最終ジャッジ日時 2023-09-09 00:15:58
合計ジャッジ時間 5,948 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,300 KB
testcase_01 AC 72 ms
71,480 KB
testcase_02 AC 71 ms
71,400 KB
testcase_03 AC 72 ms
71,496 KB
testcase_04 AC 85 ms
75,188 KB
testcase_05 AC 86 ms
75,268 KB
testcase_06 AC 81 ms
75,208 KB
testcase_07 AC 83 ms
75,188 KB
testcase_08 AC 85 ms
75,280 KB
testcase_09 AC 122 ms
77,740 KB
testcase_10 AC 124 ms
77,892 KB
testcase_11 AC 124 ms
77,760 KB
testcase_12 AC 161 ms
77,868 KB
testcase_13 AC 163 ms
77,752 KB
testcase_14 AC 161 ms
78,032 KB
testcase_15 AC 202 ms
78,136 KB
testcase_16 AC 199 ms
78,464 KB
testcase_17 AC 198 ms
78,392 KB
testcase_18 AC 231 ms
78,812 KB
testcase_19 AC 231 ms
78,596 KB
testcase_20 AC 233 ms
78,424 KB
testcase_21 AC 231 ms
78,608 KB
testcase_22 AC 71 ms
71,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
now = 0
dr = 1
L = [0] * N
cnt2, cnt4 = 0, 0
for i in range(M):
    c = input()
    if cnt2:
        if c == "drawtwo":
            L[now] += 1
            cnt2 += 2
            if i == M - 1:
                now += 1
            else:
                now += dr
                now %= N

            continue
        else:
            L[now] -= cnt2
            cnt2 = 0
        now += dr
        now %= N
    if cnt4:
        if c == "drawfour":
            L[now] += 1
            cnt4 += 4
            if i == M - 1:
                now += 1
            else:
                now += dr
                now %= N
            continue
        else:
            L[now] -= cnt4
            cnt4 = 0
        now += dr
        now %= N
        
    L[now] += 1
    if c == "number":
        pass
    elif c == "drawtwo":
        cnt2 += 2
    elif c == "drawfour":
        cnt4 += 4
    elif c == "skip" and i != M - 1:
        now += dr
        now %= N
    else:
        dr *= -1
    
    if i == M - 1:
        now += 1
    else:
        now += dr
        now %= N
    
print(now, L[now - 1])
0