結果
問題 |
No.2812 Plus Minus Blackboard
|
ユーザー |
|
提出日時 | 2025-06-07 10:13:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 104,864 KB |
最終ジャッジ日時 | 2025-06-07 10:13:26 |
合計ジャッジ時間 | 5,626 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 2 |
ソースコード
N = int(input()) A = list(map(int,input().split())) P = [] M = [] for i in range(N): if A[i]>=0: P.append(A[i]) else: M.append(A[i]) P = sorted(P,reverse=True) M = sorted(M) if len(P)>0: a = P.pop() else: a = M.pop() while True: if a>=0: if len(M)>0: b = M.pop() a = a+b else:break else: if len(P)>0: b = P.pop() a = a+b else:break if len(P)+len(M)==0: print("Yes") else: print("No")