結果

問題 No.3221 Count Turns
ユーザー ああ
提出日時 2025-08-10 22:13:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 28,720 KB
最終ジャッジ日時 2025-08-10 22:13:28
合計ジャッジ時間 11,227 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n,h,t=map(int,input().split())
a=list(map(int,input().split()))
v=[]
ans=[0]*n
for i in range(n):
	s=(h-a[i]+1)//a[i]+1
	heapq.heappush(v,[s,i])
x=[]
m=0
for i in range(t):
	if x:
		m+=1
		while v and v[0][0]<=m:
			q,w=heapq.heappop(v)
			heapq.heappush(x,w)
		q=heapq.heappop(x)
		ans[q]+=1
		heapq.heappush(v,[(h-a[q]+1)//a[q]+1+m,q])
		continue
	
	q,w=heapq.heappop(v);m=q
	heapq.heappush(x,w)
	while v and v[0][0]==m:
		e,r=heapq.heappop(v)
		heapq.heappush(x,r)
	q=heapq.heappop(x)
	ans[q]+=1
	heapq.heappush(v,[(h-a[q]+1)//a[q]+1+m,q])
print(" ".join(map(str,ans)))
0