結果
| 問題 |
No.769 UNOシミュレータ
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-05-01 18:42:18 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 365 ms / 2,000 ms |
| コード長 | 1,027 bytes |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 14,848 KB |
| 最終ジャッジ日時 | 2024-12-24 13:59:30 |
| 合計ジャッジ時間 | 4,593 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
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
skip_flag = False
for L in LOG:
if skip_flag:
player += dx
skip_flag = False
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':
skip_flag = True
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)
maspy