結果
問題 |
No.3220 Forest Creation
|
ユーザー |
![]() |
提出日時 | 2025-08-23 00:56:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 853 bytes |
コンパイル時間 | 3,682 ms |
コンパイル使用メモリ | 251,444 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-23 00:56:45 |
合計ジャッジ時間 | 5,977 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 44 WA * 2 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define ll long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define repl(i,a,b) for(ll i=(a);i<(b);i++) #define all(a) (a).begin(),(a).end() template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;} template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;} int main(){ int n; cin >> n; vector<ll> a(n+1); rep(i,0,n+1) cin >> a[i]; ll sum=0; ll cnt=0; if(n == 0){ cout << "Yes" << endl; return 0; } if(n == 1){ if(a[1]%2 == 0){ cout << "Yes" << endl; } else cout << "No" << endl; return 0; } rep(i,2,n+1){ sum+=i*a[i]; cnt+=a[i]; } if(sum-2*(cnt-1)<=a[1] && (sum-a[1])%2 == 0){ cout << "Yes" << endl; } else cout << "No" << endl; }