結果

問題 No.2372 既視感
ユーザー flygonflygon
提出日時 2023-07-07 21:37:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 942 bytes
コンパイル時間 1,838 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 78,012 KB
最終ジャッジ日時 2023-09-28 22:37:27
合計ジャッジ時間 4,796 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,556 KB
testcase_01 AC 100 ms
71,612 KB
testcase_02 AC 99 ms
71,572 KB
testcase_03 AC 98 ms
71,848 KB
testcase_04 AC 98 ms
71,940 KB
testcase_05 AC 100 ms
71,600 KB
testcase_06 AC 100 ms
71,656 KB
testcase_07 AC 98 ms
71,648 KB
testcase_08 AC 115 ms
77,556 KB
testcase_09 AC 105 ms
72,116 KB
testcase_10 AC 114 ms
77,452 KB
testcase_11 AC 113 ms
77,452 KB
testcase_12 AC 100 ms
71,548 KB
testcase_13 AC 115 ms
77,280 KB
testcase_14 AC 101 ms
71,544 KB
testcase_15 AC 111 ms
77,528 KB
testcase_16 AC 107 ms
71,996 KB
testcase_17 AC 104 ms
72,516 KB
testcase_18 AC 102 ms
71,808 KB
testcase_19 AC 99 ms
71,908 KB
testcase_20 AC 99 ms
71,600 KB
testcase_21 AC 100 ms
71,592 KB
testcase_22 AC 102 ms
72,260 KB
testcase_23 AC 114 ms
77,548 KB
testcase_24 AC 116 ms
77,568 KB
testcase_25 AC 115 ms
77,536 KB
testcase_26 AC 114 ms
77,576 KB
testcase_27 AC 115 ms
77,528 KB
testcase_28 AC 126 ms
78,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n,k,q = map(int,input().split())

a = deque()
d = defaultdict(int)

for i in range(q):
    t = int(input())
    if t == 1:
        s = input().rstrip()
        a.append(s)
        d[s] += 1
        while len(a) > n:
            d[a.popleft()] -= 1
    else:
        now = 0
        cnt = 0
        sol = []
        for i in range(6):
            l = list(input().split())
            t = int(l[1])
            if d[l[0]] >= 1:
                t = min(t, k)
            if now + t <= 60:
                cnt += 1
                sol.append(l[0])
            now += t
        for pro in sol:
            a.append(pro)
            d[pro] += 1
        while len(a) > n:
            d[a.popleft()] -= 1
        print(cnt)

0