結果
| 問題 |
No.2841 Leaf Eater
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-09 23:08:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 562 bytes |
| コンパイル時間 | 1,827 ms |
| コンパイル使用メモリ | 198,608 KB |
| 最終ジャッジ日時 | 2025-02-23 22:06:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
ll N;
cin>>N;
vector<vector<int>> G(N);
vector<int> D(N,0);
vector<int> E(N,0);
for(int i=0;i<N-1;i++){
int p;
cin>>p;
p--;
G[i+1].push_back(p);
D[i+1]=D[p]+1;
E[p]++;
E[i+1]++;
}
for(int i=1;i<N;i++){
if(D[i]%2==1&&E[i]!=2){
cout<<"First"<<endl;
return;
}
}
cout<<"Second"<<endl;
}
int main() {
ll T;
cin>>T;
while(T--)solve();
}