結果
問題 | No.2812 Plus Minus Blackboard |
ユーザー |
![]() |
提出日時 | 2024-07-21 20:47:36 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 478 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 82,140 KB |
実行使用メモリ | 67,136 KB |
最終ジャッジ日時 | 2024-07-21 20:47:39 |
合計ジャッジ時間 | 2,720 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 22 |
ソースコード
from sortedcontainers import SortedSet, SortedList, SortedDictn=int(input())a = list(map(int, input().split()))#a.sort()mns=SortedList()pls=SortedList()for i in range(n):if a[i] <0:mns.add(a[i])else:pls.add(a[i])while len(mns)>0 and len(pls)>0:mval=mns.pop()pval=pls.pop(0)if pval+mval>0:pls.add(pval+mval)elif pval+mval<0:mns.add(pval+mval)if len(mns)+len(pls)==1:print("Yes")else:print("No")