結果

問題 No.769 UNOシミュレータ
ユーザー iad_2889iad_2889
提出日時 2019-05-09 18:42:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,145 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 30,364 KB
最終ジャッジ日時 2023-08-14 12:19:37
合計ジャッジ時間 6,329 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,768 KB
testcase_01 AC 14 ms
7,856 KB
testcase_02 AC 16 ms
7,776 KB
testcase_03 AC 15 ms
7,800 KB
testcase_04 AC 17 ms
8,244 KB
testcase_05 AC 17 ms
8,332 KB
testcase_06 AC 18 ms
8,368 KB
testcase_07 AC 16 ms
8,428 KB
testcase_08 AC 17 ms
8,240 KB
testcase_09 WA -
testcase_10 AC 36 ms
9,016 KB
testcase_11 AC 36 ms
9,000 KB
testcase_12 WA -
testcase_13 AC 231 ms
15,296 KB
testcase_14 AC 223 ms
15,552 KB
testcase_15 WA -
testcase_16 AC 457 ms
22,960 KB
testcase_17 AC 455 ms
22,752 KB
testcase_18 AC 689 ms
30,124 KB
testcase_19 AC 671 ms
30,248 KB
testcase_20 WA -
testcase_21 AC 672 ms
30,240 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def get_next(N):
    def _(current,reverse):
        if reverse:
            next = current - 1
            if next < 0:
                next-=N
        else:
            next = current + 1
        return next % N
    return _

N,M = map(int,input().split())
log = [input() for x in range(M)]
players = [0 for x in range(N)]
g_next = get_next(N)
current = -1
reverse = False
d_two = 0
d_four = 0

for card in log:
    if current == -1:
        current = 0
    else:
        current = g_next(current,reverse)
    if d_two:
        if card == "drawtwo":
            d_two+=2
        else:
            players[current]-=d_two
            d_two = 0
            current = g_next(current,reverse)
    if d_four:
        if card == "drawfour":
            d_four+=4
        else:
            players[current]-=d_four
            d_four = 0
            current = g_next(current,reverse)
    players[current]+=1
    if card == "drawtwo":
        d_two+=2
    elif card == "drawfour":
        d_four+=4
    elif card == "skip":
        current = g_next(current,reverse)
    elif card == "reverse":
        reverse^=True
print(current + 1,players[current])
0