結果
問題 | No.2028 Even Choice |
ユーザー |
![]() |
提出日時 | 2022-08-05 23:30:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 241 ms / 2,000 ms |
コード長 | 322 bytes |
コンパイル時間 | 740 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 112,056 KB |
最終ジャッジ日時 | 2024-09-15 21:15:49 |
合計ジャッジ時間 | 5,324 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
import sysinput = sys.stdin.readlinefrom heapq import *N,K=map(int,input().split())A=list(map(int,input().split()))hp = []sm = 0ans = 0for i in range(N-1,0,-1):while len(hp)>=K:d = heappop(hp)sm -= dheappush(hp,A[i])sm += A[i]if i%2==1:ans = max(ans, sm)print(ans)