結果

問題 No.2812 Plus Minus Blackboard
ユーザー pia019
提出日時 2024-07-19 22:16:18
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 2,736 ms
コンパイル使用メモリ 280,512 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-08 23:43:36
合計ジャッジ時間 4,639 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#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<int> a(n);
    for (int i = 0 ; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int 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;
}
0