結果
問題 |
No.3220 Forest Creation
|
ユーザー |
|
提出日時 | 2025-08-01 22:35:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 581 bytes |
コンパイル時間 | 1,765 ms |
コンパイル使用メモリ | 195,376 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-01 22:35:37 |
合計ジャッジ時間 | 3,785 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 33 WA * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<int> A(N+1); for(auto &a : A) cin >> a; long long deg = 0; for(int i=2; i<=N; i++) if(A.at(i)){ if(deg == 0) deg = i,A.at(i)--; deg += 1LL*A.at(i)*(i-2); } int a0 = A.at(0); if(deg == 0){ if(a0%2 == 0 || a0 > N) cout << "Yes\n"; else cout << "No\n"; } else{ a0 -= deg-1; if(a0%2 == 0 || a0 > N) cout << "Yes\n"; else cout << "No\n"; } }