結果
問題 |
No.3220 Forest Creation
|
ユーザー |
|
提出日時 | 2025-08-01 22:18:12 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 2,820 ms |
コンパイル使用メモリ | 278,388 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-08-02 00:01:32 |
合計ジャッジ時間 | 4,534 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 45 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n; cin >> n; vector<ll> a(n + 1); for (ll &x : a) cin >> x; ll lb = 0, ub = 0; for (ll i = 2; i <= n; i++) { lb += a[i] * (i - 1); ub += a[i] * i; } if (lb > 0) lb++; if (a[1] < lb) { cout << "No" << "\n"; return 0; } else if (a[1] <= ub) { cout << "Yes" << "\n"; return 0; } ll res = a[1] - ub; if (res % 2 == 0 || res > n) { cout << "Yes" << "\n"; } else { cout << "No" << "\n"; } return 0; }