結果

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

ソースコード

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-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(w)
		q=heapq.heappop(x)
		ans[q]+=1
		heapq.heappush(v,[(h-1)//a[q]+1+m,q])
		continue
	q,w=heapq.heappop(v)
	while v and v[0][0]==q:
		e,r=heapq.heappop(v)
		heapq.heappush(x,r)
	heapq.heappush(x,w)
	m=q
	q=heapq.heappop(x)
	ans[q]+=1
	heapq.heappush(v,[(h-1)//a[q]+1+m,q])
print(" ".join(map(str,ans)))
0