結果
| 問題 |
No.1823 Tricolor Dango
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-03 18:07:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 518 bytes |
| コンパイル時間 | 459 ms |
| コンパイル使用メモリ | 82,092 KB |
| 実行使用メモリ | 102,052 KB |
| 最終ジャッジ日時 | 2025-04-03 18:07:17 |
| 合計ジャッジ時間 | 12,944 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 WA * 16 |
ソースコード
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)
while len(A)>=3:
a = heapq.heappop(A)
b = heapq.heappop(A)
c = heapq.heappop(A)
a = -a
b = -b
c = -c
a -= c
b -= c
if a>0:
heapq.heappush(A,-a)
if b>0:
heapq.heappush(A,-b)
if len(A)==0:
print("Yes")
else:
print("No")