結果

問題 No.2372 既視感
ユーザー i_takui_taku
提出日時 2023-07-07 21:58:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 77,340 KB
最終ジャッジ日時 2024-07-21 17:57:52
合計ジャッジ時間 3,282 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N, K, Q = map(int, input().split())
A = deque()
for _ in range(Q):
    t = int(input())
    if t == 1:
        A.append(input())
    else:
        tot = ans = 0
        TD = [list(input().split()) for _ in range(6)]
        for t, d in TD:     
            u = int(d)
            if t in A: u = min(u, K)
            if 60 < tot + u: break
            A.append(t)
            tot += u
            ans += 1
        print(ans)
    while N < len(A): A.popleft()
    
0