結果

問題 No.2812 Plus Minus Blackboard
ユーザー Shirotsume
提出日時 2024-07-19 22:30:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 105,996 KB
最終ジャッジ日時 2025-04-08 23:43:55
合計ジャッジ時間 4,863 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353
from heapq import heappop, heappush
n = ii()
a = li()
t = []
a.sort()
for v in a:
    heappush(t, v)
    while len(t) >= 2 and t[-1] * t[-2] <= 0:
        x = heappop(t)
        y = heappop(t)
        heappush(t, x + y)

print('Yes' if len(t) == 1 else 'No')
0