結果

問題 No.2372 既視感
ユーザー miya145592miya145592
提出日時 2023-07-07 21:47:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 778 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 79,392 KB
最終ジャッジ日時 2023-09-28 22:52:54
合計ジャッジ時間 5,115 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,824 KB
testcase_01 AC 105 ms
71,568 KB
testcase_02 AC 101 ms
71,784 KB
testcase_03 AC 99 ms
71,572 KB
testcase_04 AC 99 ms
71,620 KB
testcase_05 AC 98 ms
71,572 KB
testcase_06 AC 97 ms
71,660 KB
testcase_07 AC 99 ms
71,592 KB
testcase_08 AC 133 ms
77,768 KB
testcase_09 AC 117 ms
76,412 KB
testcase_10 AC 135 ms
77,652 KB
testcase_11 AC 146 ms
77,632 KB
testcase_12 AC 104 ms
71,656 KB
testcase_13 AC 139 ms
77,816 KB
testcase_14 AC 106 ms
72,200 KB
testcase_15 AC 124 ms
76,992 KB
testcase_16 AC 120 ms
76,412 KB
testcase_17 AC 106 ms
72,196 KB
testcase_18 AC 105 ms
72,244 KB
testcase_19 AC 101 ms
71,504 KB
testcase_20 AC 103 ms
71,584 KB
testcase_21 AC 101 ms
71,424 KB
testcase_22 AC 104 ms
72,496 KB
testcase_23 AC 142 ms
77,632 KB
testcase_24 AC 144 ms
77,708 KB
testcase_25 AC 142 ms
77,736 KB
testcase_26 AC 138 ms
77,480 KB
testcase_27 AC 142 ms
77,756 KB
testcase_28 AC 161 ms
79,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, K, Q = map(int, input().split())
A = []
D = defaultdict(int)
for _ in range(Q):
    q = int(input())
    if q==1:
        s = input()
        A.append(s)
        D[s]+=1
        if len(A)>N:
            D[A[-N-1]]-=1
    else:
        TD = [input().split() for _ in range(6)]
        x = 0
        ans = 0
        for i in range(6):
            t, d = TD[i]
            d = int(d)
            if D[t]>0:
                x+=min(d, K)
            else:
                x+=d
            if x<=60:
                ans+=1
            else:
                break
        
        for i in range(ans):
            t, _ = TD[i]
            A.append(t)
            D[t]+=1
            if len(A)>N:
                D[A[-N-1]]-=1

        print(ans)
0