結果
問題 | No.2812 Plus Minus Blackboard |
ユーザー |
|
提出日時 | 2024-07-19 22:37:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 314 ms / 2,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 82,584 KB |
実行使用メモリ | 100,800 KB |
最終ジャッジ日時 | 2024-07-21 20:28:01 |
合計ジャッジ時間 | 5,624 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
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[0] * t[1] <= 0: x = heappop(t) y = heappop(t) heappush(t, x + y) print('Yes' if len(t) == 1 else 'No')