結果

問題 No.2372 既視感
ユーザー 👑 timitimi
提出日時 2023-07-08 18:34:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 78,672 KB
最終ジャッジ日時 2023-09-29 19:53:57
合計ジャッジ時間 4,450 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,968 KB
testcase_01 AC 74 ms
71,244 KB
testcase_02 AC 72 ms
71,448 KB
testcase_03 AC 72 ms
71,292 KB
testcase_04 AC 71 ms
71,192 KB
testcase_05 AC 71 ms
71,336 KB
testcase_06 AC 70 ms
71,360 KB
testcase_07 AC 70 ms
71,200 KB
testcase_08 AC 114 ms
78,280 KB
testcase_09 AC 91 ms
76,020 KB
testcase_10 AC 116 ms
78,312 KB
testcase_11 AC 121 ms
78,220 KB
testcase_12 AC 75 ms
71,200 KB
testcase_13 AC 125 ms
78,316 KB
testcase_14 AC 83 ms
75,580 KB
testcase_15 AC 111 ms
77,500 KB
testcase_16 AC 97 ms
76,560 KB
testcase_17 AC 84 ms
75,708 KB
testcase_18 AC 78 ms
71,024 KB
testcase_19 AC 77 ms
71,176 KB
testcase_20 AC 76 ms
71,236 KB
testcase_21 AC 75 ms
71,324 KB
testcase_22 AC 78 ms
71,016 KB
testcase_23 AC 128 ms
78,672 KB
testcase_24 AC 121 ms
77,600 KB
testcase_25 AC 124 ms
78,480 KB
testcase_26 AC 128 ms
78,640 KB
testcase_27 AC 126 ms
78,336 KB
testcase_28 AC 139 ms
78,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,Q=map(int, input().split())
D=[]
for i in range(Q):
  s=int(input())
  if s==1:
    t=input()
    D.append(t)
  else:
    t=0;c=0
    E=[];F=[]
    for j in range(6):
      x,a=input().split()
      a=int(a)
      F.append((x,a))
    for j in range(6):
      x,a=F[j]
      f=0
      for k in range(min(N,len(D))):
        if D[-1-k]==x:
          f=1
          break 
      if f==0:
        if t+a<=60:
          E.append(x)
          t+=a 
          c+=1
        else:
          break
      else:
        if t+min(a,K)<=60:
          E.append(x)
          t+=min(a,K) 
          c+=1 
        else:
          break
    for e in E:
      D.append(e)
    print(c)
0