結果
問題 |
No.2812 Plus Minus Blackboard
|
ユーザー |
![]() |
提出日時 | 2024-07-20 00:59:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 30,364 KB |
最終ジャッジ日時 | 2025-04-08 23:44:19 |
合計ジャッジ時間 | 5,804 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 1 |
ソースコード
import sys input = sys.stdin.readline from heapq import heappop,heappush N=int(input()) A=list(map(int,input().split())) P=[] M=[] for a in A: if a>=0: P.append(a) else: M.append(-a) P.sort() M.sort() while P and M: x=heappop(P) y=heappop(M) k=x-y if k>0: heappush(P,k) elif k<0: heappush(M,-k) if len(P)+len(M)==1: print("Yes") else: print("No")