結果

問題 No.3221 Count Turns
ユーザー timi
提出日時 2025-08-03 13:00:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 119,644 KB
最終ジャッジ日時 2025-08-03 13:01:04
合計ジャッジ時間 19,833 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

N,H,T=map(int, input().split())
A=list(map(int, input().split()))

C=[]
import heapq
ans=[0]*N
for i in range(N):
  a=A[i]
  t=(H-1)//a+1
  heapq.heappush(C,(t,t*a,i))

from collections import deque
d=deque()
for j in range(T):
  if len(d)==0:
    E=[]
    t,ta,i=heapq.heappop(C)
    E.append((t,ta,i))
    p=t
    while C:
      t,ta,i=heapq.heappop(C)
      if p!=t:
        heapq.heappush(C,(t,ta,i))
        break
      else:
        E.append((t,ta,i))
    E=sorted(E,key=lambda x: x[2])
    E=sorted(E,reverse=True,key=lambda x: x[1])
    for e in E:
      d.append(e)

  t,ta,i=d.popleft()
  ans[i]+=1
  t=(H-1)//A[i]+1
  heapq.heappush(C,(ta+t,t*A[i],i))
  #print(j,C,ans)
print(*ans)
0