結果

問題 No.769 UNOシミュレータ
ユーザー ttrttr
提出日時 2020-05-27 22:30:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 821 ms / 2,000 ms
コード長 673 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-21 05:22:53
合計ジャッジ時間 7,340 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 28 ms
10,624 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 54 ms
10,752 KB
testcase_10 AC 53 ms
10,624 KB
testcase_11 AC 52 ms
10,624 KB
testcase_12 AC 285 ms
10,880 KB
testcase_13 AC 287 ms
10,752 KB
testcase_14 AC 287 ms
10,752 KB
testcase_15 AC 548 ms
11,008 KB
testcase_16 AC 549 ms
11,008 KB
testcase_17 AC 545 ms
11,136 KB
testcase_18 AC 813 ms
11,520 KB
testcase_19 AC 802 ms
11,520 KB
testcase_20 AC 797 ms
11,392 KB
testcase_21 AC 821 ms
11,520 KB
testcase_22 AC 27 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
prev = 0
next = 1
card = [0]*N
cnt = 0
for _ in range(M):
    l = input()
    card[ans] += 1
    if (prev == "drawtwo" or prev == "drawfour") and prev != l:
        card[ans] -= 1+cnt
        cnt = 0
        ans += next
        card[ans%N] += 1
    if l == "number" or l == "drawtwo" or l == "drawfour":
        ans += next
        if l == "drawtwo":
            cnt += 2
        elif l == "drawfour":
            cnt += 4
    elif l == "skip":
        ans += next*2
    elif l == "reverse":
        next *= -1
        ans += next
    prev = l
    ans %= N

if l == "skip":
    next *= 2
ans = (ans-next)%N+1
print(ans, card[ans-1])
0