結果
問題 | No.2150 Site Supporter |
ユーザー | 👑 Kazun |
提出日時 | 2022-12-07 00:09:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 840 ms / 2,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 87,200 KB |
実行使用メモリ | 127,688 KB |
最終ジャッジ日時 | 2023-08-03 14:26:06 |
合計ジャッジ時間 | 8,684 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,576 KB |
testcase_01 | AC | 73 ms
71,568 KB |
testcase_02 | AC | 72 ms
71,204 KB |
testcase_03 | AC | 73 ms
71,516 KB |
testcase_04 | AC | 72 ms
71,164 KB |
testcase_05 | AC | 72 ms
71,236 KB |
testcase_06 | AC | 72 ms
71,164 KB |
testcase_07 | AC | 73 ms
71,236 KB |
testcase_08 | AC | 260 ms
84,496 KB |
testcase_09 | AC | 548 ms
121,548 KB |
testcase_10 | AC | 341 ms
95,340 KB |
testcase_11 | AC | 840 ms
116,888 KB |
testcase_12 | AC | 289 ms
90,756 KB |
testcase_13 | AC | 342 ms
87,600 KB |
testcase_14 | AC | 74 ms
71,572 KB |
testcase_15 | AC | 73 ms
71,376 KB |
testcase_16 | AC | 74 ms
71,296 KB |
testcase_17 | AC | 490 ms
127,688 KB |
testcase_18 | AC | 302 ms
92,560 KB |
testcase_19 | AC | 231 ms
83,824 KB |
testcase_20 | AC | 517 ms
103,352 KB |
testcase_21 | AC | 236 ms
82,200 KB |
testcase_22 | AC | 534 ms
120,580 KB |
testcase_23 | AC | 73 ms
71,572 KB |
testcase_24 | AC | 73 ms
71,468 KB |
testcase_25 | AC | 76 ms
71,292 KB |
testcase_26 | AC | 72 ms
71,232 KB |
testcase_27 | AC | 240 ms
95,856 KB |
testcase_28 | AC | 304 ms
95,312 KB |
ソースコード
def solve(): from heapq import heapify, heappop, heappush N,K,X=map(int,input().split()) A=list(map(int,input().split())) inf=float("inf") T=[[inf, inf] for _ in range(N+1)] T[0][0]=0 Q=[(0,0,0)] while Q: cost,day,mode=heappop(Q) if day==N: return cost if mode==0: if cost+X<T[day][1]: T[day][1]=cost+X heappush(Q,(cost+X,day,1)) if cost+A[day]<T[day+1][0]: T[day+1][0]=cost+A[day] heappush(Q,(cost+A[day],day+1,0)) else: if cost+K<T[day+1][1]: T[day+1][1]=cost+K heappush(Q,(cost+K,day+1,1)) if cost<T[day][0]: T[day][0]=cost heappush(Q,(cost,day,0)) #================================================== print(solve())