結果

問題 No.2372 既視感
ユーザー 👑 H20H20
提出日時 2023-07-07 21:33:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 79,432 KB
最終ジャッジ日時 2023-09-28 22:32:40
合計ジャッジ時間 4,763 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,436 KB
testcase_01 AC 91 ms
71,540 KB
testcase_02 AC 92 ms
71,644 KB
testcase_03 AC 91 ms
71,800 KB
testcase_04 AC 88 ms
71,540 KB
testcase_05 AC 91 ms
71,636 KB
testcase_06 AC 89 ms
71,432 KB
testcase_07 AC 88 ms
71,608 KB
testcase_08 AC 141 ms
78,556 KB
testcase_09 AC 107 ms
76,884 KB
testcase_10 AC 133 ms
78,052 KB
testcase_11 AC 145 ms
79,432 KB
testcase_12 AC 91 ms
71,444 KB
testcase_13 AC 137 ms
78,100 KB
testcase_14 AC 100 ms
76,652 KB
testcase_15 AC 129 ms
77,860 KB
testcase_16 AC 113 ms
77,628 KB
testcase_17 AC 101 ms
76,512 KB
testcase_18 AC 97 ms
72,216 KB
testcase_19 AC 93 ms
71,612 KB
testcase_20 AC 94 ms
71,592 KB
testcase_21 AC 91 ms
71,640 KB
testcase_22 AC 96 ms
72,056 KB
testcase_23 AC 134 ms
78,052 KB
testcase_24 AC 134 ms
77,924 KB
testcase_25 AC 138 ms
77,792 KB
testcase_26 AC 137 ms
78,196 KB
testcase_27 AC 151 ms
79,332 KB
testcase_28 AC 153 ms
79,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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