結果
| 問題 |
No.2812 Plus Minus Blackboard
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2024-07-19 21:27:27 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 721 bytes |
| コンパイル時間 | 2,706 ms |
| コンパイル使用メモリ | 275,956 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-08 23:40:41 |
| 合計ジャッジ時間 | 3,960 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using Int = int64_t;
void Solve() {
Int n;
std::cin >> n;
std::vector<Int> a(n);
Int positive = 0;
Int negative = 0;
Int positive_max = 0;
Int negative_max = 0;
for (Int i = 0; i < n; ++i) {
std::cin >> a[i];
if (0 < a[i]) {
positive += a[i];
positive_max = std::max(positive_max, a[i]);
} else if (a[i] < 0) {
negative += -a[i];
negative_max = std::max(negative_max, -a[i]);
}
}
if (negative - negative_max <= positive_max &&
positive - positive_max <= negative_max) {
std::cout << "Yes\n";
} else {
std::cout << "No\n";
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
Solve();
}
risujiroh