結果

問題 No.769 UNOシミュレータ
ユーザー maspymaspy
提出日時 2020-05-01 18:31:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 1,028 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 12,536 KB
最終ジャッジ日時 2023-08-26 01:06:04
合計ジャッジ時間 4,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,896 KB
testcase_01 AC 13 ms
7,928 KB
testcase_02 AC 13 ms
7,876 KB
testcase_03 AC 14 ms
7,876 KB
testcase_04 AC 14 ms
7,972 KB
testcase_05 AC 14 ms
7,792 KB
testcase_06 AC 15 ms
7,844 KB
testcase_07 AC 15 ms
7,844 KB
testcase_08 AC 15 ms
7,788 KB
testcase_09 AC 25 ms
8,340 KB
testcase_10 AC 23 ms
8,424 KB
testcase_11 AC 23 ms
8,480 KB
testcase_12 AC 110 ms
9,596 KB
testcase_13 AC 106 ms
9,688 KB
testcase_14 AC 111 ms
9,636 KB
testcase_15 AC 207 ms
10,960 KB
testcase_16 AC 209 ms
10,916 KB
testcase_17 AC 197 ms
10,900 KB
testcase_18 AC 303 ms
12,472 KB
testcase_19 AC 299 ms
12,536 KB
testcase_20 AC 302 ms
12,468 KB
testcase_21 AC 298 ms
12,536 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

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
    player %= N

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