結果
| 問題 |
No.2146 2 Pows
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 11:34:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,151 ms / 3,000 ms |
| コード長 | 419 bytes |
| コンパイル時間 | 724 ms |
| コンパイル使用メモリ | 82,260 KB |
| 実行使用メモリ | 115,840 KB |
| 最終ジャッジ日時 | 2025-04-25 11:34:33 |
| 合計ジャッジ時間 | 30,458 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
from heapq import*
N,A,B,C=map(int,input().split())
dist=[1<<60]*(N*2)
dist[1]=A+B
hq=[(A+B,1)]
while hq:
di,po=heappop(hq)
flg=int(po>=N)
po%=N
if dist[(po*2%N)+N]>di+C:
dist[(po*2%N)+N]=di+C
heappush(hq,[di+C,(po*2%N)+N])
if dist[(po+1)%N]>di+A+B*flg:
dist[(po+1)%N]=di+A+B*flg
heappush(hq,[di+A+B*flg,(po+1)%N])
for i in range(N):
print(min(dist[i],dist[i+N]))