結果
問題 | No.769 UNOシミュレータ |
ユーザー |
![]() |
提出日時 | 2022-06-09 21:45:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 1,546 bytes |
コンパイル時間 | 328 ms |
コンパイル使用メモリ | 82,556 KB |
実行使用メモリ | 78,732 KB |
最終ジャッジ日時 | 2024-09-21 05:39:19 |
合計ジャッジ時間 | 4,240 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
import sysimport pypyjitimport itertoolsimport heapqimport mathfrom collections import deque, defaultdictimport bisectimport randominput = sys.stdin.readlinesys.setrecursionlimit(10 ** 6)pypyjit.set_param('max_unroll_recursion=-1')def index_lt(a, x):'return largest index s.t. A[i] < x or -1 if it does not exist'return bisect.bisect_left(a, x) - 1def index_le(a, x):'return largest index s.t. A[i] <= x or -1 if it does not exist'return bisect.bisect_right(a, x) - 1def index_gt(a, x):'return smallest index s.t. A[i] > x or len(a) if it does not exist'return bisect.bisect_right(a, x)def index_ge(a, x):'return smallest index s.t. A[i] >= x or len(a) if it does not exist'return bisect.bisect_left(a, x)def generate(k):return random.sample(range(26), k)N, M = map(int, input().split())def next():global idif reverse is True:id = (id - 1) % Nelse:id = (id + 1) % Nid = 0reverse = Falsecnt = [0] * Nacc2 = 0acc4 = 0for i in range(M):l = input()[:-1]if acc2 > 0 and l != 'drawtwo':cnt[id] += 2 * acc2acc2 = 0next()if acc4 > 0 and l != 'drawfour':cnt[id] += 4 * acc4acc4 = 0next()cnt[id] -= 1if i == M - 1:print(id + 1, -cnt[id])if l == 'number':passelif l == 'drawtwo':acc2 += 1elif l == 'drawfour':acc4 += 1elif l == 'skip':next()else:reverse = not reversenext()