結果
問題 |
No.2812 Plus Minus Blackboard
|
ユーザー |
|
提出日時 | 2024-07-19 22:18:20 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 3,224 ms |
コンパイル使用メモリ | 281,372 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 02:14:44 |
合計ジャッジ時間 | 5,535 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include<bits/stdc++.h> //#include<atcoder/all> using namespace std; typedef long long ll; using Graph = vector<vector<int>>; const int INF = 1<<30; const ll INFLL = 1LL<<60; const int MOD = 998244353; //1000000007; int main() { int n; cin >> n; vector<ll> a(n); for (int i = 0 ; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); ll a_sum = reduce(a.begin(), a.end()); bool ok = true; if (a_sum > 0 && reduce(a.begin(), a.end() - 1) > 0) ok = false; if (a_sum < 0 && reduce(a.begin() + 1, a.end()) < 0) ok = false; cout << (ok ? "Yes" : "No") << endl; return 0; }