結果

問題 No.1823 Tricolor Dango
ユーザー ikomaikoma
提出日時 2022-01-28 22:33:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 104,380 KB
最終ジャッジ日時 2023-08-28 20:49:38
合計ジャッジ時間 11,339 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,088 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 308 ms
79,252 KB
testcase_12 WA -
testcase_13 AC 304 ms
81,484 KB
testcase_14 AC 340 ms
80,980 KB
testcase_15 AC 351 ms
81,064 KB
testcase_16 AC 214 ms
81,644 KB
testcase_17 AC 245 ms
81,396 KB
testcase_18 AC 306 ms
88,500 KB
testcase_19 AC 444 ms
104,380 KB
testcase_20 AC 310 ms
88,384 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

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