結果
問題 | No.2812 Plus Minus Blackboard |
ユーザー |
![]() |
提出日時 | 2024-07-19 21:35:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 104,828 KB |
最終ジャッジ日時 | 2024-07-19 21:36:00 |
合計ジャッジ時間 | 3,311 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 20 |
ソースコード
N = int(input())A = list(map(int, input().split()))p, m = [], []for a in A:if a > 0:p.append(a)elif a < 0:m.append(-a)if len(p) + len(m) <= 1:print("Yes")exit()if len(p) == 0 or len(m) == 0:print("No")exit()p.sort()m.sort()if len(p) == 1 and p[0] >= sum(m[:-1]):print("Yes")exit()if len(m) == 1 and m[0] >= sum(p[:-1]):print("Yes")exit()if sum(p[:-1]) >= sum(m) or sum(m[:-1]) >= sum(p):print("Yes")else:print("No")