結果

問題 No.2372 既視感
ユーザー mkawa2mkawa2
提出日時 2023-07-07 21:37:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 1,390 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 78,060 KB
最終ジャッジ日時 2023-09-28 22:38:16
合計ジャッジ時間 4,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,760 KB
testcase_01 AC 87 ms
71,460 KB
testcase_02 AC 87 ms
71,464 KB
testcase_03 AC 92 ms
71,876 KB
testcase_04 AC 90 ms
71,852 KB
testcase_05 AC 90 ms
71,872 KB
testcase_06 AC 87 ms
71,852 KB
testcase_07 AC 89 ms
71,628 KB
testcase_08 AC 101 ms
77,280 KB
testcase_09 AC 93 ms
72,488 KB
testcase_10 AC 101 ms
76,732 KB
testcase_11 AC 101 ms
76,708 KB
testcase_12 AC 88 ms
71,556 KB
testcase_13 AC 103 ms
77,340 KB
testcase_14 AC 89 ms
71,572 KB
testcase_15 AC 97 ms
76,872 KB
testcase_16 AC 93 ms
72,404 KB
testcase_17 AC 89 ms
71,580 KB
testcase_18 AC 88 ms
71,344 KB
testcase_19 AC 88 ms
71,436 KB
testcase_20 AC 88 ms
71,816 KB
testcase_21 AC 89 ms
71,872 KB
testcase_22 AC 93 ms
71,632 KB
testcase_23 AC 102 ms
77,124 KB
testcase_24 AC 102 ms
77,288 KB
testcase_25 AC 101 ms
77,348 KB
testcase_26 AC 103 ms
77,176 KB
testcase_27 AC 101 ms
77,128 KB
testcase_28 AC 123 ms
78,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(1000005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

from collections import deque, Counter

n, k, q = LI()

fq = deque()
fc = Counter()

def push(s):
    fq.append(s)
    fc[s] += 1

def pop():
    s = fq.popleft()
    fc[s] -= 1

for _ in range(q):
    while len(fq) > n: pop()
    if II() == 1:
        s = SI()
        push(s)
    else:
        t = 0
        ans = 6
        sd = [SI().split() for _ in range(6)]
        for i, (s, d) in enumerate(sd):
            d = int(d)
            if fc[s]:
                t += min(d, k)
            else:
                t += d
            if t > 60:
                ans = i
                break
        for s, d in sd[:ans]: push(s)
        print(ans)
0