Submission #2711600
Source Code Expand
#include <iostream> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <numeric> // accumulate(v.begin(), v.end(), 0) using namespace std; #define ll long long int main(){ int N; cin >> N; vector< vector<int> > next(N); for(int i=0; i<N-1; i++){ int a, b; cin >> a >> b; next[a-1].push_back(b-1); next[b-1].push_back(a-1); } vector<bool> FS(N, false); vector<int> F, S; F.push_back(0); S.push_back(N-1); FS[0] = true; FS[N-1] = true; int f = 0; int s = 0; int n = 2; int nf = 1; int ns = 1; while(n < N){ int fend = F.size(); for(int i=f; i<fend; i++) for(int j=0; j<next[F[i]].size(); j++) if(!FS[next[F[i]][j]]){ F.push_back(next[F[i]][j]); FS[next[F[i]][j]] = true; nf++; n++; } f = fend; int send = S.size(); for(int i=s; i<send; i++) for(int j=0; j<next[S[i]].size(); j++) if(!FS[next[S[i]][j]]){ S.push_back(next[S[i]][j]); FS[next[S[i]][j]] = true; ns++; n++; } s = send; } if(nf > ns) cout << "Fennec" << endl; else cout << "Snuke" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Fennec VS. Snuke |
User | itohdak |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1189 Byte |
Status | AC |
Exec Time | 73 ms |
Memory | 6396 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 63 ms | 5372 KB |
06.txt | AC | 68 ms | 5760 KB |
07.txt | AC | 63 ms | 5372 KB |
08.txt | AC | 67 ms | 5760 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 62 ms | 5648 KB |
11.txt | AC | 68 ms | 5712 KB |
12.txt | AC | 68 ms | 6012 KB |
13.txt | AC | 72 ms | 6304 KB |
14.txt | AC | 71 ms | 6300 KB |
15.txt | AC | 71 ms | 6396 KB |
16.txt | AC | 73 ms | 6188 KB |
17.txt | AC | 73 ms | 6188 KB |
18.txt | AC | 73 ms | 6188 KB |
19.txt | AC | 73 ms | 6188 KB |