Submission #2711594
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]); 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]); 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 | 0 |
Code Size | 1129 Byte |
Status | WA |
Exec Time | 73 ms |
Memory | 7816 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 1 ms | 256 KB |
05.txt | AC | 60 ms | 6008 KB |
06.txt | AC | 65 ms | 6332 KB |
07.txt | WA | 60 ms | 6008 KB |
08.txt | WA | 65 ms | 5768 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 62 ms | 7180 KB |
11.txt | AC | 65 ms | 5880 KB |
12.txt | AC | 65 ms | 6012 KB |
13.txt | AC | 71 ms | 7816 KB |
14.txt | WA | 70 ms | 6476 KB |
15.txt | AC | 69 ms | 6524 KB |
16.txt | AC | 71 ms | 6316 KB |
17.txt | AC | 71 ms | 6316 KB |
18.txt | AC | 71 ms | 6316 KB |
19.txt | AC | 73 ms | 6316 KB |