結果
| 問題 |
No.2812 Plus Minus Blackboard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-19 22:37:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 358 ms / 2,000 ms |
| コード長 | 503 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 81,864 KB |
| 実行使用メモリ | 101,004 KB |
| 最終ジャッジ日時 | 2025-06-20 02:15:04 |
| 合計ジャッジ時間 | 7,032 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
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')