結果
| 問題 | No.2372 既視感 | 
| コンテスト | |
| ユーザー |  june19312 | 
| 提出日時 | 2023-07-07 22:11:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 96 ms / 2,000 ms | 
| コード長 | 1,224 bytes | 
| コンパイル時間 | 477 ms | 
| コンパイル使用メモリ | 82,488 KB | 
| 実行使用メモリ | 77,672 KB | 
| 最終ジャッジ日時 | 2024-07-21 18:14:51 | 
| 合計ジャッジ時間 | 2,872 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 | 
ソースコード
N,K,Q = map(int,input().split())
dict = {}
cnt = 1
def check(x):
    if x in dict:
        if dict[x] > cnt-N-1:
            return True
        else:
            return False
    else:
        return False
def addd(x):
    global cnt
    for xx in x:
        dict[xx] = cnt
        cnt+=1
for i in range(Q):
    que = int(input())
    if que == 1:
        nex = input()
        dict[nex] = cnt
        cnt += 1
    else:
        tes = 0
        ans = 0
        flg = True
        asa = []
        for j in range(6):
            nex2 = list(map(str,input().split()))
            if not flg:
                continue
#            print("j",j,"tes",tes)
            if check(nex2[0]):
                ti = min(int(nex2[1]),K)
                if tes + ti <= 60:
                    tes += ti
                    ans = j+1
                    asa.append(nex2[0])
                else:
                    flg = False
            else:
                ti = int(nex2[1])
                if tes + ti <= 60:
                    tes += ti
                    ans = j+1
                    asa.append(nex2[0])
                else:
                    flg = False
        addd(asa)
        print(ans) #ans
#print(dict,cnt)
            
            
            
        