結果

問題 No.769 UNOシミュレータ
ユーザー maspy
提出日時 2020-01-29 22:36:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 919 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-11-22 09:30:38
合計ジャッジ時間 3,973 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
LOG = read().decode()

LOG = LOG.replace('number','n')
LOG = LOG.replace('skip','s')
LOG = LOG.replace('drawtwo','2')
LOG = LOG.replace('drawfour','4')
LOG = LOG.replace('reverse', 'r')
LOG = LOG.split()

num = [0] * N
player = -1
dx = 1
draw_2 = 0
draw_4 = 0
for L in LOG:
    player += dx
    player %= N
    if draw_2 and L != '2':
        num[player] += 2 * draw_2
        draw_2 = 0
        player += dx
    if draw_4 and L != '4':
        num[player] += 4 * draw_4
        draw_4 = 0
        player += dx
    player %= N
    num[player] -= 1
    if L == 's':
        player += dx
    elif L == 'n':
        pass
    elif L == 'r':
        dx *= -1
    elif L == '2':
        draw_2 += 1
    elif L == '4':
        draw_4 += 1

x = -num[player]
print(player+1, x)
0