結果
| 問題 | No.3683 サーバー代がもったいない! |
| コンテスト | |
| ユーザー |
redallen@競プロ
|
| 提出日時 | 2026-09-05 14:16:24 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 348 bytes |
| 記録 | |
| コンパイル時間 | 229 ms |
| コンパイル使用メモリ | 96,340 KB |
| 実行使用メモリ | 100,108 KB |
| 最終ジャッジ日時 | 2026-09-05 14:17:25 |
| 合計ジャッジ時間 | 5,078 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 21 |
ソースコード
from heapq import heapify, heappop, heappush
N,K=map(int,input().split())
A=list(map(int,input().split()))
if N%2==1 and N//2+1<K:
print("Impossible")
elif N//2<K:
print("Impossible")
else:
A=[-v for v in A]
heapify(A)
ANS=0
for i in range(K*2-1):
x = -heappop(A)
if i%2==0:
ANS+=x
print(ANS)
redallen@競プロ