結果
| 問題 |
No.2812 Plus Minus Blackboard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-19 21:52:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,101 bytes |
| コンパイル時間 | 741 ms |
| コンパイル使用メモリ | 94,512 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-08 23:42:41 |
| 合計ジャッジ時間 | 2,032 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 8 |
ソースコード
#include <algorithm>
#include <atcoder/fenwicktree.hpp>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <utility>
#include <vector>
using namespace std;
using i8 = int8_t;
using i32 = int;
using i64 = long long;
// using i128 = __int128;
using u64 = unsigned long long;
using ll = long long;
void _main();
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
_main();
}
i64 pow(i64 j, i64 n) {
i64 res = 1;
while (n > 0) {
if (n & 1)
res *= j;
j *= j;
n >>= 1;
}
return res;
}
using p2 = pair<i64, i64>;
void _main() {
i64 n;
cin >> n;
i64 maxa = 0, maxb = 0;
i64 cnta = 0, cntb = 0;
i64 suma = 0, sumb = 0;
for (i64 i = 0; i < n; i++) {
i64 a;
cin >> a;
if (a < 0) {
maxa = min(maxa, a);
suma += a;
cnta++;
} else if (a > 0) {
maxb = max(maxb, a);
sumb += a;
cntb++;
}
}
if ((cnta && suma - maxa + sumb >= 0) || (cntb && suma + sumb - maxb <= 0)) {
cout << "Yes\n";
} else {
cout << "No\n";
}
}