結果
| 問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-28 09:45:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 414 bytes |
| コンパイル時間 | 381 ms |
| コンパイル使用メモリ | 82,240 KB |
| 実行使用メモリ | 128,172 KB |
| 最終ジャッジ日時 | 2025-06-28 09:45:18 |
| 合計ジャッジ時間 | 17,162 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 28 |
ソースコード
import heapq
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int,input().split()))
A = [-A[i] for i in range(N)]
heapq.heapify(A)
if len(A)==1:
ans = 1
else:
ans = 0
while len(A)>1:
a = -heapq.heappop(A)
b = -heapq.heappop(A)
ans += 2*b
if a>b:
heapq.heappush(A,-(a-b))
print(ans)