結果

問題 No.2372 既視感
ユーザー june19312june19312
提出日時 2023-07-07 22:11:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 1,224 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 79,340 KB
最終ジャッジ日時 2023-09-28 23:31:13
合計ジャッジ時間 5,214 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,316 KB
testcase_01 AC 70 ms
71,460 KB
testcase_02 AC 70 ms
71,292 KB
testcase_03 AC 70 ms
71,144 KB
testcase_04 AC 69 ms
71,284 KB
testcase_05 AC 70 ms
71,448 KB
testcase_06 AC 69 ms
71,316 KB
testcase_07 AC 69 ms
71,292 KB
testcase_08 AC 115 ms
78,224 KB
testcase_09 AC 89 ms
76,104 KB
testcase_10 AC 98 ms
76,668 KB
testcase_11 AC 112 ms
77,388 KB
testcase_12 AC 70 ms
71,532 KB
testcase_13 AC 113 ms
78,456 KB
testcase_14 AC 74 ms
71,300 KB
testcase_15 AC 91 ms
76,100 KB
testcase_16 AC 93 ms
75,988 KB
testcase_17 AC 76 ms
71,520 KB
testcase_18 AC 73 ms
71,432 KB
testcase_19 AC 71 ms
71,316 KB
testcase_20 AC 71 ms
71,300 KB
testcase_21 AC 71 ms
71,424 KB
testcase_22 AC 75 ms
71,500 KB
testcase_23 AC 125 ms
79,340 KB
testcase_24 AC 115 ms
78,472 KB
testcase_25 AC 117 ms
78,584 KB
testcase_26 AC 117 ms
78,768 KB
testcase_27 AC 116 ms
77,648 KB
testcase_28 AC 127 ms
79,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0