Submission #1688975
Source Code Expand
#include<bits/stdc++.h> #define vi vector<int> #define vvi vector<vector<int> > #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> using ll = long long; using ld =long double; //#define int ll #define INF 1e9 #define EPS 0.0000000001 #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,s,n) for(int i=s;i<n;i++) #define all(in) in.begin(), in.end() template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; } template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; } #define MAX 9999999 using namespace std; typedef pair<int, int> pii; typedef pair<int,pii> piii; vector<int>w; int n; vector<int>b; vector<vector<int>>e; void _bdfs(int v){ rep(i,e[v].size()){ int next=e[v][i]; if(b[next]==INF&&next!=n-1){ b[next]=b[v]+1; _bdfs(next); } } } void _wdfs(int v){ rep(i,e[v].size()){ int next=e[v][i]; if(w[next]==INF&&next!=0){ w[next]=w[v]+1; _wdfs(next); } } } signed main(){ cin>>n; vector<vector<int>>edge(n,vector<int>()); rep(i,n-1){ pii t; cin>>t.first>>t.second; --t.first,--t.second; edge[t.first].push_back(t.second); edge[t.second].push_back(t.first); } e=edge; vector<int>_b(n,INF); _b[0]=0; vector<int>_w(n,INF);_w[n-1]=0; b=_b; w=_w; _bdfs(0); _wdfs(n-1); int wcnt=0;int bcnt=0; rep(i,n)if(b[i]<=w[i])bcnt++; else wcnt++; if(bcnt>=wcnt)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Fennec VS. Snuke |
User | yebityon |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1673 Byte |
Status | WA |
Exec Time | 117 ms |
Memory | 18944 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 | 87 ms | 12288 KB |
06.txt | WA | 97 ms | 13184 KB |
07.txt | AC | 89 ms | 12288 KB |
08.txt | AC | 94 ms | 13056 KB |
09.txt | WA | 1 ms | 256 KB |
10.txt | AC | 83 ms | 11008 KB |
11.txt | AC | 88 ms | 11392 KB |
12.txt | AC | 93 ms | 11904 KB |
13.txt | AC | 92 ms | 12544 KB |
14.txt | AC | 95 ms | 12416 KB |
15.txt | AC | 94 ms | 12416 KB |
16.txt | WA | 112 ms | 18944 KB |
17.txt | WA | 111 ms | 18944 KB |
18.txt | WA | 109 ms | 18944 KB |
19.txt | WA | 117 ms | 18944 KB |