結果

問題 No.3220 Forest Creation
ユーザー Tehom
提出日時 2025-08-23 00:45:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 4,113 ms
コンパイル使用メモリ 251,412 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-23 00:45:28
合計ジャッジ時間 5,625 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 43 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  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;
}
0