結果

問題 No.1823 Tricolor Dango
ユーザー ikoma
提出日時 2022-01-28 22:33:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 100,300 KB
最終ジャッジ日時 2024-12-30 08:40:31
合計ジャッジ時間 11,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from heapq import *
T=int(input())

for t in range(T):
    N=int(input())
    A=list(map(lambda x:-int(x),input().split()))
    heapify(A)
    while len(A)>2:
        a,b,c=heappop(A),heappop(A),heappop(A)
        a-=c
        b-=c
        if a<0: heappush(A, a)
        if b<0: heappush(A, b)
    print("Yes" if len(A)==0 else "No")
0