結果
| 問題 |
No.2812 Plus Minus Blackboard
|
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2024-08-23 23:28:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 402 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,544 KB |
| 実行使用メモリ | 104,888 KB |
| 最終ジャッジ日時 | 2025-04-08 23:45:39 |
| 合計ジャッジ時間 | 5,948 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 8 |
ソースコード
import heapq
N = int(input())
A = list(map(int, input().split()))
P = []
M = []
for a in A:
if a<0:
M.append(-a)
if a>0:
P.append(-a)
heapq.heapify(P)
heapq.heapify(M)
while len(P) and len(M):
v = -heapq.heappop(P)-heapq.heappop(M)
if v>0:
heapq.heappush(P,-v)
if v<0:
heapq.heappush(M,-v)
if len(P)+len(M)>1:
print('No')
else:
print('Yes')
H20