結果
問題 | No.2812 Plus Minus Blackboard |
ユーザー | eve__fuyuki |
提出日時 | 2024-07-19 22:41:18 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 2,378 ms |
コンパイル使用メモリ | 205,288 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 20:28:00 |
合計ジャッジ時間 | 4,036 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector<long long> a(n); long long su = 0; for (int i = 0; i < n; i++) { cin >> a[i]; su += a[i]; } if (su < 0) { su *= -1; for (int i = 0; i < n; i++) { a[i] *= -1; } } sort(a.begin(), a.end()); if (su - a.back() <= 0) { cout << "Yes\n"; } else { cout << "No\n"; } }