結果

問題 No.3220 Forest Creation
ユーザー ゼリトキ
提出日時 2025-08-01 22:25:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 756 bytes
コンパイル時間 3,068 ms
コンパイル使用メモリ 275,896 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-02 00:01:55
合計ジャッジ時間 4,534 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
const long long mod=998244353;
const long long hmod=46216567629137;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    int N;
    cin>>N;
    ll A[N+1];
    for(int i=0;i<=N;i++) cin>>A[i];
    ll amari=0;
    for(int i=N;i>=1;i--){
        if(A[i]>=1){
            amari=i;
            A[i]--;
            break;
        }
    }
    for(int i=N;i>=1;i--){
        amari+=(i-2)*A[i];
    }
    if(amari>=1){
        cout<<"No\n";
        return 0;
    }
    if(amari<-N || amari==0){
        cout<<"Yes\n";
        return 0;
    }
    if(amari%2==0){
        cout<<"Yes\n";
        return 0;
    }
    cout<<"No\n";
}   
0