結果
| 問題 | No.2372 既視感 | 
| コンテスト | |
| ユーザー |  H20 | 
| 提出日時 | 2023-07-07 21:33:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 103 ms / 2,000 ms | 
| コード長 | 802 bytes | 
| コンパイル時間 | 211 ms | 
| コンパイル使用メモリ | 82,088 KB | 
| 実行使用メモリ | 77,312 KB | 
| 最終ジャッジ日時 | 2024-07-21 17:17:36 | 
| 合計ジャッジ時間 | 2,959 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 | 
ソースコード
import collections
N,K,Q = map(int, input().split())
Deq = collections.deque()
for _ in range(Q):
    q = int(input())
    if q==1:
        Deq.append(input())
    else:
        TD = [list(input().split()) for _ in range(6)]
        cnt = 0
        time = 0
        for t,d in TD:
            d = int(d)
            ac = False
            for deq in Deq:
                if t==deq:
                    if time+min(d,K)<=60:
                        time+=min(d,K)
                        ac=True
                    break
            else:
                if time+d<=60:
                    time+=d
                    ac=True
            if ac:
                Deq.append(t)
                cnt+=1
            else:
                break
        print(cnt)
    while len(Deq)>N:
        Deq.popleft()
            
            
            
        