Submission #1688953
Source Code Expand
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; int main(void) { int i,j; int n; cin>>n; vector<vi> g(n); rep(i,n-1){ int a,b; cin>>a>>b; a--,b--; g[a].push_back(b); g[b].push_back(a); } vi df(n,-1),ds(n,-1); queue<int> q; q.push(0); df[0]=0; while(q.size()){ int p=q.front(); q.pop(); rep(i,g[p].size()){ int next=g[p][i]; if(df[next]==-1){ df[next]=df[p]+1; q.push(next); } } } q.push(n-1); ds[n-1]=0; while(q.size()){ int p=q.front(); q.pop(); rep(i,g[p].size()){ int next=g[p][i]; if(ds[next]==-1){ ds[next]=ds[p]+1; q.push(next); } } } int f=0,s=0; rep(i,n) if(ds[i]<df[i])s++; else f++; if(s<=f)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Fennec VS. Snuke |
User | rika0384 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1424 Byte |
Status | WA |
Exec Time | 82 ms |
Memory | 6528 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 | WA | 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 | 66 ms | 5504 KB |
06.txt | WA | 72 ms | 5888 KB |
07.txt | AC | 66 ms | 5504 KB |
08.txt | AC | 72 ms | 5888 KB |
09.txt | WA | 1 ms | 256 KB |
10.txt | AC | 67 ms | 5760 KB |
11.txt | AC | 73 ms | 5888 KB |
12.txt | AC | 71 ms | 6272 KB |
13.txt | AC | 75 ms | 6528 KB |
14.txt | AC | 75 ms | 6528 KB |
15.txt | AC | 75 ms | 6528 KB |
16.txt | WA | 77 ms | 6528 KB |
17.txt | WA | 76 ms | 6528 KB |
18.txt | WA | 82 ms | 6528 KB |
19.txt | WA | 77 ms | 6528 KB |