結果

問題 No.2372 既視感
ユーザー FromBooskaFromBooska
提出日時 2023-07-07 23:08:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 1,046 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-07-21 19:31:56
合計ジャッジ時間 4,079 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

# 問題文が長すぎる

N, K, Q = map(int, input().split())

from collections import deque
que = deque()
seen = set()

for q in range(Q):
    t = int(input())
    if t == 1:
        s = input()
        if len(que) < N:
            que.append(s)
        elif len(que) == N:
            que.popleft()
            que.append(s)
    elif t == 2:
        counting = True
        ans = 0
        time = 0
        solved = []
        for i in range(6):
            t, d = map(str, input().split())
            d = int(d)
            if t in que:
                d = min(d, K)
            if time + d <= 60:
                if counting == True:
                    ans += 1
                    time += d
                    solved.append(t)
            else:
                counting = False
                
        for sol in solved:
            if len(que) < N:
                que.append(sol)
            elif len(que) == N:
                que.popleft()
                que.append(sol)
        print(ans)
    #print('que', que)
        
        
0