submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s563197650
p03661
C++
#include <cstdio> #include <vector> #include <cstdlib> using namespace std; int n; long long a[200005]; inline long long abs(long long x){ if(x < 0) x = -x; return x; } int main(){ scanf("%d", &n); for(int i = 1; i <= n ; ++i) scanf("%lld", &a[i]), a[i] += a[i - 1]; long long Sol = 1000000000000000000; for(int i = 1; i < n ; ++i){ long long x = a[i], y = a[n] - a[i]; if(abs(x - y) < Sol) Sol = abs(x - y); } printf("%lld", Sol); return 0; }
a.cc: In function 'int main()': a.cc:19:15: error: call of overloaded 'abs(long long int)' is ambiguous 19 | if(abs(x - y) < Sol) Sol = abs(x - y); | ~~~^~~~~~~ In file included from /usr/include/c++/14/cstdlib:79, from a.cc:3: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:8:18: note: candidate: 'long long int abs(long long int)' 8 | inline long long abs(long long x){ | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:19:39: error: call of overloaded 'abs(long long int)' is ambiguous 19 | if(abs(x - y) < Sol) Sol = abs(x - y); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:8:18: note: candidate: 'long long int abs(long long int)' 8 | inline long long abs(long long x){ | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~
s976522627
p03661
C++
c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp
a.cc:1:3: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:9: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:20: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:24: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:33: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:41: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:48: error: stray '\' in program 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ a.cc:1:2: error: found ':' in nested-name-specifier, expected '::' 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^ | :: a.cc:1:1: error: 'c' does not name a type 1 | c:\Users\mgoncharov\etc\contests\atcoder\arc078\a.cpp | ^
s298244580
p03661
C++
#include <iostream> using namespace std; #define int long long int n; int a[200001]; int Abs(int x) { if (x > 0) return x; return -x; } signed main() { int i; cin >> n; for (i = 0; i < n; i++) cin >> a[i + 1]; for (i = 1; i <= n; i++) a[i] += a[i - 1]; int ans = 1e+18; for (i = 1; i < n; i++) { ans = min(ans, Abs(a[i], a[n] - a[i])); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:19:35: error: too many arguments to function 'long long int Abs(long long int)' 19 | ans = min(ans, Abs(a[i], a[n] - a[i])); | ~~~^~~~~~~~~~~~~~~~~~~ a.cc:8:5: note: declared here 8 | int Abs(int x) { if (x > 0) return x; return -x; } | ^~~
s107105466
p03661
C++
#include "bits/stdc++.h" #define MOD 1000000007 #define INF 11234567890 #define in std::cin #define out std::cout #define rep(i,N) for(int i=0;i<N;++i) typedef long long int LL; LL N, a[112345]; LL ans; int main() { in >> N; rep(i, N) { in >> a[i]; } rep(i, N) { a[i + 1] += a[i]; } for (LL i = 0; i < N - 1; ++i) { if (i == 0) { ans = abs(a[i] - (a[N] - a[i])); } ans = std::min(ans, abs(a[i] - (a[N] - a[i]))); } out << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:21:31: error: no matching function for call to 'min(LL&, int)' 21 | ans = std::min(ans, abs(a[i] - (a[N] - a[i]))); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:21:31: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | ans = std::min(ans, abs(a[i] - (a[N] - a[i]))); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:21:31: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | ans = std::min(ans, abs(a[i] - (a[N] - a[i]))); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s443016619
p03662
C++
#include<bits/stdc++.h> #include<iostream> #include<string> #include<cmath> #include<cstdio> #include<cctype> #include<cstring> #include<iomanip> #include<cstdlib> #include<ctime> #include<set> #include<map> #include<utility> #include<queue> #include<vector> #include<stack> #include<sstream> #include<algorithm> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> pii; typedef vector<pii> vii; typedef vector<ll> vi; typedef queue<ll> qi; typedef queue<char> qc; typedef queue<string> qs; typedef vector<char> vc; typedef vector<string> vs; typedef map<char,ll> mpci; typedef map<ll,ll> mpii; typedef map<string,ll> mpsi; typedef set<ll> sei; typedef set<char> sec; typedef set<string> ses; typedef stack<ll> si; typedef stack<char> sc; typedef vector<ll> vll; typedef vector<vi> vvi; typedef vector<double> vd; typedef pair<ll,ll> pll; typedef pair<double,double> pdd; typedef vector<pll> vpll; typedef vector<pdd> vdd; typedef unsigned int uint; typedef long double ld; typedef vector<bool> vb; typedef vector<double> vd; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<vii> vvii; /*=====================================================================*/ #define mp make_pair #define pb push_back #define rep(i,n) for(int i=0;i<(int)(n);i++) //#define sz(a) (int)(a.size()) #define len(a) (int)(a.length()) #define all(s) (s).begin(),(s).end() #define fi first #define se second #define be begin #define en end #define repd(i,n) for(int i=n-1;i>=0;i--) #define forn(i,p,n) for(int i=p;i<n;i++) #define ford(i,p,n) for(int i=n-1;i>=p;i--) #define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i) #define zero(a) memset(a,0,sizeof(a)) #define number(a,num) memeset(a,num,sizeof(a)) /*=====================================================================*/ inline void read(int &x) { short negative=1; x=0; char c=getchar(); while(c<'0' || c>'9') { if(c=='-') negative=-1; c=getchar(); } while(c>='0' && c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar(); x*=negative; } inline void write(long long x) { static long long sta[35]; long long top = 0; do { sta[top++] = x % 10, x /= 10; } while (x); while (top) putchar(sta[--top] + 48); puts(""); } /*======================================================================*/ bool prime(int n) { if(n==0||n==1) return false; for(int i=2;i*i<=n;i++) if(n%i==0) return false; return true; } /*======================================================================*/ const int dx[]={-1,0,1,0}; const int dy[]={0,-1,0,1}; int color[100010],bef[100010]; vi v[100010]; int g[2]={0}; /*======================================================================*/ void dfs(int u,int p) { bef[u]=p; rep(i,v[u].size()) { if(v[u][i]!=p) dfs(v[u][i],u); } } void dfs2(int n,int p,int c) { g[c]++; rep(i,v[n].size()) { if(v[n][i]==p) continue; if(color[v[n][i]]==1-c) continue; dfs2(v[n][i],n,c); } } int main() { /* ios_base::sync_with_stdio(0); cin(tie); freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); */ /*====================================================================*/ int n; read(n); vvi e(n,vi()); rep(i,n-1) { int a,b; read(a); read(b); a--,b--; v[a].pb(b); v[b].pb(a); } vi p(n,-1),sz(n,0); memset(bef,-1,sizeof(bef)) dfs(0,-1); int c=n-1; vi path; while(c>=0) { c=bef[c]; if(c==0) break; path.pb(bef[c]); } reverse(path.begin(),path.end()); memset(color,-1,sizeof(color)); color[0]=0; color[n-1]=1; rep(i,path.size()) color[path[i]]=1; rep(i,(path.size()+1)/2) color[path[i]]=0; dfs2(0,-1,0); dfs2(n-1,-1,1); //cout<<g[0]<<" "<<g[1]<<endl; if(g[0]>g[1]) cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:156:29: error: expected ';' before 'dfs' 156 | memset(bef,-1,sizeof(bef)) | ^ | ; 157 | dfs(0,-1); | ~~~
s807642262
p03662
C++
#include<iostream> #include<queue> #include<vector> using namespace std; const int MAXN=100000+10; vector<int> edge[MAXN];//用邻接表来实现树的存储 int n,cnt[3];//cnt用来记录颜色数量 int tree[MAXN];//tree数组储存每个节点的颜色,1是指black,2指white void bfs() { queue<int> q; q.push(1),q.push(n);//Fennec先,Snuke后,所以先后入队 while(!q.empty()) { int temp=q.front(); q.pop(); cnt[tree[temp]]++;//注意位置!!(咳咳) for(int i=0;i<edge[temp].size();++i)//枚举所有节点 { int v=edge[temp][i]; //cnt[tree[temp]]++; 不要在意细节(^_^) if(tree[v])continue; else tree[v]=tree[temp];//判断是否涂过色 q.push(v); } } } int main() { ios::sync_with_stdio(false); memset(tree,0,sizeof(tree)); cin>>n; for(int i=1;i<n;++i) { int x,y; cin>>x>>y; edge[x].push_back(y); edge[y].push_back(x);//邻接表建树 } tree[1]=1,tree[n]=2; bfs(); if(cnt[2]>=cnt[1])//因为Fennec先手,所以如果最终结果相同,很明显是Snuke赢了 cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:5: error: 'memset' was not declared in this scope 35 | memset(tree,0,sizeof(tree)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<queue> +++ |+#include <cstring> 3 | #include<vector>
s477643834
p03662
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; using ii=pair<ll, ll>; using vi=vector<ll>; using vb=vector<bool>; using vvi=vector<vi>; using vii=vector<ii>; using vvii=vector<vii>; void dfs(int u, vvi &E, vi &p,vi &sz) { void sz[u]=1; for(int i=0; i<e[u].size(); j++) { if(p[u]!=e[u][j]) { p[e[u][j]]=u; dfs(e[u][j],e,p,sz); sz[u]+=sz[e[u][j]]; } } } int main() { int n; cin>>n; vvi E(n, vi()); for(int i=0; i+1<n; ++i) { int a,b; cin>>a>>b; a--,b--; E[a].push_back(b); E[b].push_back(a); } vi p(n-1),sz(n,0); dfs(0,E,p,sz); vi path; int c=n-1,psz=0; while(c>=0) { path.push_back(sz[c]-psz); psz=sz[c]; c=p[c]; } reverse(path.begin(),path.end()); ll ls=0LL,RS=0LL; int i=0,j=(int)path.size()-1; while(i<=j) { ls+=path[i++]; if(i<=j) { rs+=path[j--]; } } cout<<(ls>rs?"Fennec":"Snuke")<<endl; return 0; }
a.cc: In function 'void dfs(int, vvi&, vi&, vi&)': a.cc:13:10: error: declaration of 'sz' as array of void 13 | void sz[u]=1; | ^~ a.cc:14:20: error: 'e' was not declared in this scope 14 | for(int i=0; i<e[u].size(); j++) | ^ a.cc:14:33: error: 'j' was not declared in this scope 14 | for(int i=0; i<e[u].size(); j++) | ^ a.cc: In function 'int main()': a.cc:55:13: error: 'rs' was not declared in this scope; did you mean 'RS'? 55 | rs+=path[j--]; | ^~ | RS a.cc:58:15: error: 'rs' was not declared in this scope; did you mean 'RS'? 58 | cout<<(ls>rs?"Fennec":"Snuke")<<endl; | ^~ | RS
s202974813
p03662
C++
#include <bits/stdc++.h> using namespace std; int n; struct edge{ int to,next; }e[20010]; int head[10010],s[10010],path[10010],len,cnt; void add(int u, int v) { e[cnt++]=(edge){v,head[u]}; head[u]=cnt; } bool dfs(int x,int fa) { x==n; bool p=x; for(int i=head[x];i;i=e[i].next) { int v=e[i].to; if(v=fa) continue; p|=dfs(v,x); } s[fa]+=s[x]+1; if(p) { path[len++]=x; return true; } } int main() { cin>>n; for(int i=1,u,v; i<n; i++) { cin>>u>>v; add(u,v); add(v,u); } dfs(1,0); for(int i=len; i>len/2; i--) ans+=s[path[i]]-s[path[i-1]]; printf("%s\n", ans*2>n ? "Fennec" : "Snuke"); return 0; }
a.cc: In function 'int main()': a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 41 | ans+=s[path[i]]-s[path[i-1]]; | ^~~ | abs a.cc:42:20: error: 'ans' was not declared in this scope; did you mean 'abs'? 42 | printf("%s\n", ans*2>n ? "Fennec" : "Snuke"); | ^~~ | abs a.cc: In function 'bool dfs(int, int)': a.cc:29:1: warning: control reaches end of non-void function [-Wreturn-type] 29 | } | ^
s215061570
p03662
C++
#include<bits/stdc++.h> #define int long long using namespace std; typedef pair<int,int> P; int N; vector<int> color[100010]; //color[i] = 0は無色、1は黒、2は白 vector<int> graph[100010]; int fennec[100010]; int snuke[100010]; void bfsf(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); fennec[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(fennec[p] + 1 < fennec[graph[p].at(i)]) { fennec[graph[p].at(i)] = fennec[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { break; } } } void bfss(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); snuke[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(snuke[p] + 1 < snuke[graph[p].at(i)]) { snuke[graph[p].at(i)] = snuke[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { greak; } } } signed main() { cin >> N; for (int i = 0; i < N; i++) { int A,B; cin >> A >> B; graph[A - 1].push_back(B - 1); graph[B - 1].push_back(A - 1); } for(int i = 0;i < N;i++) { color(i) = 0; } bfsf(0); bfss(N - 1); int F = 0; int S = 0; for (int i = 0; i < N; i++) { if(fennec[i] > snuke[i]) { S++; } else { F++; } } if(S >= F) { cout << "snuke" << endl; } else { cout << "fennec" << endl; } }
a.cc: In function 'void bfss(long long int)': a.cc:49:13: error: 'greak' was not declared in this scope 49 | greak; | ^~~~~ a.cc: In function 'int main()': a.cc:63:14: error: 'color' cannot be used as a function 63 | color(i) = 0; | ~~~~~^~~
s925771371
p03662
C++
#include<bits/stdc++.h> #define int long long using namespace std; typedef pair<int,int> P; int N; vector<int> color[100010]; //color[i] = 0は無色、1は黒、2は白 vector<bool> vector<int> graph[100010]; int fennec[100010]; int snuke[100010]; void bfsf(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); fennec[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(fennec[p] + 1 < fennec[graph[p].at(i)]) { fennec[graph[p].at(i)] = fennec[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { greak; } } } void bfss(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); snuke[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(snuke[p] + 1 < snuke[graph[p].at(i)]) { snuke[graph[p].at(i)] = snuke[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { greak; } } } signed main() { cin >> N; for (int i = 0; i < N; i++) { int A,B; cin >> A >> B; graph[A - 1].push_back(B - 1); graph[B - 1].push_back(A - 1); } for(int i = 0;i < N;i++) { color(i) = 0; } bfsf(0); bfss(N - 1); int F = 0; int S = 0; for (int i = 0; i < N; i++) { if(fennec[i] > snuke[i]) { S++; } else { F++; } } if(S >= F) { cout << "snuke" << endl; } else { cout << "fennec" << endl; } }
a.cc:9:13: error: invalid declarator before 'graph' 9 | vector<int> graph[100010]; | ^~~~~ a.cc: In function 'void bfsf(long long int)': a.cc:21:27: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 21 | for(int i = 0;i < graph[p].size();i++) { | ^~~~~ | isgraph a.cc:29:13: error: 'greak' was not declared in this scope 29 | greak; | ^~~~~ a.cc: In function 'void bfss(long long int)': a.cc:42:27: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 42 | for(int i = 0;i < graph[p].size();i++) { | ^~~~~ | isgraph a.cc:50:13: error: 'greak' was not declared in this scope 50 | greak; | ^~~~~ a.cc: In function 'int main()': a.cc:60:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 60 | graph[A - 1].push_back(B - 1); | ^~~~~ | isgraph a.cc:64:14: error: 'color' cannot be used as a function 64 | color(i) = 0; | ~~~~~^~~
s845511874
p03662
C++
#include<bits/stdc++.h> #define int long long using namespace std; typaedef pair<int,int> P; int N; vector<int> color[100010]; //color[i] = 0は無色、1は黒、2は白 vector<bool> vector<int> graph[100010]; int fennec[100010]; int snuke[100010]; void bfsf(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); fennec[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(fennec[p] + 1 < fennec[graph[p].at(i)]) { fennec[graph[p].at(i)] = fennec[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { greak; } } } void bfss(int s) { priority_queue<int,vector<int>,greater<int>> que; que.push(s); snuke[s] = 0; while(true) { int p = que.top(); que.pop(); bool update = false; for(int i = 0;i < graph[p].size();i++) { if(snuke[p] + 1 < snuke[graph[p].at(i)]) { snuke[graph[p].at(i)] = snuke[p] + 1; que.push(graph[p].at(i)); update = true; } } if(update == false) { greak; } } } signed main() { cin >> N; for (int i = 0; i < N; i++) { int A,B; cin >> A >> B; graph[A - 1].push_back(B - 1); graph[B - 1].push_back(A - 1); } for(int i = 0;i < N;i++) { color(i) = 0; } bfsf(0); bfss(N - 1); int F = 0; int S = 0; for (int i = 0; i < N; i++) { if(fennec[i] > snuke[i]) { S++; } else { F++; } } if(S >= F) { cout << "snuke" << endl; } else { cout << "fennec" << endl; } }
a.cc:4:1: error: 'typaedef' does not name a type; did you mean 'typedef'? 4 | typaedef pair<int,int> P; | ^~~~~~~~ | typedef a.cc:9:13: error: invalid declarator before 'graph' 9 | vector<int> graph[100010]; | ^~~~~ a.cc: In function 'void bfsf(long long int)': a.cc:21:27: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 21 | for(int i = 0;i < graph[p].size();i++) { | ^~~~~ | isgraph a.cc:29:13: error: 'greak' was not declared in this scope 29 | greak; | ^~~~~ a.cc: In function 'void bfss(long long int)': a.cc:42:27: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 42 | for(int i = 0;i < graph[p].size();i++) { | ^~~~~ | isgraph a.cc:50:13: error: 'greak' was not declared in this scope 50 | greak; | ^~~~~ a.cc: In function 'int main()': a.cc:60:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'? 60 | graph[A - 1].push_back(B - 1); | ^~~~~ | isgraph a.cc:64:14: error: 'color' cannot be used as a function 64 | color(i) = 0; | ~~~~~^~~
s389124671
p03662
C++
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; using ll=long long; using datas=pair<ll,ll>; using ddatas=pair<double,double>; using tdata=pair<ll,datas>; using vec=vector<ll>; using mat=vector<vec>; using pvec=vector<datas>; using pmat=vector<pvec>; #define For(i,a,b) for(i=a;i<b;i++) #define bFor(i,a,b) for(i=a;i>=b;i--) #define rep(i,N) For(i,0,N) #define rep1(i,N) For(i,1,N) #define brep(i,N) bFor(i,N-1,0) #define all(v) (v).begin(),(v).end() #define allr(v) (v).rbegin(),(v).rend() #define vsort(v) sort(all(v)) #define vrsort(v) sort(allr(v)) #define endl "\n" #define pb push_back #define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0) const ll mod=1000000007; const ll inf=1LL<<60; template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} double distance(ddatas& x,ddatas& y){ double a=x.first-y.first,b=x.second-y.second; return sqrt(a*a+b*b); } ll modinv(ll a) { ll b=mod,u=1,v=0,t; while(b){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return (u+mod)%mod; } ll moddevide(ll a,ll b){return (a*modinv(b))%mod;} vec modncrlistp,modncrlistm; ll modncr(ll n,ll r){ ll i,size=modncrlistp.size(); if(size<=n){ modncrlistp.resize(n+1); modncrlistm.resize(n+1); if(!size){ modncrlistp[0]=modncrlistm[0]=1; size++; } For(i,size,n+1){ modncrlistp[i]=modncrlistp[i-1]*i%mod; modncrlistm[i]=modinv(modncrlistp[i]); } } return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod; } ll modpow(ll a,ll n){ ll res=1; while(n){ if(n&1)res=res*a%mod; a=a*a%mod; n>>=1; } return res; } ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} ll countdigits(ll n){ ll ans=0; while(n){n/=10;ans++;} return ans; } ll sumdigits(ll n){ ll ans=0; while(n){ans+=n%10;n/=10;} return ans; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll i,N,a,b; cin>>N; vec color(N,0); mat v(N); rep(i,N){ cin>>a>>b; a--;b--; v[a].pb(b); v[b].pb(a); } color[0]=1; color[N-1]=-1; queue<ll> que; que.push(0); que.push(N-1); while(!que.empty()){ auto x=que.front();que.pop(); for(auto i:v[x]){ if(!color[i]){ color[i]=color[x]; que.push(i); } } if(accumulate(all(color),0LL)>0){ cout<<"Fennec"<<endl; }else{ cout<<"Snuke"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:122:2: error: expected '}' at end of input 122 | } | ^ a.cc:90:11: note: to match this '{' 90 | int main(){ | ^
s985947057
p03662
Java
import java.util.*; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[]$) { int n = scanner.nextInt(); List<Integer>[] edge = new ArrayList[n]; for (int i = 0; i < n; i++) { edge[i] = new ArrayList<>(); } for (int i = 1; i < n; i++) { int a = scanner.nextInt() - 1; int b = scanner.nextInt() - 1; edge[a].add(b); edge[b].add(a); } Deque<Integer> deque = new ArrayDeque<>(); deque.add(0); int[] dist1 = new int[n]; boolean[] visited1 = new boolean[n]; while (!deque.isEmpty()) { int i = deque.poll(); for (int j : edge[i]) { if (!visited1[j]) { visited1[j] = true; Utils.println(i, j, deque); dist1[j] = dist1[i] + 1; deque.add(j); } } } deque.add(n - 1); int[] dist2 = new int[n]; boolean[] visited2 = new boolean[n]; while (!deque.isEmpty()) { int i = deque.poll(); for (int j : edge[i]) { if (!visited2[j]) { visited2[j] = true; dist2[j] = dist2[i] + 1; deque.add(j); } } } int count1 = 0; int count2 = 0; for (int i = 0; i < n; i++) { if (dist1[i] <= dist2[i]) { count1++; } else { count2++; } } System.out.println(count1 >= count2 ? "Fennec" : "Snuke"); } }
Main.java:28: error: cannot find symbol Utils.println(i, j, deque); ^ symbol: variable Utils location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s724245497
p03662
C++
#include "bits/stdc++.h" using namespace std; int N, INF = 1000000000; static int Dis1[100010] = {}, DisN[100010] = {}; vector<int> V[100010]; void BFS1() { for (int i = 1; i < N; i++) { Dis1[i] = INF; } queue<int> Q; Q.push(0); while (Q.size()) { int x = Q.front(); Q.pop(); for (int i : V[x]) { if (Dis1[i] == INF) { Q.push(i); Dis1[i] = Dis1[x] + 1; } } } } void BFSN() { for (int i = 0; i < N - 1; i++) { DisN[i] = INF; } queue<int> Q; Q.push(N - 1); while (Q.size()) { int x = Q.front(); Q.pop(); for (int i : V[x]) { if (DisN[i] == INF) { Q.push(i); DisN[i] = DisN[x] + 1; } } } }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s108812870
p03662
C++
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <vector> #include <iomanip> #define ALL(x) (x).begin(), (x).end() #define rt return #define dll(x) scanf("%I64d",&x) #define xll(x) printf("%I64d\n",x) #define sz(a) int(a.size()) #define all(a) a.begin(), a.end() #define rep(i,x,n) for(int i=x;i<n;i++) #define repd(i,x,n) for(int i=x;i<=n;i++) #define pii pair<int,int> #define pll pair<long long ,long long> #define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define MS0(X) memset((X), 0, sizeof((X))) #define MSC0(X) memset((X), '\0', sizeof((X))) #define pb push_back #define mp make_pair #define fi first #define se second #define eps 1e-6 #define gg(x) getInt(&x) #define db(x) cout<<"== [ "<<x<<" ] =="<<endl; using namespace std; typedef long long ll; ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} ll powmod(ll a, ll b, ll MOD) {ll ans = 1; while (b) {if (b % 2)ans = ans * a % MOD; a = a * a % MOD; b /= 2;} return ans;} inline void getInt(int* p); const int maxn = 1000010; const int inf = 0x3f3f3f3f; /*** TEMPLATE CODE * * STARTS HERE ***/ std::vector<int> v[maxn]; int n; int vis[maxn]; int main() { //freopen("D:\\common_text\\code_stream\\in.txt","r",stdin); //freopen("D:\\common_text\\code_stream\\out.txt","w",stdout); gbtb; cin >> n; int a, b; repd(i, 2, n) { cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } vis[1] = 1; vis[n] = 1; int cntf = 0; int cnts = 0; queue<pii> q; q.push(mp(1, 0)); q.push(mp(n, 1)); pii temp; int flag = 1; while (!q.empty()) { temp = q.front(); if (temp.se == flag) { q.pop(); } else { flag = !flag; continue; } for (auto x : v[temp.fi]) { if (!vis[x]) { vis[x] = 1; q.push(mp(x, flag)); if (!flag) { cntf++; } else { cnts++; } } } } if (cntf > cnts) { cout << "Fennec" << endL; } else { cout << "Snuke" << endl; } // db(cntf); // db(cnts); return 0; } inline void getInt(int* p) { char ch; do { ch = getchar(); } while (ch == ' ' || ch == '\n'); if (ch == '-') { *p = -(getchar() - '0'); while ((ch = getchar()) >= '0' && ch <= '9') { *p = *p * 10 - ch + '0'; } } else { *p = ch - '0'; while ((ch = getchar()) >= '0' && ch <= '9') { *p = *p * 10 + ch - '0'; } } }
a.cc: In function 'int main()': a.cc:94:29: error: 'endL' was not declared in this scope 94 | cout << "Fennec" << endL; | ^~~~
s938270981
p03662
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.function.Consumer; import java.util.stream.IntStream; import static java.util.stream.Collectors.toList; public class Main { private static final Scanner scanner = new Scanner(System.in); private static final Consumer<List<String>> consumer = solve(); public static void main(String[] args) { consumer.accept(readInput()); } private static List<String> readInput() { final List<String> lineList = new ArrayList<>(); while (scanner.hasNextLine()) { lineList.add(scanner.nextLine()); } return lineList; } private static Consumer<List<String>> solve() { return args -> { final List<List<Integer>> numListList = args.stream().skip(1) .map(line -> Arrays.stream(line.split(" ")).map(Integer::valueOf).collect(toList())) .collect(toList()); final List<List<Integer>> tree = new ArrayList<>(); IntStream.range(0, numListList.size() + 1).forEach(x -> tree.add(new ArrayList<>())); numListList.forEach(numList -> { tree.get(numList.get(0) - 1).add(numList.get(1) - 1); tree.get(numList.get(1) - 1).add(numList.get(0) - 1); }); Integer black = 0; { List<Boolean> visited = IntStream.range(0, numListList.size() + 1).mapToObj(x -> false).collect(toList()); List<AbstractMap.SimpleEntry<Integer, Integer>> que = new ArrayList<>(); que.add(new AbstractMap.SimpleEntry<>(0, 0)); while (!que.isEmpty()) { final AbstractMap.SimpleEntry<Integer, Integer> curr = que.remove(0); final Integer index = curr.getKey(); final Integer depth = curr.getValue(); if (index == numListList.size() - 1) { continue; } visited.set(index, true); List<AbstractMap.SimpleEntry<Integer, Integer>> children = new ArrayList<>(); tree.get(index).stream() .filter(x -> !visited.get(x)) .forEach(nextIndex -> children.add(new AbstractMap.SimpleEntry(nextIndex, depth + 1))); que.addAll(children); if (children.isEmpty()) { black += depth; } } } Integer white = 0; { List<Boolean> visited = IntStream.range(0, numListList.size() + 1).mapToObj(x -> false).collect(toList()); List<AbstractMap.SimpleEntry<Integer, Integer>> que = new ArrayList<>(); que.add(new AbstractMap.SimpleEntry<>(numListList.size(), 0)); while (!que.isEmpty()) { final AbstractMap.SimpleEntry<Integer, Integer> curr = que.remove(0); final Integer index = curr.getKey(); final Integer depth = curr.getValue(); if (index == 0) { continue; } visited.set(index, true); List<AbstractMap.SimpleEntry<Integer, Integer>> children = new ArrayList<>(); tree.get(index).stream() .filter(x -> !visited.get(x)) .forEach(nextIndex -> children.add(new AbstractMap.SimpleEntry(nextIndex, depth + 1))); que.addAll(children); if (children.isEmpty()) { white += depth; } } } Integer med = numListList.size() - white - black; if (med % 2 == 0) { System.out.println(black > white? "Fennec" : "Snuke"); } else { System.out.println(black >= white? "Fennec" : "Snuke"); } }; } }
Main.java:42: error: package AbstractMap does not exist List<AbstractMap.SimpleEntry<Integer, Integer>> que = new ArrayList<>(); ^ Main.java:43: error: package AbstractMap does not exist que.add(new AbstractMap.SimpleEntry<>(0, 0)); ^ Main.java:45: error: package AbstractMap does not exist final AbstractMap.SimpleEntry<Integer, Integer> curr = que.remove(0); ^ Main.java:52: error: package AbstractMap does not exist List<AbstractMap.SimpleEntry<Integer, Integer>> children = new ArrayList<>(); ^ Main.java:55: error: package AbstractMap does not exist .forEach(nextIndex -> children.add(new AbstractMap.SimpleEntry(nextIndex, depth + 1))); ^ Main.java:66: error: package AbstractMap does not exist List<AbstractMap.SimpleEntry<Integer, Integer>> que = new ArrayList<>(); ^ Main.java:67: error: package AbstractMap does not exist que.add(new AbstractMap.SimpleEntry<>(numListList.size(), 0)); ^ Main.java:69: error: package AbstractMap does not exist final AbstractMap.SimpleEntry<Integer, Integer> curr = que.remove(0); ^ Main.java:76: error: package AbstractMap does not exist List<AbstractMap.SimpleEntry<Integer, Integer>> children = new ArrayList<>(); ^ Main.java:79: error: package AbstractMap does not exist .forEach(nextIndex -> children.add(new AbstractMap.SimpleEntry(nextIndex, depth + 1))); ^ 10 errors
s628265104
p03662
C++
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define max(a,b) a>b?a:b #define N 105 int a[N][N],dis1[N],dis2[N]; int n,res; vector<int>g[N]; void dfs(int cur, int pre, int len, int dist[]) { int now; dist[cur]=len; for(i=0;i<g[cur].size();++i) { now=g[cur][i]; if(now!=pre) dfs(now,cur,len+1,dist); } } int main() { int i,x,y; scanf("%d",&n); for(i=0;i<n-1;++i) { scanf("%d%d",&x,&y); g[x].push_back(y); g[y].push_back(x); } dfs(1,-1,0,dis1); dfs(n,-1,0,dis2); int ans=0; for(i=2;i<n;++i) { if(dis1[i]<=dis2[i]) ans++; else ans--; } if(ans>0) cout<<"Fennec"; else cout<<"Snuke"; return 0; }
a.cc: In function 'void dfs(int, int, int, int*)': a.cc:14:13: error: 'i' was not declared in this scope 14 | for(i=0;i<g[cur].size();++i) | ^
s030948255
p03662
C++
#include <iostream> #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <sstream> using namespace std; typedef long long LL; #define lowbit(x) ((x)&(-x)) #define INF 0x3f3f3f3f #define memset(a,b) memset(a,b,sizeof(a)) #defineGE() printf(">----------\n") #defineIN() freopen("in.txt","r",stdin) #defineOUT() freopen("out.txt","w",stdout) const int mod=1e9+7; const LL inf=0x3f3f3f3f3f3f3f3f; const double pi=acos(-1.0); const double eps=1e-8; const int maxn=100005; int n, p; vector<int> E[maxn]; int vis[maxn]; int dfs(int u, int step){ vis[u]=1; if(u==n){ int mid=step/2+1+step%2; if(step==mid)p=u; return mid; } for(int i=0;i<E[u].size();i++){ int v=E[u][i]; if(!vis[v]){ int mid=dfs(v, step+1); if(mid&&step==mid&&!p)p=u; if(mid)return mid; } } return 0; } int dfs2(int u){ vis[u]=1; if(u==p)return 0; int add=0; for(int i=0;i<E[u].size();i++){ int v=E[u][i]; if(!vis[v]){ add+=dfs2(v); } } return add+1; } int main() { while(~scanf("%d", &n)){ p=0; int u, v; for(int i=1;i<=n;i++)E[i].clear(); for(int i=0;i<n-1;i++){ scanf("%d%d", &u, &v); E[u].push_back(v); E[v].push_back(u); } memset(vis, 0); dfs(1, 1); memset(vis, 0); int sum=dfs2(1); printf("%s\n", sum>n-sum?"Fennec":"Snuke"); } return 0; }
a.cc:20:2: error: invalid preprocessing directive #defineGE; did you mean #define? 20 | #defineGE() printf(">----------\n") | ^~~~~~~~ | define a.cc:21:2: error: invalid preprocessing directive #defineIN; did you mean #define? 21 | #defineIN() freopen("in.txt","r",stdin) | ^~~~~~~~ | define a.cc:22:2: error: invalid preprocessing directive #defineOUT; did you mean #define? 22 | #defineOUT() freopen("out.txt","w",stdout) | ^~~~~~~~~ | define
s630922777
p03662
C
#include<iostream> #include<vector> #include<mem.h> using namespace std; #define N 110 vector<int>g[N]; int dis1[N], parent[N]; int n, num; //work out the distance between each point and first point with dfs void dfs_dis(int cur, int par){ int next; dis1[cur] = dis1[par] + 1; for(int i = 0; i < g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; parent[cur] = par; dfs_dis(next, cur); } } void dfs_child(int cur, int par){ int next; num++; for(int i = 0;i <g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; dfs_child(next, cur); } } int main(int argc, char const *argv[]) { int to, from; while(cin>>n){ //init num = 0; memset(dis1, 0, sizeof(dis1)); memset(parent, 0, sizeof(parent)); for(int i = 0; i < N; i++){ g[i].clear(); } //read g[N][i] for(int i = 0; i < n-1; i++){ cin>>to>>from; g[to].push_back(from); g[from].push_back(to); } //work out dis1[i] dis1[0] = -1, dis1[1] = 0; dis1[0] = -1; dfs_dis(1, 0); //find the middle point between 1 and n //how to find a tree? int cur = n; int par = parent[cur]; for(int i = 0; i < (dis1[n]-1)/2; i++){ int t = cur; cur = par; par = parent[t]; } dfs_child(cur, par); if(num > n-num) cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s768692100
p03662
C++
#include<iostream> #include<vector> #include<mem.h> using namespace std; #define N 110 vector<int>g[N]; int dis1[N], parent[N]; int n, num; //work out the distance between each point and first point with dfs void dfs_dis(int cur, int par){ int next; dis1[cur] = dis1[par] + 1; for(int i = 0; i < g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; parent[cur] = par; dfs_dis(next, cur); } } void dfs_child(int cur, int par){ int next; num++; for(int i = 0;i <g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; dfs_child(next, cur); } } int main(int argc, char const *argv[]) { int to, from; while(cin>>n){ //init num = 0; memset(dis1, 0, sizeof(dis1)); memset(parent, 0, sizeof(parent)); for(int i = 0; i < N; i++){ g[i].clear(); } //read g[N][i] for(int i = 0; i < n-1; i++){ cin>>to>>from; g[to].push_back(from); g[from].push_back(to); } //work out dis1[i] dis1[0] = -1, dis1[1] = 0; dis1[0] = -1; dfs_dis(1, 0); //find the middle point between 1 and n //how to find a tree? int cur = n; int par = parent[cur]; for(int i = 0; i < (dis1[n]-1)/2; i++){ int t = cur; cur = par; par = parent[t]; } dfs_child(cur, par); if(num > n-num) cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl; } return 0; }
a.cc:3:9: fatal error: mem.h: No such file or directory 3 | #include<mem.h> | ^~~~~~~ compilation terminated.
s736118986
p03662
C++
#include<iostream> #include<vector> #include<mem.h> using namespace std; #define N 110 vector<int>g[N]; int dis1[N], parent[N]; int n, num; //work out the distance between each point and first point with dfs void dfs_dis(int cur, int par){ int next; dis1[cur] = dis1[par] + 1; for(int i = 0; i < g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; parent[cur] = par; dfs_dis(next, cur); } } void dfs_child(int cur, int par){ int next; num++; for(int i = 0;i <g[cur].size(); i++){ next = g[cur][i]; if(next == par) continue; dfs_child(next, cur); } } int main(int argc, char const *argv[]) { int to, from; while(cin>>n){ //init num = 0; memset(dis1, 0, sizeof(dis1)); memset(parent, 0, sizeof(parent)); for(int i = 0; i < N; i++){ g[i].clear(); } //read g[N][i] for(int i = 0; i < n-1; i++){ cin>>to>>from; g[to].push_back(from); g[from].push_back(to); } //work out dis1[i] dis1[0] = -1, dis1[1] = 0; dis1[0] = -1; dfs_dis(1, 0); //find the middle point between 1 and n //how to find a tree? int cur = n; int par = parent[cur]; for(int i = 0; i < (dis1[n]-1)/2; i++){ int t = cur; cur = par; par = parent[t]; } dfs_child(cur, par); if(num > n-num) cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl; } return 0; }
a.cc:3:9: fatal error: mem.h: No such file or directory 3 | #include<mem.h> | ^~~~~~~ compilation terminated.
s515260122
p03662
C
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> #include <map> #include <set> #include <iomanip> #include <math.h> #include <stdlib.h> #include <list> #include <utility> #include <memory> #include <cstring> #include <fstream> #include <numeric> #include <assert.h> #include <bits/stdc++.h> using namespace std; int a[100004],b[100004]; vector <int> g[100004]; bool vis[100004]; int main(){ int n; cin>>n; for (int i=0;i<n-1;i++){ int x,y; cin>>x>>y; g[x].push_back(y); g[y].push_back(x); } queue <int> qa,qb; qa.push(1),qb.push(n); vis[1]=1,vis[n]=1; while (1){ if (qa.empty()){ cout<<"Snuke"; return 0; } if (qb.empty()){ cout<<"Fennec"; return 0; } int m=qa.front(),p=qb.front(); qa.pop(),qb.pop(); for (int i=0;i<g[m].size();i++) if (!vis[g[m][i]]){ qa.push(g[m][i]); vis[g[m][i]]=1; } for (int i=0;i<g[p].size();i++) if (!vis[g[p][i]]){ qb.push(g[p][i]); vis[g[p][i]]=1; } } }
main.c:1:10: fatal error: algorithm: No such file or directory 1 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s786701599
p03662
C
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> #include <map> #include <set> #include <iomanip> #include <math.h> #include <stdlib.h> #include <list> #include <utility> #include <memory> #include <cstring> #include <fstream> #include <numeric> #include <assert.h> #include <bits/stdc++.h> using namespace std; int a[100004],b[100004]; vector <int> g[100004]; bool vis[100004]; int main(){ int n; cin>>n; for (int i=0;i<n-1;i++){ int x,y; cin>>x>>y; g[x].push_back(y); g[y].push_back(x); } queue <int> qa,qb; qa.push(1),qb.push(n); vis[1]=1,vis[n]=1; while (!(qa.empty(),qb.empty())){ if (qa.empty()){ cout<<"Snuke"; return 0; } if (qb.empty()){ cout<<"Fennec"; return 0; } int m=qa.front(),p=qb.front(); qa.pop(),qb.pop(); for (int i=0;i<g[m].size();i++) if (!vis[g[m][i]]){ qa.push(g[m][i]); vis[g[m][i]]=1; } for (int i=0;i<g[p].size();i++) if (!vis[g[p][i]]){ qb.push(g[p][i]); vis[g[p][i]]=1; } } cout<<"Fennec"; }
main.c:1:10: fatal error: algorithm: No such file or directory 1 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s964225500
p03662
C++
#include<iostream> #include<algorithm> #include<string> #include<map> #include<set> #include<vector> #include<string.h> #include<math.h> #include<stdio.h> #include<queue> #include<utility> #include<cstdio> #include<cstring> #include<new> #include<new.h> #include<float.h> #include<ctype.h> #include<cfloat> #include<cmath> #include<cctype> #include<errno.h> #include<cerrno> #include<memory> #include<memory.h> #include<assert.h> #include<cassert> #include<deque> #define fo(i,w,n) for(int i=(int) w;i<(int) n;i++) #define qui queue<int> #define vit vector<int> #define ll long long #define pb push_back #define lb lower_bound #define ub upper_bound #define prq priority_queue #define pii pair<int,int> #define mp make_pair #define sz size() #define em empty() #define ct continue #define ms multiset #define all(a) (a).begin(),(a).end() #define pf push_front #define ppf pop_front() using namespace std; const int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; int n,x,y,p=0,u=0,e[101010],g[101010],fe[101010],sn[101010]; vit v[101010]; void dfs(int r){ fo(i,0,v[r].sz)if(e[v[r][i]]){ fe[v[r][i]]+=fe[r]; e[v[r][i]]=0; dfs(v[r][i]); } } void dfs2(int r){ g[r]=0; fo(i,0,v[r].sz)if(g[v[r][i]]){ sn[v[r][i]]+=fe[r]; dfs(v[r][i]); } } int main() { cin>>n; fo(i,1,n+1){ e[i]=1; g[i]=1; if(i==1){ fe[i]=0; sn[i]=1; } else if(i==n){ fe[i]=1; sn[i]=0; } else{ fe[i]=1; sn[i]=1; } } fo(i,1,n){ cin>>x>>y; v[x].pb(y); v[y].pb(x); } dfs(1); dfs2(n); fo(i,1,n+1){ if(fe[i]>sn[i])u++; else p++; } if(p>u)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; return 0; }
a.cc:15:9: fatal error: new.h: No such file or directory 15 | #include<new.h> | ^~~~~~~ compilation terminated.
s129381229
p03662
C++
#include<iostream> #include<algorithm> #include<string> #include<map> #include<set> #include<vector> #include<string.h> #include<math.h> #include<stdio.h> #include<queue> #include<utility> #include<cstdio> #include<cstring> #include<new> #include<new.h> #include<float.h> #include<ctype.h> #include<cfloat> #include<cmath> #include<cctype> #include<errno.h> #include<cerrno> #include<memory> #include<memory.h> #include<assert.h> #include<cassert> #include<deque> #define fo(i,w,n) for(int i=(int) w;i<(int) n;i++) #define qui queue<int> #define vit vector<int> #define ll long long #define pb push_back #define lb lower_bound #define ub upper_bound #define prq priority_queue #define pii pair<int,int> #define mp make_pair #define sz size() #define em empty() #define ct continue #define ms multiset #define all(a) (a).begin(),(a).end() #define pf push_front #define ppf pop_front() using namespace std; const int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; int n,x,y,p=0,u=0,e[101010],g[101010]; vit v[101010],s[101010]; void dfs(int r){ if(v[r].sz>1&&e[r]){ p++; e[r]=0; fo(i,0,n)dfs(v[r][i]); } } void dfs2(int r){ if(s[r].sz>1&&g[r]){ u++; g[r]=0; fo(i,0,n)dfs(s[r][i]); } } int main() { cin>>n; fo(i,1,n)e[i]=g[i]=1; fo(i,1,n){ cin>>x>>y; if(y!=n)v[x].pb(y); if(x!=n)v[y].pb(x); if(x>1)s[y].pb(x); if(y>1)s[x].pb(y); } dfs(1); dfs(n); if(p>u)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; return 0; }
a.cc:15:9: fatal error: new.h: No such file or directory 15 | #include<new.h> | ^~~~~~~ compilation terminated.
s373360132
p03662
C++
#include<iostream> #include<cstdio> using namespace std; int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; inline int read(){ char c=getchar(); int x=0; for(;c>'9'||c<'0';) c=getchar(); for(;c>='0'&&c<='9';){ x=(x<<3)+(x<<1)+c-'0'; c=getchar(); return x; } } void add(int x,int y){ cnt++; e[cnt]=y; next[cnt]=last[x]; last[x]=cnt; } void dfs(int u,int f){ int i,v; fa[u]=f; size[u]=1; for(i=last[u];i;i=next[i]){ v=e[i]; if(v!=f){ dfs(v,u); size[u]+=size[v]; } } } int main(){ n=read(); for(int i=1;i<n;i++){ a=read(),b=read(); add(a,b);add(b,a); } dfs(1,0); tmp=n; while(tmp!=1) tmp=fa[tmp],tot++; tot--,tmp=0,a=n; while(tmp<tot/2) a=fa[a],tmp++; b=fa[a]; dfs(a,0); sum1=size[b];sum2=n-sum1; if(sum1>sum2) puts("Fennec"); else puts("Snuke"); return 0; }
a.cc: In function 'void add(int, int)': a.cc:18:9: error: reference to 'next' is ambiguous 18 | next[cnt]=last[x]; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:4:81: note: 'int next [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc: In function 'void dfs(int, int)': a.cc:24:9: error: reference to 'size' is ambiguous 24 | size[u]=1; | ^~~~ In file included from /usr/include/c++/14/string:53: /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:14: note: 'int size [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc:25:27: error: reference to 'next' is ambiguous 25 | for(i=last[u];i;i=next[i]){ | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:4:81: note: 'int next [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc:29:25: error: reference to 'size' is ambiguous 29 | size[u]+=size[v]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:14: note: 'int size [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc:29:34: error: reference to 'size' is ambiguous 29 | size[u]+=size[v]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:14: note: 'int size [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc: In function 'int main()': a.cc:46:14: error: reference to 'size' is ambiguous 46 | sum1=size[b];sum2=n-sum1; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:14: note: 'int size [400005]' 4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp; | ^~~~ a.cc: In function 'int read()': a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type] 14 | } | ^
s229028783
p03662
C++
#include<iostream> #include<vector> using namespace std; int d[100001][2],visit[100001]={}; vector<vector<int>> v(100001); int dfs(int p,int a){ visit[p]=1; for(int i=0;i<v[p].size();i++) if(visit[v[p][i]]==0){ d[v[p][i]][a]=d[p][a]+1; dfs(v[p][i],a); } } int main(){ int n,a,b,cnt=0; cin>>n; for(int i=0;i<n;i++){ cin >> a >>b; v[a].push_back(b); v[b].push_back(a); } dfs(1,0); d[1][0]=0; for(int i=1;i<=n;i++) visit[i]=0; d[n][1]=0; dfs(n,1); for(int i=1;i<=n;i++){ if(d[i][0]>d[i][1]) cnt++; else if(d[i][0]<d[i][1]) cnt--; } if(cnt=>0) cout << "Snuke" <<endl; else cout << "Fennec" <<endl; }
a.cc: In function 'int dfs(int, int)': a.cc:16:1: warning: no return statement in function returning non-void [-Wreturn-type] 16 | } | ^ a.cc: In function 'int main()': a.cc:38:10: error: expected primary-expression before '>' token 38 | if(cnt=>0) | ^
s412008134
p03662
C
#include<iostream> #include<vector> using namespace std; int d[100001][2],visit[100001]={}; vector<vector<int>> v(100001); int dfs(int p,int a){ visit[p]=1; for(int i=0;i<v[p].size();i++) if(visit[v[p][i]]==0){ d[v[p][i]][a]=d[p][a]+1; dfs(v[p][i],a); } } int main(){ int n,a,b,cnt=0; cin>>n; for(int i=0;i<n;i++){ cin >> a >>b; v[a].push_back(b); v[b].push_back(a); } dfs(1,0); d[1][0]=0; for(int i=1;i<=n;i++) visit[i]=0; d[n][1]=0; dfs(n,1); for(int i=1;i<=n;i++){ if(d[i][0]>d[i][1]) cnt++; else if(d[i][0]<d[i][1]) cnt--; } if(cnt>0) cout << "Snuke" <<endl; else cout << "Fennec" <<endl; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s495271921
p03662
C++
#include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <functional> #include <cctype> #include <list> //#include <boost/multiprecision/cpp_int.hpp> #define BIT(a) (1 << (a)) #define EPS (1e-10) using namespace std; //using namespace boost::multiprecision; const long long MOD = 1000000007; const int COUNTER_CLOCKWISE = 1; const int CLOCKWISE = -1; const int ONLINE_BACK = 2; const int ONLINE_FRONT = -2; const int ON_SEGMENT = 0; class DisjointSet{ public: vector<int> rank, p; DisjointSet(){} DisjointSet(int size){ rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) makeSet(i); } void makeSet(int x){ p[x] = x; rank[x] = 0; } bool same(int x, int y){ return findSet(x) == findSet(y); } void unite(int x, int y){ link(findSet(x), findSet(y)); } void link(int x, int y){ if (rank[x] > rank[y]){ p[y] = x; }else{ p[x] = y; if (rank[x] == rank[y]){ rank[y]++; } } } int findSet(int x){ if (x != p[x]){ p[x] = findSet(p[x]); } return p[x]; } }; class Point{ public: double x, y; Point(double x = 0, double y = 0): x(x), y(y) {} Point operator+(Point p){return Point(x + p.x, y + p.y);} Point operator-(Point p){return Point(x - p.x, y - p.y);} Point operator*(double a){return Point(a * x, a * y);} Point operator/(double a){return Point(x / a, y / a);} bool operator < (const Point &p) const { return y != p.y ? y < p.y : x < p.x; } double norm(){return x * x + y * y;} }; typedef Point Vector; typedef vector<Vector> Polygon; double cross(Vector a, Vector b){ return a.x*b.y - a.y*b.x; } double dot(Vector a, Vector b){ return a.x * b.x + a.y * b.y; } int ccw(Point p0, Point p1, Point p2){ Vector a = p1 - p0; Vector b = p2 - p0; if (cross(a, b) > EPS)return COUNTER_CLOCKWISE; if (cross(a, b) > -EPS)return CLOCKWISE; if (dot(a, b) < -EPS)return ONLINE_BACK; if (a.norm() < b.norm())return ONLINE_FRONT; return ON_SEGMENT; } Polygon andrewScan(Polygon s){ Polygon u, l; if (s.size() < 3) return s; sort(s.begin(), s.end()); u.push_back(s[0]); u.push_back(s[1]); l.push_back(s[s.size()-1]); l.push_back(s[s.size()-2]); for (size_t i = 2; i < s.size(); i++){ for (size_t n = u.size(); n >= 2 && ccw(u[n-2], u[n-1], s[i]) == COUNTER_CLOCKWISE; n--){ u.pop_back(); } u.push_back(s[i]); } for (int i = (int)s.size() - 3; i >= 0; i--){ for (size_t n = l.size(); n >= 2 && ccw(l[n-2], l[n-1], s[i]) == COUNTER_CLOCKWISE; n--){ l.pop_back(); } l.push_back(s[i]); } reverse(l.begin(), l.end()); for (size_t i = u.size() - 2; i >= 1; i--) l.push_back(u[i]); return l; } long long mod_pow(long long x, long long n){ long long res = 1; for(int i = 0;i < 60; i++){ if(n >> i & 1) res = res * x % MOD; x = x * x % MOD; } return res; } int N; vector<vector<int> > edge(100005); int v[100005]; int dfs(int crt, int color){ if (v[crt] == 0) v[crt] = color; else if (v[crt] == 1) = 3; for (auto itr = edge[crt].begin(); itr != edge[crt].end(); itr++){ if (*itr != N && *itr != 1 && v[*itr] != color && v[*itr] == 1){ dfs(*itr, color); } } return 0; } int main(void){ cin >> N; for (int i = 0; i < N-1; i++){ int a, b; cin >> a >> b; edge[a].push_back(b); edge[b].push_back(a); } dfs(1, 1); dfs(N, 2); int Fen = 0; int Snu = 0; int borderland = 0; for (int i = 1; i <= N; i++){ if (v[i] == 1){ Fen++; }else if (v[i] == 2){ Snu++; }else if (v[i] == 3){ borderland++; } } Fen += (borderland + (2 - 1)) /2 ; Snu += borderland/2; if (Fen > Snu) cout << "Fennec" << endl; else cout << "Snuke" << endl; return 0; }
a.cc: In function 'int dfs(int, int)': a.cc:160:27: error: expected primary-expression before '=' token 160 | else if (v[crt] == 1) = 3; | ^
s109814233
p03662
C++
#include <iostream> #include <queue> #include <map> #include <list> #include <vector> #include <string> #include <stack> #include <limits> #include <climits> #include <cassert> #include <fstream> #include <cstring> #include <cmath> #include <bitset> #include <iomanip> #include <algorithm> #include <functional> #include <cstdio> #include <ciso646> #include <set> #include <array> #include <unordered_map> #include <unordered_set> #include <type_traits> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define inf 0x3f3f3f3f3f3f3f3f #define PB push_back #define MP make_pair #define ALL(a) (a).begin(),(a).end() #define SET(a,c) memset(a,c,sizeof a) #define CLR(a) memset(a,0,sizeof a) #define VS vector<string> #define VI vector<ll> #define DEBUG(x) cout<<#x<<": "<<x<<endl #define MIN(a,b) (a>b?b:a) #define MAX(a,b) (a>b?a:b) #define pi 2*acos(0.0) #define INFILE() freopen("in0.txt","r",stdin) #define OUTFILE()freopen("out0.txt","w",stdout) #define ll long long #define ull unsigned long long #define pii pair<ll,ll> #define pcc pair<char,char> #define pic pair<ll,char> #define pci pair<char,ll> #define eps 1e-14 #define FST first #define SEC second #define SETUP cin.tie(0), ios::sync_with_stdio(false), cout << setprecision(15) << std::fixed; namespace { struct input_returnner { ll N; input_returnner(ll N_ = 0) :N(N_) {} template<typename T> operator vector<T>() const { vector<T> res(N); for (auto &a : res) cin >> a; return std::move(res); } template<typename T> operator T() const { T res; cin >> res; return res; } template<typename T> T operator - (T right) { return T(input_returnner()) - right; } template<typename T> T operator + (T right) { return T(input_returnner()) + right; } template<typename T> T operator * (T right) { return T(input_returnner()) * right; } template<typename T> T operator / (T right) { return T(input_returnner()) / right; } template<typename T> T operator << (T right) { return T(input_returnner()) << right; } template<typename T> T operator >> (T right) { return T(input_returnner()) >> right; } }; template<typename T> input_returnner in() { return in<T>(); } input_returnner in() { return input_returnner(); } input_returnner in(ll N) { return std::move(input_returnner(N)); } } template < typename T > struct is_vector : std::false_type {}; template < typename T > struct is_vector<std::vector<T>> : std::true_type {}; template < typename T > constexpr bool is_vector_v = is_vector<T>::value; template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) { if (!v.empty()) { for (int i = 0; i < v.size(); ++i) { out << v[i] << (i == v.size() - 1 ? "\n" : (is_vector_v<T> ? "" : ", ")); } } return out; } ll MOD = 1e9 + 7; class prime ; void solve(); signed main() { SETUP; solve(); #ifdef _DEBUG system("pause"); #endif return 0; } #define int ll vector<int> DFS(const vector<vector<int> >& G, vector<bool>& memo, int node, int goal) { memo[node] = true; if (node == goal) return { node }; for (auto &to : G[node]) { if (not memo[to]) { vector<int> temp = DFS(G, memo, to, goal); if (not temp.empty()) { temp.push_back(node); return temp; } } } return {}; } void solve() { int N; cin >> N; vector<vector<int> > G(N); for (int i = 0; i < N-1; ++i) { int a, b; cin >> a >> b; --a; --b; G[a].push_back(b); G[b].push_back(a); } vector<bool> memo(N); vector<int> path = DFS(G, memo, 0, N - 1); std::reverse(ALL(path)); int center = path.size() / 2 + min(path.size()%2, 1u); vector<bool> isFirst(N); memo = vector<bool>(N); queue<int> que; for (int i = 0; i < path.size(); ++i) { isFirst[path[i]] = (i < center); memo[path[i]] = true; que.push(path[i]); } while (not que.empty()) { int cur = que.front(); que.pop(); for (auto &to : G[cur]) if(not memo[to]){ if (not memo[to]) { isFirst[to] = isFirst[cur]; que.push(to); memo[to] = true; } } } int cnt = 0; for (int i = 0; i < N; ++i) { if (isFirst[i]) cnt++; } if (cnt > N/2) { cout << "Fennec" << endl; } else{ cout << "Snuke" << endl; } }
a.cc: In function 'void solve()': a.cc:141:43: error: no matching function for call to 'min(std::vector<long long int>::size_type, unsigned int)' 141 | int center = path.size() / 2 + min(path.size()%2, 1u); | ~~~^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:141:43: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 141 | int center = path.size() / 2 + min(path.size()%2, 1u); | ~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:16: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:141:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 141 | int center = path.size() / 2 + min(path.size()%2, 1u); | ~~~^~~~~~~~~~~~~~~~~~~
s844481215
p03662
C++
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define maxch(x,y) x=max(x,y) #define minch(x,y) x=min(x,y) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define maxch(x,y) x=max(x,y) #define minch(x,y) x=min(x,y) #define uni(x) x.erase(unique(all(x)),x.end()) template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;} #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) > (b) ? (b) : (a)) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> PPI; #define INF INT_MAX/3 #define MAX_N 1000 vector<int> g[maxn]; int d1[maxn], d2[maxn]; void dfs(int p, int last, int d, int wd[]) { wd[p] = d; for (int x : g[p]) { if (x != last) { dfs(x, p, d+1, wd); } } } void solve(){ cin.tie(0); ios::sync_with_stdio(false); cin>>n; rep(i,n) cin>>g[i].clear(); rep(i,n-1){ ll x,y; cin>>x>>y; g[x].pb(y); g[y].pb(x); } dfs(0,-1,0,d1); dfs(n-1,-1,0,d2); ll ret = 0; rep(i,n){ if (d1[i] <= d2[i]) { ++ret; } else { --ret; } } puts(ret>0?"Fennec":"Snuke"); } int main(){ solve(); return 0; }
a.cc:29:15: error: 'maxn' was not declared in this scope 29 | vector<int> g[maxn]; | ^~~~ a.cc:30:8: error: 'maxn' was not declared in this scope 30 | int d1[maxn], d2[maxn]; | ^~~~ a.cc:30:18: error: 'maxn' was not declared in this scope 30 | int d1[maxn], d2[maxn]; | ^~~~ a.cc: In function 'void dfs(int, int, int, int*)': a.cc:34:17: error: 'g' was not declared in this scope 34 | for (int x : g[p]) { | ^ a.cc: In function 'void solve()': a.cc:44:8: error: 'n' was not declared in this scope; did you mean 'yn'? 44 | cin>>n; | ^ | yn a.cc:46:17: error: 'g' was not declared in this scope 46 | rep(i,n) cin>>g[i].clear(); | ^ a.cc:51:5: error: 'g' was not declared in this scope 51 | g[x].pb(y); | ^ a.cc:55:14: error: 'd1' was not declared in this scope; did you mean 'y1'? 55 | dfs(0,-1,0,d1); | ^~ | y1 a.cc:56:16: error: 'd2' was not declared in this scope 56 | dfs(n-1,-1,0,d2); | ^~
s628776021
p03662
C++
#include<stdio.h> #include<math.h> #include<algorithm> #include<utility> #include<queue> #include<stack> #include<string.h> #include<string> using namespace std; typedef long long LL; #define _CRT_SECURE_NO_WARNINGS int N; vector<int> l[100010]; template<class T> class Node { public: Node() :parent(0), child(0) {}; Node* parent; vector child; T para; }; Node<int> nodes[100010]; int mL; void Set(int n,int m) { if (n==N) { mL = m; } for (int i = 0; i < l[n].size();i++) { if (nodes[n].parent!=&nodes[l[n][i]]) { nodes[n].child.push_back(&nodes[l[n][i]]); nodes[l[n][i]].parent = &nodes[n]; Set(l[n][i], m + 1); } } } int c = 1; void CountChilds(Node* n) { if (n->child.size()!=0) { for (int i = 0; i < n->child.size();i++) { c++; CountChilds(n->child[i]); } } }; int main() { scanf("%d",&N); for (int i = 0; i < N-1; i++) { int a, b; scanf("%d %d",&a,&b); l[a].push_back(b); l[b].push_back(a); } Set(1, 0); Node<int>* a = &nodes[N]; for (int i = 0; i < (mL-1) / 2;i++) { a = a->parent; } CountChilds(a); if (c>=N-c) { printf("Snuke\n"); } else { printf("Fennec\n"); } return 0; }
a.cc:21:9: error: invalid use of template-name 'std::vector' without an argument list 21 | vector child; | ^~~~~~ a.cc: In function 'void Set(int, int)': a.cc:32:34: error: 'class Node<int>' has no member named 'child' 32 | nodes[n].child.push_back(&nodes[l[n][i]]); | ^~~~~ a.cc: At global scope: a.cc:39:18: error: missing template argument list after 'Node'; template placeholder not permitted in parameter 39 | void CountChilds(Node* n) { | ^~~~ | <> a.cc:15:26: note: 'template<class T> class Node' declared here 15 | template<class T> class Node { | ^~~~ a.cc: In function 'void CountChilds(...)': a.cc:40:13: error: 'n' was not declared in this scope 40 | if (n->child.size()!=0) { | ^ a.cc: In instantiation of 'Node<T>::Node() [with T = int]': a.cc:24:23: required from here 24 | Node<int> nodes[100010]; | ^ a.cc:18:36: error: using invalid field 'Node<T>::child' 18 | :parent(0), child(0) | ^
s279333787
p03662
C++
#include<stdio.h> #include<math.h> #include<algorithm> #include<utility> #include<queue> #include<stack> #include<string.h> #include<string> using namespace std; typedef long long LL; #define _CRT_SECURE_NO_WARNINGS int N; vector l[100010]; template class Node { public: Node() :parent(0), child(0) {}; Node* parent; vector child; T para; }; Node nodes[100010]; int mL; void Set(int n,int m) { if (n==N) { mL = m; } for (int i = 0; i < l[n].size();i++) { if (nodes[n].parent!=&nodes[l[n][i]]) { nodes[n].child.push_back(&nodes[l[n][i]]); nodes[l[n][i]].parent = &nodes[n]; Set(l[n][i], m + 1); } } } int c = 1; void CountChilds(Node* n) { if (n->child.size()!=0) { for (int i = 0; i < n->child.size();i++) { c++; CountChilds(n->child[i]); } } }; int main() { scanf("%d",&N); for (int i = 0; i < N-1; i++) { int a, b; scanf("%d %d",&a,&b); l[a].push_back(b); l[b].push_back(a); } Set(1, 0); Node* a = &nodes[N]; for (int i = 0; i < (mL-1) / 2;i++) { a = a->parent; } CountChilds(a); if (c>=N-c) { printf("Snuke\n"); } else { printf("Fennec\n"); } return 0; }
a.cc:14:1: error: missing template argument list after 'std::vector'; for deduction, template placeholder must be followed by a simple declarator-id 14 | vector l[100010]; | ^~~~~~ | <> In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/queue:63, from a.cc:5: /usr/include/c++/14/bits/stl_vector.h:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ a.cc:17:14: error: definition provided for explicit instantiation 17 | Node() | ^ a.cc:21:9: error: invalid use of template-name 'std::vector' without an argument list 21 | vector child; | ^~~~~~ a.cc:22:9: error: 'T' does not name a type 22 | T para; | ^ a.cc:23:2: error: explicit instantiation of non-template type 'Node' 23 | }; | ^ a.cc: In function 'void Set(int, int)': a.cc:30:29: error: 'l' was not declared in this scope 30 | for (int i = 0; i < l[n].size();i++) { | ^ a.cc: In function 'int main()': a.cc:52:17: error: 'l' was not declared in this scope 52 | l[a].push_back(b); | ^
s491637348
p03662
C++
#include #include #include #include #include #include #include #include using namespace std; typedef long long LL; #define _CRT_SECURE_NO_WARNINGS int N; vector l[100010]; template class Node { public: Node() :parent(0), child(0) {}; Node* parent; vector child; T para; }; Node nodes[100010]; int main() { scanf("%d",&N); for (int i = 0; i < N-1; i++) { int a, b; scanf("%d %d",&a,&b); l[a].push_back(b); l[b].push_back(a); } nodes[1].para = 0; stack s; s.push(1); while (!s.empty()) { int n = s.top(); s.pop(); for (int i = 0; i < l[n].size();i++) { if (nodes[n].parent != &nodes[l[n][i]]) { nodes[n].child.push_back(&nodes[l[n][i]]); nodes[l[n][i]].parent = &nodes[n]; nodes[l[n][i]].para = nodes[n].para+1; s.push(l[n][i]); } } } Node* a = &nodes[N]; for (int i = 0; i < (nodes[N].para - 1) / 2;i++) { a = a->parent; } int c = 1; stack*> ss; ss.push(a); while (!ss.empty()) { Node* n = ss.top(); ss.pop(); if (n->child.size() != 0) { for (int i = 0; i < n->child.size(); i++) { c++; ss.push(n->child[i]); } } } if (c>=N-c) { printf("Snuke\n"); } else { printf("Fennec\n"); } return 0; }
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME> 1 | #include | ^ a.cc:2:9: error: #include expects "FILENAME" or <FILENAME> 2 | #include | ^ a.cc:3:9: error: #include expects "FILENAME" or <FILENAME> 3 | #include | ^ a.cc:4:9: error: #include expects "FILENAME" or <FILENAME> 4 | #include | ^ a.cc:5:9: error: #include expects "FILENAME" or <FILENAME> 5 | #include | ^ a.cc:6:9: error: #include expects "FILENAME" or <FILENAME> 6 | #include | ^ a.cc:7:9: error: #include expects "FILENAME" or <FILENAME> 7 | #include | ^ a.cc:8:9: error: #include expects "FILENAME" or <FILENAME> 8 | #include | ^ a.cc:14:1: error: 'vector' does not name a type 14 | vector l[100010]; | ^~~~~~ a.cc:17:14: error: definition provided for explicit instantiation 17 | Node() | ^ a.cc:21:9: error: 'vector' does not name a type 21 | vector child; | ^~~~~~ a.cc:22:9: error: 'T' does not name a type 22 | T para; | ^ a.cc: In constructor 'Node::Node()': a.cc:18:29: error: class 'Node' does not have any field named 'child' 18 | :parent(0), child(0) | ^~~~~ a.cc: At global scope: a.cc:23:2: error: explicit instantiation of non-template type 'Node' 23 | }; | ^ a.cc: In function 'int main()': a.cc:26:9: error: 'scanf' was not declared in this scope 26 | scanf("%d",&N); | ^~~~~ a.cc:30:17: error: 'l' was not declared in this scope 30 | l[a].push_back(b); | ^ a.cc:34:18: error: 'class Node' has no member named 'para' 34 | nodes[1].para = 0; | ^~~~ a.cc:35:9: error: 'stack' was not declared in this scope 35 | stack s; s.push(1); | ^~~~~ a.cc:1:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>' +++ |+#include <stack> 1 | #include a.cc:35:18: error: 's' was not declared in this scope 35 | stack s; s.push(1); | ^ a.cc:39:37: error: 'l' was not declared in this scope 39 | for (int i = 0; i < l[n].size();i++) { | ^ a.cc:41:42: error: 'class Node' has no member named 'child' 41 | nodes[n].child.push_back(&nodes[l[n][i]]); | ^~~~~ a.cc:43:64: error: 'class Node' has no member named 'para' 43 | nodes[l[n][i]].para = nodes[n].para+1; | ^~~~ a.cc:50:39: error: 'class Node' has no member named 'para' 50 | for (int i = 0; i < (nodes[N].para - 1) / 2;i++) { | ^~~~ a.cc:54:15: error: expected primary-expression before '>' token 54 | stack*> ss; ss.push(a); | ^ a.cc:54:17: error: 'ss' was not declared in this scope 54 | stack*> ss; ss.push(a); | ^~ a.cc:57:24: error: 'class Node' has no member named 'child' 57 | if (n->child.size() != 0) { | ^~~~~ a.cc:58:48: error: 'class Node' has no member named 'child' 58 | for (int i = 0; i < n->child.size(); i++) { | ^~~~~ a.cc:60:44: error: 'class Node' has no member named 'child' 60 | ss.push(n->child[i]); | ^~~~~ a.cc:66:17: error: 'printf' was not declared in this scope 66 | printf("Snuke\n"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #include a.cc:69:17: error: 'printf' was not declared in this scope 69 | printf("Fennec\n"); | ^~~~~~ a.cc:69:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s958428397
p03662
C++
/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/ #include <bits/stdc++.h> using namespace std; const int mx=1e5+5; vector <int> tree[mx]; int cnt,level[mx],dist[mx]; bool vis[mx]; void bfs1 () { memset(vis,0,sizeof(vis)); queue<int> myQ; myQ.push(1); level[1]=0; vis[1]=true; int m; while (!myQ.empty()) { int u=myQ.front(); myQ.pop(); m=tree[u].size(); for (int i=0;i<m;i++) { int v=tree[u][i]; if (vis[v]) continue; vis[v]=true; level[v]=1+level[u]; myQ.push(v); } } } void bfs2(int n) { memset(vis,0,sizeof(vis)); queue<int> myQ; myQ.push(n); dist[n]=0; vis[n]=true; int m; while (!myQ.empty()) { int u=myQ.front(); if (dist[u]<level[u]) cnt++; myQ.pop(); m=tree[u].size(); for (int i=0;i<m;i++) { int v=tree[u][i]; if (vis[v]) continue; vis[v]=true; dist[v]=1+dist[u]; myQ.push(v); } } } int main () { int i,n,a,b; scanf ("%d",&n); for (i=1;i<n;i++) { scanf ("%d %d",&a,&b); tree[a].push_back(b); tree[b].push_back(a); } bfs1(); bfs2(n); int m=n-cnt; if (m>cnt) printf ("Fennec\n"); else printf("Snuke\n"); return 0;
a.cc: In function 'int main()': a.cc:69:14: error: expected '}' at end of input 69 | return 0; | ^ a.cc:54:1: note: to match this '{' 54 | { | ^
s799685860
p03662
C++
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stack> #include<queue> #include<vector> #include<algorithm> #include<string> #include<iostream> using namespace std; #define N 100005 int n; int map[N][N]; vector<int>v; void dps(){ stack<int>s; int check[N]; for(int i=1;i<=n;i++)check[i]=0; s.push(1); v.push_back(1); check[1]=1; while(s.top()!=n){ int i=1; bool flag=true; while(i<=n&&flag==true){ if(check[i]==0&&map[s.top()][i]==1){ s.push(i); check[i]=1; v.push_back(i); flag=false; } i++; } if(flag==true){ s.pop(); v.pop_back(); } } } int count(int t){ int ans=0; stack <int>s; bool already[n];for(int i=1;i<=n;i++)already[i]=true; s.push(t); ans++; already[t]=false; while(!s.empty()){ int top=s.top(); bool flag=true; for(int i=1;i<=n;i++){ if(already[i]==true && map[i][top]==1){ s.push(i); already[i]=false; ans++; flag=false; } } if(flag==true)s.pop(); } return ans; } int main() { cin>>n; for(int q=1;q<=n-1;q++){ int a,b;cin>>a>>b; map[a][b]=map[b][a]=1; } dps(); int pass=v.size(); int flast=(pass-1)/2; map[v[flast]][v[flast+1]]=0;map[v[flast+1]][v[flast]]=0; if(count(1)>count(n))printf("Fennec"); else printf("Snuke"); return 0; }
/tmp/ccE075y1.o: in function `dps()': a.cc:(.text+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x12c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x180): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o /tmp/ccE075y1.o: in function `main': a.cc:(.text+0x4b5): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x4e1): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x4fd): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x53e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x557): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o /tmp/ccE075y1.o: in function `__static_initialization_and_destruction_0()': a.cc:(.text+0x5e8): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o a.cc:(.text+0x601): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccE075y1.o collect2: error: ld returned 1 exit status
s518621015
p03662
C++
#include <iostream> #include <vector> #include <cstring> constexpr int MAX_N=(int)1e5; int n; std::vector<int> G[MAX_N]; bool path[MAX_N]; bool used[MAX_N]; void search(int s,int t){ used[s]=true; if(s==t){ std::memcpy(path,used,sizeof(used)) return; } for(int i=0;i<G[s].size();++i){ int to=G[s][i]; if(!path[to]) search(to,t); } used[s]=false; } void _dfs(int m); int dfs(int m){ std::memcpy(used,path,sizeof(path)); _dfs(m); int cnt=0; for(int i=0;i<n;++i){ if(!path[i]&&used[i]) ++cnt; } return cnt; } void _dfs(int m) { used[m]=true; for(int i=0;i<G[m].size();++i){ int to=G[m][i]; if(!used[to]) _dfs(to); } } int main() { std::cin>>n; int a,b; for(int i=0;i<n-1;++i){ std::cin>>a>>b; G[a-1].emplace_back(b-1); G[b-1].emplace_back(a-1); } search(0,n-1); int fst=dfs(0),snd=dfs(n-1); int res=0; for(int i=0;i<n;++i){ if(path[i]) ++res; } fst+=(res+1)/2; snd+=res-(res+1)/2; if(fst>snd) std::cout<<"Fennec"<<std::endl; else std::cout<<"Snuke"<<std::endl; return 0; }
a.cc: In function 'void search(int, int)': a.cc:20:42: error: expected ';' before 'return' 20 | std::memcpy(path,used,sizeof(used)) | ^ | ; 21 | return; | ~~~~~~
s775835738
p03662
C++
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> using namespace std; const int MAXN=1e5+10; int num1[MAXN],num2[MAXN]; int T,n; int head[MAXN],next[2*MAXN],u[2*MAXN],v[2*MAXN],tot; int read() { int f=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { f=(f<<3)+(f<<1)+ch-'0'; ch=getchar(); } return f*w; } void add(int l,int r) { u[++tot]=l; v[tot]=r; next[tot]=head[l]; head[l]=tot; } int vt[MAXN]; void dfs(int now,int step,int flag) { vt[now]=1; if(flag==1) num1[now]=step; if(flag==2) num2[now]=step; for(int i=head[now];i;i=next[i]) if(vt[v[i]]==0) dfs(v[i],step+1,flag); } int main() { //freopen("T3.in","r",stdin); //freopen("T3.out","w",stdout); T=1; while(T--) { n=read(); tot=0; memset(head,0,sizeof(head)); memset(next,0,sizeof(next)); memset(u,0,sizeof(u)); memset(v,0,sizeof(v)); memset(num1,0,sizeof(num1)); memset(num2,0,sizeof(num2)); for(int i=1;i<n;i++) { int l=read(),r=read(); add(l,r); add(r,l); } memset(vt,0,sizeof(vt)); dfs(1,0,1); memset(vt,0,sizeof(vt)); dfs(n,0,2); int p1=0,p2=0; for(int i=1;i<=n;i++) { if(num1[i]<num2[i]) p1++; if(num2[i]<num1[i]) p2++; if(num1[i]==num2[i]) p1++; } if(p1>p2) printf("Fennec\n"); else printf("Snuke\n"); } }
a.cc: In function 'void add(int, int)': a.cc:19:31: error: reference to 'next' is ambiguous 19 | u[++tot]=l; v[tot]=r; next[tot]=head[l]; head[l]=tot; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:16: note: 'int next [200020]' 9 | int head[MAXN],next[2*MAXN],u[2*MAXN],v[2*MAXN],tot; | ^~~~ a.cc: In function 'void dfs(int, int, int)': a.cc:27:33: error: reference to 'next' is ambiguous 27 | for(int i=head[now];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:16: note: 'int next [200020]' 9 | int head[MAXN],next[2*MAXN],u[2*MAXN],v[2*MAXN],tot; | ^~~~ a.cc: In function 'int main()': a.cc:40:24: error: reference to 'next' is ambiguous 40 | memset(next,0,sizeof(next)); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:16: note: 'int next [200020]' 9 | int head[MAXN],next[2*MAXN],u[2*MAXN],v[2*MAXN],tot; | ^~~~ a.cc:40:38: error: reference to 'next' is ambiguous 40 | memset(next,0,sizeof(next)); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:16: note: 'int next [200020]' 9 | int head[MAXN],next[2*MAXN],u[2*MAXN],v[2*MAXN],tot; | ^~~~
s977011542
p03662
C++
#include <cstdio> #include <iostream> #include <vector> #define N 100000 using namespace std; int e[N+1][N+1] = {}; vector<int> p; bool used[N+1]; int dfs_goal(int s, int g, int n){ for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { if (i==g) { p.push_back(i); return(i); } used[i] = true; int result = dfs_goal(i, g, n); if (result > 0) { p.push_back(i); return(i); } } } return(0); } int dfs_count(int s, int n){ int c = 0; for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { c++; used[i] = true; // cout << "i:" << i << endl; int result = dfs_count(i, n); // cout << "result:" << result << endl; c += result; } } return(c); } int main(){ int n; cin >> n; for (int i=0;i<n-1;i++) { int a, b; cin >> a >> b; e[a][b] = 1; e[b][a] = 1; } for (int i=0;i<=n;i++)used[i] = false; used[1] = true; dfs_goal(1, n, n); p.push_back(1); /* for (auto it=p.begin();it!=p.end();it++) cout << *it << " "; cout << endl;*/ int m = p.size()/2; e[p[m]][p[m-1]] = 0; e[p[m-1]][p[m]] = 0; for (int i=0;i<=n;i++)used[i] = false; int fenec = dfs_count(1, n); for (int i=0;i<=n;i++)used[i] = false; int snuke = dfs_count(n, n); if (fenec > snuke) cout << "Fennec" << endl; else cout << "Snuke" << endl; return(0); }
/tmp/ccvs9Zv0.o: in function `dfs_goal(int, int, int)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvs9Zv0.o /tmp/ccvs9Zv0.o: in function `dfs_count(int, int)': a.cc:(.text+0x10f): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o /tmp/ccvs9Zv0.o: in function `main': a.cc:(.text+0x254): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x292): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x2a1): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvs9Zv0.o a.cc:(.text+0x2be): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s446485782
p03662
C++
#include <cstdio> #include <iostream> #include <vector> #define N 100000 using namespace std; int n; int e[N+1][N+1] = {}; vector<int> p; bool used[N+1]; int dfs_goal(int s, int g, int n){ for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { if (i==g) { p.push_back(i); return(i); } used[i] = true; int result = dfs_goal(i, g, n); if (result > 0) { p.push_back(i); return(i); } } } return(0); } int dfs_count(int s, int n){ int c = 0; for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { c++; used[i] = true; // cout << "i:" << i << endl; int result = dfs_count(i, n); // cout << "result:" << result << endl; c += result; } } return(c); } int main(){ cin >> n; for (int i=0;i<n-1;i++) { int a, b; cin >> a >> b; e[a][b] = 1; e[b][a] = 1; } for (int i=0;i<=n;i++)used[i] = false; used[1] = true; dfs_goal(1, n, n); p.push_back(1); /* for (auto it=p.begin();it!=p.end();it++) cout << *it << " "; cout << endl;*/ int m = p.size()/2; e[p[m]][p[m-1]] = 0; e[p[m-1]][p[m]] = 0; for (int i=0;i<=n;i++)used[i] = false; int fenec = dfs_count(1, n); for (int i=0;i<=n;i++)used[i] = false; int snuke = dfs_count(n, n); if (fenec > snuke) cout << "Fennec" << endl; else cout << "Snuke" << endl; return(0); }
/tmp/ccT7VclH.o: in function `dfs_goal(int, int, int)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccT7VclH.o /tmp/ccT7VclH.o: in function `dfs_count(int, int)': a.cc:(.text+0x10f): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o /tmp/ccT7VclH.o: in function `main': a.cc:(.text+0x25a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x273): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x2a1): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x2b0): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccT7VclH.o a.cc:(.text+0x2cd): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s563009110
p03662
C++
#include <cstdio> #include <iostream> #include <vector> #define N 100000 using namespace std; int n; int e[N+1][N+1] = {}; vector<int> p; bool used[N+1]; int dfs_goal(int s, int g){ for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { if (i==g) { p.push_back(i); return(i); } used[i] = true; int result = dfs_goal(i, g); if (result > 0) { p.push_back(i); return(i); } } } return(0); } int dfs_count(int s){ int c = 0; for (int i=1;i<=n;i++) { if (!used[i] && e[s][i] == 1) { c++; used[i] = true; // cout << "i:" << i << endl; int result = dfs_count(i); // cout << "result:" << result << endl; c += result; } } return(c); } int main(){ cin >> n; for (int i=0;i<n-1;i++) { int a, b; cin >> a >> b; e[a][b] = 1; e[b][a] = 1; } for (int i=0;i<=n;i++)used[i] = false; used[1] = true; dfs_goal(1, n); p.push_back(1); /* for (auto it=p.begin();it!=p.end();it++) cout << *it << " "; cout << endl;*/ int m = p.size()/2; e[p[m]][p[m-1]] = 0; e[p[m-1]][p[m]] = 0; for (int i=0;i<=n;i++)used[i] = false; int fenec = dfs_count(1); for (int i=0;i<=n;i++)used[i] = false; int snuke = dfs_count(n); if (fenec > snuke) cout << "Fennec" << endl; else cout << "Snuke" << endl; return(0); }
/tmp/ccdtBgG9.o: in function `dfs_goal(int, int)': a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x73): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x8c): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccdtBgG9.o /tmp/ccdtBgG9.o: in function `dfs_count(int)': a.cc:(.text+0x10b): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x152): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o /tmp/ccdtBgG9.o: in function `main': a.cc:(.text+0x254): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x26d): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x2a4): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccdtBgG9.o a.cc:(.text+0x2c1): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s537830575
p03662
C++
#include <assert.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <numeric> #include <functional> #include <iostream> #include <string> #include <array> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <complex> #include <bitset> typedef long long ll; typedef unsigned long long ull; using namespace std; # define INF 0x3f3f3f3f template <typename T> struct Edge { int src, dst; T weight; Edge(int src, int dst, T weight) : src(src), dst(dst), weight(weight) { } }; template <typename T> bool operator < (const Edge<T> &e, const Edge<T> &f) { return e.weight != f.weight ? e.weight > f.weight : e.src != f.src ? e.src < f.src : e.dst < f.dst; } template <typename T> struct Graph { int V; // 頂点数 vector<Edge<T>> *adj; explicit Graph(int V) { this->V = V; adj = new vector<Edge<T>> [V]; } void add_edge(int src, int dst, T weight) { assert(src >= 0 && src < V); assert(dst >= 0 && dst < V); adj[src].push_back(Edge<T>(src, dst, weight)); } vector<T> shortest_path(int s); // vector<vector<T>> shortest_paths(); // Graph<T> spanning_tree(); }; template <typename T> vector<T> Graph<T>::shortest_path(int src) { vector<T> dist(V, INF); dist[src] = 0; for (int i = 0; i < V; i++) { bool updated = false for (int u = 0; u < V; u++) { for (const auto& e : adj[u]) { if (dist[u] != INF && dist[e.dst] > dist[u] + e.weight) { dist[e.dst] = dist[u] + e.weight; updated = true; if (i == V - 1) { dist = vector<T>(V, -INF); return dist; } } } } if (!updated) break; } return dist; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; Graph<int> g(N); for (int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; g.add_edge(a - 1, b - 1, 1); g.add_edge(b - 1, a - 1, 1); } vector<int> dist1 = g.shortest_path(0); vector<int> dist2 = g.shortest_path(N - 1); int cnt1 = 0; int cnt2 = 0; for (int i = 0; i < N; i++) { if (dist1[i] <= dist2[i]) { cnt1++; } else { cnt2++; } } if (cnt1 > cnt2) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } return 0; }
a.cc: In member function 'std::vector<_Tp> Graph<T>::shortest_path(int)': a.cc:65:5: error: expected ',' or ';' before 'for' 65 | for (int u = 0; u < V; u++) { | ^~~ a.cc:65:21: error: 'u' was not declared in this scope 65 | for (int u = 0; u < V; u++) { | ^
s494872925
p03662
C++
#include<iostream> #include<vector> using namespace std; int x[100010], y[100010]; vector<int> adjacent[100010]; void DFSx(int a) { for (int b : adjacent[a]) { if (x[b] == -1) { x[b] = x[a] + 1; DFSx(b); } } } void DFSy(int a) { for (int b : adjacent[a]) { if (y[b] == -1) { y[b] = y[a] + 1; DFSy(b); } } } int main() { memset(x, -1, sizeof(x)); memset(y, -1, sizeof(y)); int n; cin >> n; int i; for (i = 0; i < n-1; i++) { int a, b; cin >> a >> b; a--; b--; adjacent[a].push_back(b); adjacent[b].push_back(a); } x[0] = 0; y[n-1] = 0; DFSx(0); DFSy(n-1); int X = 0, Y = 0; for (i = 0; i < n; i++) { if (x[i] <= y[i]) { X++; } else { Y++; } } if (X <= Y) { cout << "Snuke" << endl; } else { cout << "Fennec" << endl; } }
a.cc: In function 'int main()': a.cc:25:3: error: 'memset' was not declared in this scope 25 | memset(x, -1, sizeof(x)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<vector> +++ |+#include <cstring> 3 |
s373833591
p03662
C++
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <map> using namespace std; int n, a, b; int fenv, snuv, pathv; vector<int> g[100005]; bool used[100005]; // fennec void bfs() { queue<pair<int, int> > que; pair<int, int> tmp; que.push(make_pair(0, 0)); while (!que.empty()) { tmp = que.front(); que.pop(); bool flag = false; int size_ = g[tmp.first].size(); if (tmp.first == n - 1) { pathv = tmp.second - 1; continue; } for (int i = 0; i < size_; ++i) { if (!used[g[tmp.first][i]]) { que.push(make_pair(g[tmp.first][i], tmp.second + 1)); flag = true; used[g[tmp.first][i]] = true; } } if (!flag) { fenv += tmp.second; } } } // snuke void bfs2() { queue<pair<int, int> > que; pair<int, int> tmp; que.push(make_pair(n - 1, 0)); while (!que.empty()) { tmp = que.front(); que.pop(); bool flag = false: int size_ = g[tmp.first].size(); for (int i = 0; i < size_; ++i) { if (!used[g[tmp.first][i]]) { que.push(make_pair(g[tmp.first][i], tmp.second + 1)); used[g[tmp.first][i]] = true; flag = true; } } if (!flag) { snuv += tmp.second; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n-1; ++i) { cin >> a >> b; a--; b--; g[a].push_back(b); g[b].push_back(a); } bfs(); bfs2(); int fv, sv; fv = sv = 0; if (pathv % 2) { fv = pathv / 2 + 1; sv = pathv / 2; } else { fv = sv = pathv / 2; } fv += fenv; sv += snuv; if (fv > sv) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } return 0; }
a.cc: In function 'void bfs2()': a.cc:56:26: error: expected ',' or ';' before ':' token 56 | bool flag = false: | ^ a.cc:60:29: error: 'size_' was not declared in this scope; did you mean 'size_t'? 60 | for (int i = 0; i < size_; ++i) { | ^~~~~ | size_t
s805574308
p03662
C++
#include<iostream> #include<queue> #include<vector> using namespace std; const int INF=INT_MAX/2; vector<int> bfs(int N,vector<vector<int> >& G,int s){ vector<int> d(N,INF); queue<int>q; q.push(s); while(q.size()){ int u=q.front(); q.pop(); for(int v=0;v<G[u].size();v++) if(d[G[u][v]]>d[u]+1){ d[G[u][v]]=d[u]+1; q.push(G[u][v]); } } return d; } int main() { int N; cin>>N; vector<vector<int> > G(N); for(int i=0;i<N-1;i++){ int u,v; cin>>u>>v; u--; v--; G[u].push_back(v); G[v].push_back(u); } vector<int> d1=bfs(N,G,0); vector<int> d2=bfs(N,G,N-1); int n1=0,n2=0; for(int u=0;u<N;u++)if(d1[u]<=d2[u])n1++; else n2++; cout<<(n1>n2?"Fennec":"Snuke")<<endl; return 0; }
a.cc:5:15: error: 'INT_MAX' was not declared in this scope 5 | const int INF=INT_MAX/2; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<queue> +++ |+#include <climits> 3 | #include<vector>
s110810162
p03662
C++
#include<iostream> #include<queue> #include<vector> using namespace std; const int INF=INT_MAX/2; vector<int> bfs(int N,vector<vector<int> >& G,int s){ vector<int> d(N,INT_MAX/2); queue<int>q; q.push(s); while(q.size()){ int u=q.front(); q.pop(); for(int v=0;v<G[u].size();v++) if(d[G[u][v]]>d[u]+1){ d[G[u][v]]=d[u]+1; q.push(G[u][v]); } } return d; } int main() { int N; cin>>N; vector<vector<int> > G(N); for(int i=0;i<N-1;i++){ int u,v; cin>>u>>v; u--; v--; G[u].push_back(v); G[v].push_back(u); } vector<int> d1=bfs(N,G,0); vector<int> d2=bfs(N,G,N-1); int n1=0,n2=0; for(int u=0;u<N;u++)if(d1[u]<=d2[u])n1++; else n2++; cout<<(n1>n2?"Fennec":"Snuke")<<endl; return 0; }
a.cc:5:15: error: 'INT_MAX' was not declared in this scope 5 | const int INF=INT_MAX/2; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<queue> +++ |+#include <climits> 3 | #include<vector> a.cc: In function 'std::vector<int> bfs(int, std::vector<std::vector<int> >&, int)': a.cc:7:25: error: 'INT_MAX' was not declared in this scope 7 | vector<int> d(N,INT_MAX/2); | ^~~~~~~ a.cc:7:25: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s185068864
p03662
C++
#include<iostream> #include<cctype> #include<queue> #include<cstdio> #include<cmath> #include<sstream> #include<string> #include<algorithm> #include<cstring> #include<vector> #include<ctime> #include<cstdlib> #include<map> #include<utility> #include<iomanip> #include<set> using namespace std; typedef long long ll; const int maxn=1<<18; int n; vector<int> e[maxn]; int cnt[maxn]; vector<int> vec; int first; void dfs(int v,int pr) { cnt[v]=1; vec.push_back(v); if(v==n-1) first=vec[((int)vec.size()+1)/2]; for(int k : e[v]) { if(k==pr) continue; dfs(k,v); cnt+=cnt[k]; } vec.pop_back(); } int main() { while(cin>>n) { for(int i=0;i<n;i++) e[i].clear(); } for(int i=0;i<n;i++) { int a,b; cin>>a>>b; e[a].push_back(b); e[b].push_back(a); } first=-1; dfs(0,0); bool win=cnt[first]*2<n; string ans=win?"Fennec":"Snuke"; cout<<ans<<endl; return 0; }
a.cc: In function 'void dfs(int, int)': a.cc:35:20: error: incompatible types in assignment of 'int' to 'int [262144]' 35 | cnt+=cnt[k]; | ~~~^~~~~~~~
s952384700
p03662
C++
#include<iostream> #include<cctype> #include<queue> #include<cstdio> #include<cmath> #include<sstream> #include<string> #include<algorithm> #include<cstring> #include<vector> #include<ctime> #include<cstdlib> #include<map> #include<utility> #include<iomanip> #include<set> using namespace std; typedef long long ll; const int maxn=1<<18; int n; vector<int> e[maxn]; int cnt[maxn]; vector<int> vec; int first; void dfs(int v,int pr) { cnt[v]=1; vec.push_back(v); if(v==n-1) first=vec[((int)vec.size()+1)/2]; for(int to : e[v]) { if(to==pr) continue; dfs(to,v); cnt+=cnt[to]; } vec.pop_back(); } int main() { while(cin>>n) { for(int i=0;i<n;i++) e[i].clear(); } for(int i=0;i<n;i++) { int a,b; cin>>a>>b; e[a].push_back(b); e[b].push_back(a); } first=-1; dfs(0,0); bool win=cnt[first]*2<n; string ans=win?"Fennec":"Snuke"; cout<<ans<<endl; return 0; }
a.cc: In function 'void dfs(int, int)': a.cc:35:20: error: incompatible types in assignment of 'int' to 'int [262144]' 35 | cnt+=cnt[to]; | ~~~^~~~~~~~~
s959126581
p03662
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <error.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <limits> #include <map> #include <iomanip> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> using namespace std; int n; vector<int> neigh[100005]; int cnt[100005],L[100005],P[100005]; inline int dfs(int v) { cnt[v]=1; for(int i=0;i<neigh[v].size();i++) { int u=neigh[v][i]; if(P[v]==u)continue; L[u]=L[v]+1; P[u]=v; dfs(u); cnt[u]+=cnt[v]; } } int main() { cin>>n; for(int i=0;i<n-1;i++) { int a,b; cin>>a>>b; neigh[a].push_back(b); neigh[b].push_back(a); } int up=(L[n]-1)/2; int v=n; while(up--)v=P[v]; if(cnt[v]>=n-cnt[v])cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl; return 0; }
a.cc:56:10: fatal error: conio.h: No such file or directory 56 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s664280265
p03662
C++
#include<iostream> #include<cctype> #include<queue> #include<cstdio> #include<cmath> #include<sstream> #include<string> #include<algorithm> #include<cstring> #include<vector> #include<ctime> #include<cstdlib> #include<map> #include<utility> #include<iomanip> #include<set> using namespace std; typedef long long ll; const int INF=INT_MAX/2; vector<int> bfs(int n,vector<vector<int> >&G,int s) { vector<int> d(n,INF); d[s]=0; queue<int> q; q.push(s); while(q.size()) { int u=q.front(); q.pop(); for(int v:G[u]) if(d[v]>d[u]+1) { d[v]=d[u]+1; q.push(v); } } return d; } int main() { int n; cin>>n; vector<vector<int> >G(n); for(int i=0;i<n-1;i++) { int a,b; cin>>a>>b; a--; b--; G[a].push_back(b); G[b].push_back(a); } vector<int> d1=bfs(n,G,0); vector<int> d2=bfs(n,G,n-1); int n1=0,n2=0; for(int u=0;u<n;u++) if(d1[u]<=d2[u]) n1++; else n2++; cout<<(n1>n2?"Fennec":"Snuke")<<endl; return 0; }
a.cc:19:15: error: 'INT_MAX' was not declared in this scope 19 | const int INF=INT_MAX/2; | ^~~~~~~ a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 16 | #include<set> +++ |+#include <climits> 17 | using namespace std;
s362470943
p03662
C++
#include<iostream> #include<cctype> #include<queue> #include<cstdio> #include<cmath> #include<sstream> #include<string> #include<algorithm> #include<cstring> #include<vector> #include<ctime> #include<cstdlib> #include<map> #include<utility> #include<iomanip> #include<set> using namespace std; typedef long long ll; const int INF=INT_MAX/2; vector<int> bfs(int n,vector<vector<int> >&G,int s) { vector<int> d(n,INF); d[s]=0; queue<int> q; q.push(s); while(q.size()) { int u=q.front(); q.pop(); for(int v:G[u]) if(d[v]>d[u]+1) { d[v]=d[u]+1; q.push(v); } } return d; } int main() { int n;i cin>>n; vector<vector<int> >G(n); for(itn i=0;i<n-1;i++) { int a,b; cin>>a>>b; a--; b--; G[a].push_back(b); G[b].push_back(a); } vector<int> d1=bfs(n,G,0); vector<int> d2=bfs(n,G,n-1); int n1=0,n2=0; for(int u=0;u<n;u++) if(d1[u]<=d2[u]) n1++; else n2++; else n2++; cout<<(n1>n2?"Fennec":"Snuke")<<endl; return 0; }
a.cc:19:15: error: 'INT_MAX' was not declared in this scope 19 | const int INF=INT_MAX/2; | ^~~~~~~ a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 16 | #include<set> +++ |+#include <climits> 17 | using namespace std; a.cc: In function 'int main()': a.cc:41:15: error: 'i' was not declared in this scope 41 | int n;i | ^ a.cc:44:13: error: 'itn' was not declared in this scope; did you mean 'int'? 44 | for(itn i=0;i<n-1;i++) | ^~~ | int a.cc:60:9: error: 'else' without a previous 'if' 60 | else n2++; | ^~~~
s798195252
p03662
C++
//code by 27. #include<stdio.h> #include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<math.h> #include<vector> #include<queue> #include<map> #include<stack> #include<fstream> #include<stdlib.h> #include<set> #include<cassert> #include<climits> #include<cmath> #include<memory.h> #include<conio.h> #include<windows.h> #include<ctime> using namespace std; vector<int>vt[10001]; int f[10001]; queue<int>que; int n; int main() { int g1=0,g2=0; cin>>n; int x,y; for(int i=1;i<n;i++) { scanf("%d%d",&x,&y); vt[x].push_back(y); vt[y].push_back(x); } que.push(1); g1++; g2++; que.push(n); f[1]=1; f[n]=-1; while(!que.empty()) { if(f[que.front()]>0) { for(int i=0;i<vt[que.front()].size();i++) { if(f[vt[que.front()][i]]==0) { f[vt[que.front()][i]]=f[que.front()]+1; que.push(vt[que.front()][i]); g1++; } } } if(f[que.front()]<0) { for(int i=0;i<vt[que.front()].size();i++) { if(f[vt[que.front()][i]]==0) { f[vt[que.front()][i]]=f[que.front()]-1; que.push(vt[que.front()][i]); g2++; } } } que.pop(); } if(g1>g2)cout<<"Fennec"; else cout<<"Snuke"; return 0; }
a.cc:19:9: fatal error: conio.h: No such file or directory 19 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s564423387
p03662
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <error.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <limits> #include <map> #include <iomanip> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> using namespace std; int n; vector<int> road[10005]; int main() { cin>>n; for(int i=0;i<n-1;i++) { int a,b; cin>>a>>b; a--; b--; road[a].push_back(b); road[b].push_back(a); } if(n%2==1) { cout<<"Fennec"<<endl; } else { cout<<"Snuke"<<endl; } return 0; }
a.cc:56:10: fatal error: conio.h: No such file or directory 56 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s354771052
p03662
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<vector> using namespace std; typedef long long LL; const int MAXN=1e5+5; int n; vector<int> g[MAXN*2]; int d1[MAXN],d2[MAXN]; void dfs(int rt,int fa,int d,int dist[]) { dist[rt]=d; for(int x:g[rt]) { if(x!=fa) dfs(x,rt,d+1,dist); } } int main() { ios::sync_with_stdio(false); while(cin>>n) { for(int i=0;i<n;i++) g[i].clear(); int u,v; for(int i=0;i<n-1;i++) { cin>>u>>v; u--;v--; g[u].push_back(v); g[v].push_back(u); } dfs(0,-1,0,d1); dfs(n-1,-1,0,d2); int ans=0; for(int i=0;i<n;i++) { if(d1[i]<=d2[i]) ++ans; else --ans; } if(ans>0) cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; } return 0;
a.cc: In function 'int main()': a.cc:50:14: error: expected '}' at end of input 50 | return 0; | ^ a.cc:23:1: note: to match this '{' 23 | { | ^
s943003669
p03662
C++
/************************************ Name: 荆国浩 E-mail: 1839714778@qq.com ************************************/ #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <string> #include <string.h> #include <fstream> #define rep(N) for(int i=0;i<N;i++) #define ll long long #define pii pair<int,int> #define For(I,N) for(int I=0;I<N;I++) using namespace std; int n; int dist[10005][10005]; vector <int> vec[10005]; void bfs(int x) { bool visit[n]={0}; queue <pair<int,int> >que; que.push(make_pair<int,int>(x,0)); while(!que.empty()) { int nx=que.front().first; int ns=que.front().second; que.pop(); rep(vec[nx].size()) { if(visit[vec[nx][i]]) continue; visit[vec[nx][i]]=true; dist[x][vec[nx][i]]=ns+1; que.push(make_pair<int,int>(vec[nx][i],ns+1)); } } } int main() { // freopen("input.txt","r",stdin); cin>>n; int x,y; rep(n-1) { cin>>x>>y; vec[--x].push_back(--y); vec[y].push_back(x); } bfs(0); dist[0][0]=0; bfs(n-1); dist[n-1][n-1]=0; int fen=0,snu=0; rep(n) { if(dist[0][i]<=dist[n-1][i]) fen++;else snu++; } cout<<(snu>fen?"Snuke":"Fennec")<<endl; return 0; }
a.cc: In function 'void bfs(int)': a.cc:26:37: error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int' 26 | que.push(make_pair<int,int>(x,0)); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:5: /usr/include/c++/14/bits/stl_pair.h:1132:21: note: initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = int; typename decay<_Tp>::type = int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]' 1132 | make_pair(_T1&& __x, _T2&& __y) | ~~~~~~^~~ a.cc:37:52: error: cannot bind rvalue reference of type 'int&&' to lvalue of type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 37 | que.push(make_pair<int,int>(vec[nx][i],ns+1)); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1132:21: note: initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = int; typename decay<_Tp>::type = int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]' 1132 | make_pair(_T1&& __x, _T2&& __y) | ~~~~~~^~~
s440923925
p03662
C++
#include <iostream> #include <vector> #include <algorithm> #include <cstdio> using namespace std; #define B 1 #define W 2 int N; vector<int> G[100001]; int Order[100001]; int Order2[100001]; int prev[100001]; int color[100001]; int cnt=0; void dfs(int v,int p,int *order){ order[v]=order[p]+1; prev[v]=p; for(int i=0;i<G[v].size();i++){ int u=G[v][i]; if(u==p)continue; dfs(u,v,order); } } void paint(int v,int p,int c){ color[v]=c; for(int i=0;i<G[v].size();i++){ int u=G[v][i]; if(u==p || (color[u]!=c && color[u]!=0))continue; paint(u,v,c); } } int main(){ cin >> N; for(int i=0;i<N-1;i++){ int s,t; cin >> s >> t; s;t; G[s].push_back(t); G[t].push_back(s); } for(int i=0;i<=N;i++){ Order[i]=-1; Order2[i]=-1; } dfs(1,0,Order); dfs(N,0,Order2); vector<int> path; int t=1; while(1){ if(t==0)break; path.push_back(t); t=prev[t]; } for(int i=0;i<path.size();i++){ int v=path[i]; if(Order[v]<=Order2[v])color[v]=B; else color[v]=W; } paint(1,0,B); paint(N,0,W); for(int i=1;i<=N;i++){ if(color[i]==B)cnt++; } for(int i=1;i<=N;i++)printf("%d ",color[i]); if(cnt>N-cnt)printf("Fennec\n"); else printf("Snuke\n"); return 0; }
a.cc: In function 'void dfs(int, int, int*)': a.cc:17:3: error: reference to 'prev' is ambiguous 17 | prev[v]=p; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100001]' 12 | int prev[100001]; | ^~~~ a.cc: In function 'int main()': a.cc:55:7: error: reference to 'prev' is ambiguous 55 | t=prev[t]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100001]' 12 | int prev[100001]; | ^~~~
s592832232
p03662
C++
4 1 4 4 2 2 3
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 | ^
s121358545
p03662
C++
#include<bits/stdc++.h> #define int long long int #define rep(a,b,c) for(int a=b;a<c;a++) #define repm(a,b,c) for(int a=(b-1);a>=c;a--) #define pb push_back #define str string #define sf(a) scanfs("%d",&a) #define pb push_back #define mp make_pair #define Fi first #define Se second #define ALL(v) (v).begin(), (v).end() #define clean(used) memset(used,false,sizeof(used)) using namespace std; const int INF = 1e18 + 9; const int Mod = 1e9 + 7; inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;} inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;} typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vii; vi edge[100005]; int u[100005] = {0}; int N; const str tmp = "atcoder"; signed main() { cin.tie(0); ios::sync_with_stdio(false); int a,b; cin >> N; rep(i,0,N){ cin >> a >> b; edge[a].pb(b); edge[b].pb(a); } bool even = true; queue<int> que[2],que_[2]; u[0] = 1; u[N-1] = 2; que[even].push(0); que[even].push(N-1); while(!que[even].empty() || !que_[even].empty()){ if(!que[even].empty()){ for(int i : que[even]){ for(int j : edge[i]){ if(!u[j]){ u[j] = 1; que[!even].push(j); } } } } if(!que_[even].empty()){ for(int i : que_[even]){ for(int j : edge[i]){ if(!u[j]){ u[j] = 2; que[!even].push(j); } } } } even = !even; } int f = 0,s = 0; rep(i,0,n){ if(u[i] == 1)f++; if(u[i] == 2)s++; } if(f > s){ cout << "Fennec" << endl; }else{ cout << "Snuke" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:52:33: error: no matching function for call to 'begin(std::queue<long long int>&)' 52 | for(int i : que[even]){ | ^ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/14/initializer_list:88:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'std::initializer_list<_Tp>' 52 | for(int i : que[even]){ | ^ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:52:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::queue<long long int>]': a.cc:52:33: required from here 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/bits/range_access.h:52:50: error: 'class std::queue<long long int>' has no member named 'begin' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ~~~~~~~^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::queue<long long int>]': a.cc:52:33: required from here 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/bits/range_access.h:63:56: error: 'const class std::queue<long long int>' has no member named 'begin' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ~~~~~~~^~~~~ /usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 95 | begin(_Tp (&__arr)[_Nm]) noexcept | ^~~~~ /usr/include/c++/14/bits/range_access.h:95:5: note: template argument deduction/substitution failed: a.cc:52:33: note: mismatched types '_Tp [_Nm]' and 'std::queue<long long int>' 52 | for(int i : que[even]){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)' 1227 | begin(valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1227:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'std::valarray<_Tp>' 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1238:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'const std::valarray<_Tp>' 52 | for(int i : que[even]){ | ^ a.cc:52:33: error: no matching function for call to 'end(std::queue<long long int>&)' /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'std::initializer_list<_Tp>' 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = std::queue<long long int>]': a.cc:52:33: required from here 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/bits/range_access.h:74:48: error: 'class std::queue<long long int>' has no member named 'end' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = std::queue<long long int>]': a.cc:52:33: required from here 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/bits/range_access.h:85:54: error: 'const class std::queue<long long int>' has no member named 'end' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: template argument deduction/substitution failed: a.cc:52:33: note: mismatched types '_Tp [_Nm]' and 'std::queue<long long int>' 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'std::valarray<_Tp>' 52 | for(int i : que[even]){ | ^ /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: template argument deduction/substitution failed: a.cc:52:33: note: 'std::queue<long long int>' is not derived from 'const std::valarray<_Tp>' 52 | for(int i : que[even]){ | ^ a.cc:63:34: error: no matching function for call to 'begin(std::queue<long long int>&)' 63 | for(int i : que_[even]){ | ^ /usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/14/initializer_list:88:5: note: template argument deduction/substitution failed: a.cc:63:34: note: 'std::queue<long long int>' is not derived from 'std::initializer_list<_Tp>' 63 | for(int i : que_[even]){ | ^ /usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:52:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::queue<long long int>]': a.cc:63:34: required from here 63 | for(int i : que_[even]){ | ^ /usr/include/c++/14/bits/range_access.h:52:50: error: 'class std::queue<long long int>' has no member named 'begin' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ~~~~~~~^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr declt
s098837762
p03662
C++
int v = n - 1; while (true) { path.push_back(v); v = parent[v]; if (v == 0) break; } path.push_back(v); reverse(path); int length = path.size() - 1; return path[length / 2 + 1]; } int main() { int i; cin >> n; for (i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; et[a].push_back(b); et[b].push_back(a); } dfs(0, -1, 0); // for (i = 0; i < n - 1; i++) { // cout << i << ": " << dist[i]; // cout << ", parent" << ": " << parent[i] << endl; // } int v = getCut(); // int v = getCut(); int len = dist[v]; int get_node_num = 0; for (i = 0; i < n - 1; i++) { if(dist[i] < len) ++get_node_num; } if (get_node_num < n - get_node_num) { cout << "Snuke" << endl; } else { cout << "Fennec" << endl; } return 0; }
a.cc:1:17: error: 'n' was not declared in this scope 1 | int v = n - 1; | ^ a.cc:3:9: error: expected unqualified-id before 'while' 3 | while (true) { | ^~~~~ a.cc:8:9: error: 'path' does not name a type 8 | path.push_back(v); | ^~~~ a.cc:10:16: error: expected constructor, destructor, or type conversion before '(' token 10 | reverse(path); | ^ a.cc:12:22: error: 'path' was not declared in this scope 12 | int length = path.size() - 1; | ^~~~ a.cc:13:9: error: expected unqualified-id before 'return' 13 | return path[length / 2 + 1]; | ^~~~~~ a.cc:14:1: error: expected declaration before '}' token 14 | } | ^ a.cc: In function 'int main()': a.cc:19:9: error: 'cin' was not declared in this scope 19 | cin >> n; | ^~~ a.cc:19:16: error: 'n' was not declared in this scope 19 | cin >> n; | ^ a.cc:25:17: error: 'et' was not declared in this scope 25 | et[a].push_back(b); | ^~ a.cc:28:9: error: 'dfs' was not declared in this scope 28 | dfs(0, -1, 0); | ^~~ a.cc:33:17: error: 'getCut' was not declared in this scope 33 | int v = getCut(); | ^~~~~~ a.cc:35:15: error: 'dist' was not declared in this scope 35 | int len = dist[v]; | ^~~~ a.cc:43:48: error: 'cout' was not declared in this scope 43 | if (get_node_num < n - get_node_num) { cout << "Snuke" << endl; } | ^~~~ a.cc:43:67: error: 'endl' was not declared in this scope 43 | if (get_node_num < n - get_node_num) { cout << "Snuke" << endl; } | ^~~~ a.cc:44:16: error: 'cout' was not declared in this scope 44 | else { cout << "Fennec" << endl; } | ^~~~ a.cc:44:36: error: 'endl' was not declared in this scope 44 | else { cout << "Fennec" << endl; } | ^~~~
s979873411
p03662
C++
#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<string> #include<sstream> #include<windows.h> #include<algorithm> #include<list> #include<ctime> #include<set> #include<map> #include<cmath> using namespace std; #define R freopen("666input.txt","r",stdin); #define W freopen("666output.txt","w",stdout); #define N 100005 int i,t,a,b,dis[N],dis2[N],vis[N],cnt,cnt2; queue <int> q; vector<int> v[N]; int main() { cin>>n; for(i=1;i<n;i++) { scanf("%d%d",&a,&b); v[a].push_back(b); v[b].push_back(a); } q.push(1); vis[1]=1; while(!q.empty()) { int cur=q.front(); q.pop(); int sz=v[cur].size(); for(i=0;i<sz;i++) { if(!vis[v[cur][i]]) { vis[v[cur][i]]=1; q.push(v[cur][i]); dis[v[cur][i]]=dis[cur]+1; } } } memset(vis,0,sizeof(vis)); q.push(n); vis[n]=1; while(!q.empty()) { int cur=q.front(); q.pop(); int sz=v[cur].size(); for(i=0;i<sz;i++) { if(!vis[v[cur][i]]) { vis[v[cur][i]]=1; q.push(v[cur][i]); dis2[v[cur][i]]=dis2[cur]+1; } } } for(i=1;i<=n;i++) if(dis[i]<=dis2[i])cnt++; else cnt2++; if(cnt>cnt2)cout<<"Fennec"; else cout<<"Snuke"; return 0; }
a.cc:6:9: fatal error: windows.h: No such file or directory 6 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s440814088
p03662
C++
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #include<vector> using namespace std; typedef long long ll; typedef pair<int,int>i_i; //const int MOD=1e9+7; const int INF=INT_MAX/2; int n1=0,n2=0; int N; vector<int> G[1000000+5]; int vis[100005]; //vector<int> bfs(int N,vector<vector<int>>&G,int s){ vector<int> bfs(int N,int s){ vector<int> d(N,INF); d[s]=0; queue<int> q; q.push(s); while(q.size()){ int u=q.front(); q.pop(); /*for(int v: G[u]){ if(d[v]>d[u]+1){ d[v]=d[u]+1; q.push(v); } }*/ for(int i=0;i<(int)G[u].size();i++){ //printf("u=%d\n",u); int v=G[u][i]; if(d[v]>d[u]+1){ d[v]=d[u]+1; q.push(v); } } } return d; } int main(){ //int i; //cin>>N; scanf("%d",&N); //vector<vector<int>> G(N); for(int i=0;i<N-1;i++){ int u,v; scanf("%d %d",&u,&v); u--,v--; G[u].push_back(v),G[v].push_back(u); } //vector<int> d1=bfs(N,G,0); //vector<int> d2=bfs(N,G,N-1); vector<int> d1=bfs(N,0); vector<int> d2=bfs(N,N-1); //printf("N=%d\n",N); for(int u=0;u<N;u++){ //printf("d1[%d]=%d\n",u,d1[u]); //printf("d2[%d]=%d\n",u,d2[u]); if(d1[u]<=d2[u]) n1++; else n2++; } //printf("n1=%d\n",n1); //printf("n2=%d\n",n2); if(n1<n2) printf("Snuke\n"); else printf("Fennec\n"); return 0; } /*input1: 7 3 6 1 2 3 1 7 4 5 7 1 4 output1: Fennec */ /*inout2: 4 1 4 4 2 2 3 output2: Snuke */
a.cc:14:15: error: 'INT_MAX' was not declared in this scope 14 | const int INF=INT_MAX/2; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include<queue> +++ |+#include <climits> 7 | #include<vector>
s488265242
p03662
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<vector<int>> g(n); for(int i=0; i<n-1; ++i) { int a, b; cin>>a>>b; --a, --b; g[a].push_back(b); g[b].push_back(a); } vector<int> x(n); queue<int> q; q.push(0); x[0]=1; q.push(n-1); x[n-1]=-1; while (q.size()) { int v=q.front(); q.pop(); int k=x[v]; for(int u: g[v]) if (!x[u]) { x[u]=k; q.push(u); } } int fennec=count(begin(x), end(x), 1); int snuke=n-fennec; cout<<(fennec>sunuke ? "Fennec" : "Snuke")<<endl; }
a.cc: In function 'int main()': a.cc:30:19: error: 'sunuke' was not declared in this scope; did you mean 'snuke'? 30 | cout<<(fennec>sunuke ? "Fennec" : "Snuke")<<endl; | ^~~~~~ | snuke
s481979525
p03662
C++
#if 1 #include <iostream> #include <fstream> #include <string> #include <vector> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <queue> #include <stack> #include <array> #include <deque> #include <algorithm> #include <utility> #include <cstdint> #include <functional> #include <iomanip> #include <numeric> #include <assert.h> #include <bitset> auto& in = std::cin; auto& out = std::cout; #include <queue> #include <vector> #include <functional> #include <utility> #include <algorithm> #include <iterator> using COST_T = uint32_t; constexpr uint32_t N_MAX = 100000; constexpr COST_T INF = 1000000000 + 1000;//std::numeric_limits<double>::infinity() #if defined(_MSC_VER) && defined(_DEBUG) //static_assert(false, "リリースでコンパイルしないと遅いよ!!"); #endif std::vector<int32_t> graph[N_MAX];//木 //ダイクストラ COST_T D1[N_MAX]; COST_T D2[N_MAX]; void Dijkstra(uint32_t s, COST_T(&D)[N_MAX]) { using P = std::pair<COST_T, uint32_t>;//cost pos std::priority_queue<P, std::vector<P>, std::greater<>> que; std::fill(std::begin(D), std::end(D), INF); D[s] = 0; que.emplace(0, s); while (!que.empty()) { auto p = que.top(); que.pop(); const auto& nowpos = p.second; const auto& nowcost = p.first; if (D[nowpos] < nowcost) { continue; } //for (int32_t to = 0; to < N; ++to) //{ // auto cost = nowcost + graph[nowpos][to]; // if (cost < D[to]) { // D[to] = cost; // que.emplace(D[to], to); // } //} for (const auto& e : graph[nowpos]) { auto cost = nowcost + e.cost; if (cost < D[e.to]) { D[e.to] = cost; que.emplace(cost, e.to); } } } } void input_tree() { in >> N; for (int32_t i = 0; i < N - 1; ++i) { int a, b; in >> a >> b; --a; --b; graph[a].push_back(b); graph[b].push_back(a); } } int32_t N; int main() { using std::endl; in.sync_with_stdio(false); out.sync_with_stdio(false); in.tie(nullptr); out.tie(nullptr); input_tree(); Dijkstra(0, D1); Dijkstra(N-1, D2); int32_t f = 0,s=0; for (int32_t i = 0; i < N; ++i) { if (D1[i] <= D2[i]) { ++f; } else { ++s; } } if (f > s) { out << "Fennec" << endl; } else { out << "Snuke" << endl; } return 0; } #endif
a.cc: In function 'void Dijkstra(uint32_t, COST_T (&)[100000])': a.cc:76:49: error: request for member 'cost' in 'e', which is of non-class type 'const int' 76 | auto cost = nowcost + e.cost; | ^~~~ a.cc:77:40: error: request for member 'to' in 'e', which is of non-class type 'const int' 77 | if (cost < D[e.to]) { | ^~ a.cc:78:37: error: request for member 'to' in 'e', which is of non-class type 'const int' 78 | D[e.to] = cost; | ^~ a.cc:79:53: error: request for member 'to' in 'e', which is of non-class type 'const int' 79 | que.emplace(cost, e.to); | ^~ a.cc: In function 'void input_tree()': a.cc:87:15: error: 'N' was not declared in this scope 87 | in >> N; | ^
s174483584
p03662
C++
#include <iostream> #include <algorithm> #include <math.h> #include <string> #include <cstdio> #include <vector> #include <set> #include <cassert> #include <cstdlib> #include <complex> #include <cctype> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <map> #include <set> #include <sstream> #include <functional> #include <windows.h> using namespace std; /**==Info== *Program:3 *Problem:Fennec VS. Snuke *Date:2017-7-16 *Algorithm:BFS*/ int df[100005]; int ds[100005]; pair<int,int> roads[100005]; queue<int> q; vector<int> nei[100005]; int main(){ int n; cin>>n; for(int i=0;i<n-1;i++){ int a,b; cin>>a>>b; a--;b--; roads[i]=(a>b?make_pair(b,a):make_pair(a,b)); nei[a].push_back(b); nei[b].push_back(a); } // for(int i=0;i<n;i++){ // for(int j=0;j<nei[i].size();j++){ // cout<<nei[i][j]<<" "; // } // cout<<endl; // } //First BFS q.push(0); df[0]=1; while(!q.empty()){ int last=q.front(); q.pop(); //cout<<last<<" "<<nei[last].size(); for(int i=0;i<nei[last].size();i++){ if(df[nei[last][i]]==0){ df[nei[last][i]]=df[last]+1; q.push(nei[last][i]); } } } // for(int i=0;i<n;i++){ // cout<<df[i]<<" "; // } //Second BFS q.push(n-1); ds[n-1]=1; while(!q.empty()){ int last=q.front(); q.pop(); for(int i=0;i<nei[last].size();i++){ if(ds[nei[last][i]]==0){ ds[nei[last][i]]=ds[last]+1; q.push(nei[last][i]); } } } // // for(int i=0;i<n;i++){ // cout<<df[i]<<" "; // } // cout<<endl; // for(int i=0;i<n;i++){ // cout<<ds[i]<<" "; // } cout<<endl; int fwin=0,swin=0; for(int i=0;i<n;i++){ if(df[i]<=ds[i])fwin++;else swin++; } cout<<(fwin>swin?"Fennec":"Snuke"); return 0; }
a.cc:21:10: fatal error: windows.h: No such file or directory 21 | #include <windows.h> | ^~~~~~~~~~~ compilation terminated.
s984302774
p03662
C++
#include <iostream> #include <cstdio> #include <vector> #include <cmath> using namespace std; const int maxn = int(1e5)+5; int sz[maxn], P[maxn]; vector<int> graph[maxn]; void dfs(int node, int par) { sz[node] = 1, P[node] = par; for(auto it: graph[node]) { if(it != par) { dfs(it, node); sz[node] += sz[it]; } } } int main(void) { int n, a, b; scanf("%d", &n); for(int i = 1;i < n;i++) { scanf("%d%d", &a, &b); a--, b--; graph[a].push_back(b), graph[b].push_back(a); } dfs(0, -1); int cur = n-1; vector<int> path; while(cur != -1) { path.push_back(cur); cur = P[cur]; } reverse(path.begin(), path.end()); int meet = path[ceil(int(path.size())/2.0)]; //cout << meet << "\n"; if(sz[meet] > n-sz[meet]) printf("Snuke\n"); else printf("Fennec\n"); }
a.cc: In function 'int main()': a.cc:46:9: error: 'reverse' was not declared in this scope 46 | reverse(path.begin(), path.end()); | ^~~~~~~
s121315015
p03662
C++
#include <bits/stdc++.h> using namespace std; typedef long long LL; vector<int> d[2]; vector<int> v[100000]; void dfs(int x, int y, int dist, int s) { d[s][x] = dist; for (int i = 0; i < v[x].size(); i++) { if (v[x][i] != y) { dfs(v[x][i], visit, dist + 1, s); } } } int main() { int n; cin >> n; d[0].resize(n); d[1].resize(n); int a, b; for (int i = 0; i < n - 1; i++) { cin >> a >> b; a--; b--; v[a].push_back(b); v[b].push_back(a); } dfs(0, -1, 0, 0); dfs(n - 1, -1, 0, 1); int f = 0, ss = 0; for (int i = 0; i < n; i++) { if (d[0][i] <= d[1][i]) { f++; } else { ss++; } } if (f > ss) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } return 0; }
a.cc: In function 'void dfs(int, int, int, int)': a.cc:14:16: error: cannot resolve overloaded function 'visit' based on conversion to type 'int' 14 | dfs(v[x][i], visit, dist + 1, s); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s453221663
p03662
C++
#include <iostream> #include <ccomplex> #include <vector> #include <cassert> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <list> #include <assert.h> #include <math.h> #include <valarray> #include <stdio.h> #include <algorithm> #include <set> #include <complex> #include <list> #include <time.h> #include <stack> #include <locale> #include <clocale> #include <ctype.h> #include <wchar.h> using namespace std; typedef long long int LL; typedef pair<long long int, long long int> pii; typedef pair<double, double> pdd; #define SORT(c) sort((c).begin(),(c).end()) #define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>()) #define FOR(i,a,b) for(LL i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int xcomp(vector<LL>& a, vector<LL>& b) { return a[0] < b[0]; } #define XSORT(c) sort((c).begin(),(c).end(),xcomp) #define ALL(x) (x).begin(),(x).end() LL mod = 1000000007; vector<vector<LL>> v(100001, vector<LL>(0)); LL N = 0; LL sum = 0; vector<bool> not(100001, false); void dfs2(vector<bool> &b, int index, vector<LL> path) { REP(i, v[index].size()) { if (b[v[index][i]] == false) { if (v[index][i] != N) { b[v[index][i]] = true; vector<LL> path2; copy(path.begin(), path.end(), back_inserter(path2)); path2.push_back(v[index][i]); dfs2(b, v[index][i], path2); } else { vector<LL> path2; copy(path.begin(), path.end(), back_inserter(path2)); path2.push_back(v[index][i]); REP(i, path2.size()) { if (i >= (path2.size()+1) / 2) { not[path2[i]] = true; } } } } } } void dfs(vector<bool> &b, int index, int l) { sum++; REP(i, v[index].size()) { if (b[v[index][i]] == false) { if (not[v[index][i]]==false) { b[v[index][i]] = true; dfs(b, v[index][i], l + 1); } } } } int main() { cin >> N; REP(i, N - 1) { LL a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } vector<bool> bo2(N + 1, false); vector<LL> p(1,1); bo2[1] = true; dfs2(bo2, 1, p); vector<bool> bo(N + 1, false); bo[1] = true; dfs(bo, 1, 0); if (N - sum < sum) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } }
a.cc:58:14: error: expected unqualified-id before 'not' token 58 | vector<bool> not(100001, false); | ^~~ a.cc: In function 'void dfs2(std::vector<bool>&, int, std::vector<long long int>)': a.cc:76:58: error: expected ',' before '[' token 76 | not[path2[i]] = true; | ^ | , a.cc:76:58: error: expected identifier before '[' token a.cc: In lambda function: a.cc:76:63: error: expected '{' before '=' token 76 | not[path2[i]] = true; | ^ a.cc: In function 'void dfs2(std::vector<bool>&, int, std::vector<long long int>)': a.cc:76:49: error: no match for 'operator!' (operand type is 'dfs2(std::vector<bool>&, int, std::vector<long long int>)::<lambda()>') 76 | not[path2[i]] = true; | ^~~~~~~~~~~~~ a.cc:76:49: note: candidate: 'operator!(bool)' (built-in) a.cc:76:49: note: no known conversion for argument 1 from 'dfs2(std::vector<bool>&, int, std::vector<long long int>)::<lambda()>' to 'bool' a.cc: In function 'void dfs(std::vector<bool>&, int, int)': a.cc:88:33: warning: capture of variable 'v' with non-automatic storage duration 88 | if (not[v[index][i]]==false) { | ^ a.cc:52:20: note: 'std::vector<std::vector<long long int> > v' declared here 52 | vector<vector<LL>> v(100001, vector<LL>(0)); | ^ a.cc:88:34: error: expected ',' before '[' token 88 | if (not[v[index][i]]==false) { | ^ | , a.cc:88:34: error: expected identifier before '[' token a.cc: In lambda function: a.cc:88:45: error: expected '{' before '==' token 88 | if (not[v[index][i]]==false) { | ^~
s640125584
p03662
C++
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define fast_cin() ios_base::sync_with_stdio(false); typedef long long ll; const int INF = 1e7; const int MAX_SIZE = 1e5 + 10; vector<int> graph[MAX_SIZE]; vector<bool> visited; vector<int> LIST; void bfs(int s, int n, vector<int> &d) { for(int i = 1; i<= n; i++) { visited[i] = false; d[i] = INF; } visited[s] = true; queue<int> q1; q1.push(s); d[s] = 0; while(!q1.empty()) { int u = q1.front(); q1.pop(); for(auto &v: graph[u]) { if(!visited[v]) { visited[v] = true; d[v] = d[u] + 1; q1.push(v); } } } } void dfs(int a, int n) { for() } int main() { int n; cin >> n; int x, y; for(int i = 1; i < n; i++) { cin >> x >> y; graph[x].pb(y); graph[y].pb(x); } vector<int> d1, dN; d1.resize(n + 1); dN.resize(n + 1); visited.resize(n + 1); bfs(1, n, d1); bfs(n, n, dN); int b = 0 , w = 0; for(int i = 1; i <= n; i++) { if(d1[i] <= dN[i]) b++; else if(d1[i] > dN[i]) w++; } // cout << ÷ if(w >= b) cout << "Snuke" << endl; else cout << "Fennec" << endl; return 0; }
a.cc: In function 'void dfs(int, int)': a.cc:54:13: error: expected primary-expression before ')' token 54 | for() | ^ a.cc:55:1: error: expected primary-expression before '}' token 55 | } | ^ a.cc:54:14: error: expected ';' before '}' token 54 | for() | ^ | ; 55 | } | ~ a.cc:55:1: error: expected primary-expression before '}' token 55 | } | ^ a.cc:54:14: error: expected ')' before '}' token 54 | for() | ~ ^ | ) 55 | } | ~ a.cc:55:1: error: expected primary-expression before '}' token 55 | } | ^
s640555026
p03662
C++
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; const ull mod = 1e9 + 7; #define REP(i,n) for(int i=0;i<(int)n;++i) typedef vector<int> Array; typedef vector<Array> Graph; int dist1[100005] = {}; int dist2[100005] = {}; Graph G(100005); int N; void dfs1(int now, int dist){ dist1[now] = dist; for(int i=0;i<G[now].size();i++){ if(dist1[G[now][i]]==-1){ dfs1(G[now][i], ++dist); } } } void dfs2(int now, int dist){ dist2[now] = dist; for(int i=0;i<G[now].size();i++){ if(dist2[G[now][i]]==-1){ dfs2(G[now][i], ++dist); } } } int main(){ cin >> N; int as[N]; int bs[N]; REP(i, N-1){ int a, b; cin >> a >> b; a--;b--; G[a].push_back(b); G[b].push_back(a); } dfs1(); dfs2(); int x=0; REP(i, N){ if(dist1[i]>=dist2[i]) x++; } cout << (x>N-x?"Fennec":"Snuke") << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:9: error: too few arguments to function 'void dfs1(int, int)' 47 | dfs1(); | ~~~~^~ a.cc:18:6: note: declared here 18 | void dfs1(int now, int dist){ | ^~~~ a.cc:48:9: error: too few arguments to function 'void dfs2(int, int)' 48 | dfs2(); | ~~~~^~ a.cc:27:6: note: declared here 27 | void dfs2(int now, int dist){ | ^~~~
s651973936
p03662
C++
#include <iostream> #include <vector> #include <cstring> constexpr int MAX_N = (int)1e5; int n; std::vector<int> G[MAX_N]; bool used[MAX_N]; bool Isroute[MAX_N]; std::vector<int> routes; int cnt, len; bool init(int m) { if (m == n - 1) { len = cnt; return true; } used[m] = true; ++cnt; for (auto e : G[m]) { if (!used[e] && init(e)) { Isroute[e] = true; return true; } } --cnt; used[m] = false; return false; } int dfs(int m) { used[m] = true; int res = 1; for (auto e : G[m]) { if (!used[e] && !Isroute[e]) res += dfs(e); } used[m] = false; return res; } int main() { std::cin >> n; int a, b; for (int i = 0; i < n - 1; ++i) { std::cin >> a >> b; G[a - 1].emplace_back(b - 1); G[b - 1].emplace_back(a - 1); } init(0); --len; Isroute[0] = true; Isroute[n - 1] = true; int f = 0, s = 0; int cnt = 0, m = 0; for (int i = 0; i < n; ++i) { if (Isroute[i]) routes.emplace_back(i); } while (len / 2 > cnt) { std::memset(used, false, sizeof(used)); f += dfs(m); m = routes[cnt++]; } cnt = 0, m = n - 1; std::reverse(routes.begin(), routes.end()); while (len / 2 > cnt) { std::memset(used, false, sizeof(used)); s += dfs(m); ++cnt; m = routes[cnt++]; } if (len % 2 == 1) { std::memset(used, false, sizeof(used)); f += dfs(m); } if (f > s) std::cout << "Fennec" << std::endl; else if (f == s) std::cout << "Snuke" << std::endl; else std::cout << "Snuke" << std::endl; system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:108:14: error: 'reverse' is not a member of 'std' 108 | std::reverse(routes.begin(), routes.end()); | ^~~~~~~
s493852654
p03662
C++
#include <iostream> #include <ccomplex> #include <vector> #include <cassert> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <list> #include <assert.h> #include <math.h> #include <valarray> #include <stdio.h> #include <algorithm> #include <set> #include <complex> #include <list> #include <time.h> #include <stack> #include <locale> #include <clocale> #include <ctype.h> #include <wchar.h> using namespace std; typedef long long int LL; typedef pair<long long int, long long int> pii; typedef pair<double, double> pdd; #define SORT(c) sort((c).begin(),(c).end()) #define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>()) #define FOR(i,a,b) for(LL i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int xcomp(vector<LL>& a, vector<LL>& b) { return a[0] < b[0]; } #define XSORT(c) sort((c).begin(),(c).end(),xcomp) #define ALL(x) (x).begin(),(x).end() LL mod = 1000000007; vector<vector<LL>> v(100001, vector<LL>(0)); LL N; LL sum = 2; void dfs(vector<bool> &b, int index,int l) { REP(i, v[index].size()) { if (b[v[index][i]] == false) { if (v[index][i] != N) { b[v[index][i]] = true; sum++; dfs(b, v[index][i],l+1); } else { sum -= l - (l / 2); } } } } int main() { cin >> N; REP(i, N-1) { LL a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } vector<bool> bo(N + 1, false); dfs(bo, 1,0); if (N - sum < sum) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } } #include <iostream> #include <ccomplex> #include <vector> #include <cassert> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <list> #include <assert.h> #include <math.h> #include <valarray> #include <stdio.h> #include <algorithm> #include <set> #include <complex> #include <list> #include <time.h> #include <stack> #include <locale> #include <clocale> #include <ctype.h> #include <wchar.h> using namespace std; typedef long long int LL; typedef pair<long long int, long long int> pii; typedef pair<double, double> pdd; #define SORT(c) sort((c).begin(),(c).end()) #define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>()) #define FOR(i,a,b) for(LL i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int xcomp(vector<LL>& a, vector<LL>& b) { return a[0] < b[0]; } #define XSORT(c) sort((c).begin(),(c).end(),xcomp) #define ALL(x) (x).begin(),(x).end() LL mod = 1000000007; vector<vector<LL>> v(100001, vector<LL>(0)); LL N; LL sum = 2; void dfs(vector<bool> &b, int index,int l) { REP(i, v[index].size()) { if (b[v[index][i]] == false) { if (v[index][i] != N) { b[v[index][i]] = true; sum++; dfs(b, v[index][i],l+1); } else { sum -= l - (l / 2); } } } } int main() { cin >> N; REP(i, N-1) { LL a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } vector<bool> bo(N + 1, false); dfs(bo, 1,0); if (N - sum < sum) { cout << "Fennec" << endl; } else { cout << "Snuke" << endl; } }
a.cc:134:5: error: redefinition of 'int xcomp(std::vector<long long int>&, std::vector<long long int>&)' 134 | int xcomp(vector<LL>& a, vector<LL>& b) { | ^~~~~ a.cc:42:5: note: 'int xcomp(std::vector<long long int>&, std::vector<long long int>&)' previously defined here 42 | int xcomp(vector<LL>& a, vector<LL>& b) { | ^~~~~ a.cc:141:4: error: redefinition of 'LL mod' 141 | LL mod = 1000000007; | ^~~ a.cc:49:4: note: 'LL mod' previously defined here 49 | LL mod = 1000000007; | ^~~ a.cc:144:20: error: redefinition of 'std::vector<std::vector<long long int> > v' 144 | vector<vector<LL>> v(100001, vector<LL>(0)); | ^ a.cc:52:20: note: 'std::vector<std::vector<long long int> > v' previously declared here 52 | vector<vector<LL>> v(100001, vector<LL>(0)); | ^ a.cc:146:4: error: redefinition of 'LL N' 146 | LL N; | ^ a.cc:54:4: note: 'LL N' previously declared here 54 | LL N; | ^ a.cc:148:4: error: redefinition of 'LL sum' 148 | LL sum = 2; | ^~~ a.cc:56:4: note: 'LL sum' previously defined here 56 | LL sum = 2; | ^~~ a.cc:150:6: error: redefinition of 'void dfs(std::vector<bool>&, int, int)' 150 | void dfs(vector<bool> &b, int index,int l) { | ^~~ a.cc:58:6: note: 'void dfs(std::vector<bool>&, int, int)' previously defined here 58 | void dfs(vector<bool> &b, int index,int l) { | ^~~ a.cc:165:5: error: redefinition of 'int main()' 165 | int main() { | ^~~~ a.cc:73:5: note: 'int main()' previously defined here 73 | int main() { | ^~~~
s053977169
p03662
C++
#include<iostream> #include<vector> #include<queue> #include<set> using namespace std; const int N = 1e5 + 10; typedef long long ll; int c[N]; int vis[N], id; int d[2][N]; vector<vector<int> > v; void dfs(int u, int cost) { d[id][u] = cost; vis[u] = id; for (int i = 0; i < v[u].size(); ++i) { int next = v[u][i]; if (vis[next] < id) dfs(next, cost + 1); } } int main() { memset(vis, -1, sizeof vis); int n; cin >> n; v.resize(n); for (int i = 0; i < n - 1; ++i) { int a, b; cin >> a >> b; --a; --b; v[a].push_back(b); v[b].push_back(a); } dfs(0, 0); ++id; dfs(n - 1, 0); int a = 0; int b = 0; int path = d[0][n - 1]; for (int i = 1; i < n - 1; ++i) { int cost1 = d[0][i];//from 0 to i int cost2 = d[1][i];//from n-1 to i if (cost1 < cost2) ++a; else if (cost1 > cost2) ++b; else { if (path % 2 == 0) ++a; else ++b; } } if (a > b) cout << "Fennec"; else cout << "Snuke"; cout << endl; }
a.cc: In function 'int main()': a.cc:22:9: error: 'memset' was not declared in this scope 22 | memset(vis, -1, sizeof vis); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<set> +++ |+#include <cstring> 5 | using namespace std;
s425562052
p03662
C++
//#define MYDEBUG #include <bits/stdc++.h> #ifdef MYDEBUG #define dbp(x) cout<<#x<<": "<<x<<endl #define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl #define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl #define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl #define ifcin(x) std::ifstream cin(x) #else #define dbp(x) #define dbp2(x,y) #define dbp3(x,y,z) #define dbp4(w,x,y,z) #define ifcin(x) #endif #define ll long long #define ull unsigned long long #define all(x) x.begin(), x.end() #define rep(i, from, to) for(int i=from; i<to; ++i) #define REP(i, from, to) for(int i=from; i<=to; ++i) #define EPS = 1e-14; using std::vector; using std::cout; using std::cin; using std::endl; using std::max; using std::min; using std::swap; using std::string; using std::fill; using std::pair; using std::sort; using std::reverse; using std::pair; using std::greater; using std::priority_queue; using std::ostream; template<typename T> ostream& operator<<(ostream& out, const vector<vector<T> >& v) { out << endl; for (size_t i = 0; i < v.size(); ++i) { out << v[i] << endl; } return out; } template<typename T> ostream& operator<<(ostream& out, const vector<T>& v) { out << "["; size_t last = v.size() - 1; for (size_t i = 0; i < v.size(); ++i) { out << v[i]; if (i != last) { out << ","; } } out << "]"; return out; } template<typename T1, typename T2> ostream& operator<<(ostream& out, const pair<T1, T2>& p) { out << "(" << p.first << ", " << p.second << ")"; return out; } struct edge { int from, to, cost; edge(int from, int to, int cost) { this->from = from; this->to = to; this->cost = cost; } edge() { this->from = -1; this->to = -1; this->cost = -1; } bool operator<(const edge& e) const { return this->cost < e.cost; } }; typedef struct edge edge; vector<vector<int> > g; int n; vector<bool> used; //複数始点の幅優先探索 //黒→白→の順にいけるところすべて塗りつぶす //もし、新しくpushできなければ負け const int BLACK = 0, WHITE = 1; int next(int p) { if (p == BLACK) { return WHITE; } else { return BLACK; } } string bfs() { fill(all(used), false); int sb = 1, sw = n; used[sb] = used[sw] = true; std::queue<int> qb, qw; qb.push(sb); qw.push(sw); vector<std::queue<int> > q; q.push_back(qb); q.push_back(qw); int turn = BLACK; while (true) { if (q[turn].empty()&&!q[next(turn].empty()) { if (turn == BLACK) { return "Snuke"; } else { return "Fennec"; } } int now = q[turn].front(); q[turn].pop(); rep(i,0,(int)g[now].size()) { int neigh = g[now][i]; if (!used[neigh]) { q[turn].push(neigh); dbp3(turn, now, neigh); used[neigh] = true; } } turn = next(turn); } return ""; } void solve() { cin >> n; used = vector<bool>(n + 10); g = vector<vector<int> >(n + 10, vector<int>()); rep(i,0,n-1) { int a, b; cin >> a >> b; g[a].push_back(b); g[b].push_back(a); }dbp(g); cout << bfs() << endl; } int main() { solve(); }
a.cc: In function 'std::string bfs()': a.cc:111:38: error: expected ')' before ']' token 111 | if (q[turn].empty()&&!q[next(turn].empty()) { | ~ ^ | ) a.cc:118:30: error: expected ')' before ';' token 118 | int now = q[turn].front(); | ^ | ) a.cc:111:8: note: to match this '(' 111 | if (q[turn].empty()&&!q[next(turn].empty()) { | ^ a.cc:120:20: error: 'now' was not declared in this scope; did you mean 'pow'? 120 | rep(i,0,(int)g[now].size()) | ^~~ a.cc:20:44: note: in definition of macro 'rep' 20 | #define rep(i, from, to) for(int i=from; i<to; ++i) | ^~
s822226538
p03662
C++
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define loop(i,a,b) for(ull i=(a);i<ull(b);++i) #define rep(i,n) loop(i,0,n) #define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i) const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; #define clr(a,i) memset((a), (i) ,sizeof(a)) int n, a, b; vector<int> G[1e5+2]; std::vector<int> se; set<int> fe; void tansaku(int now, int prev, vector<int> a){ rep(i, G[now].size()){ std::vector<int> tmp=a; if(i==now||i==prev) continue; if(G[now][i]!=7){ tmp.emplace_back(now); tansaku(i, now, a); }else { se = a; } } } void coun(int now, int prev, int fukasa){ if(fukasa<cell((double)se.size()/2.0)&&se[fukasa-1]==now) else{ if(now!=1) fe.insert(now); rep(i, G[now].size()){ if(i==now||i==prev) continue; if(G[now][i]){ tansaku(i, now, a); } } } } int main() { std::cin >> n; rep(i,n) { std::cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } std::vector<int> a; tansaku(1,0,a); coun(1,0,0); f=fe.size(); if(f>n-2-f) std::cout << "Fennec" << '\n'; else std::cout << "Snuke" << '\n'; return 0; }
a.cc:29:18: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 29 | vector<int> G[1e5+2]; | ~~~^~ a.cc:29:18: error: could not convert '(1.0e+5 + (double)2)' from 'double' to 'long unsigned int' 29 | vector<int> G[1e5+2]; | ~~~^~ | | | double a.cc:29:18: error: size of array 'G' has non-integral type 'double' a.cc: In function 'void tansaku(int, int, std::vector<int>)': a.cc:37:11: error: 'class std::vector<int>' has no member named 'emplace_back\U0000ff08now\U0000ff09' 37 | tmp.emplace_back(now); | ^~~~~~~~~~~~~~~~~~~ a.cc: In function 'void coun(int, int, int)': a.cc:46:13: error: 'cell' was not declared in this scope; did you mean 'ceill'? 46 | if(fukasa<cell((double)se.size()/2.0)&&se[fukasa-1]==now) | ^~~~ | ceill a.cc:47:3: error: expected primary-expression before 'else' 47 | else{ | ^~~~ a.cc: In function 'int main()': a.cc:68:3: error: 'f' was not declared in this scope 68 | f=fe.size(); | ^
s525642425
p03662
C++
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define loop(i,a,b) for(ull i=(a);i<ull(b);++i) #define rep(i,n) loop(i,0,n) #define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i) const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; #define clr(a,i) memset((a), (i) ,sizeof(a)) int n, a, b; vector<int> G[1e5+2]; std::vector<int> se; set<int> fe; void tansaku(int now, int prev, vector<int> a){ rep(i, G[now].size()){ std::vector<int> tmp=a; if(i==now||i==prev) continue; if(G[now][i]!=7){ tmp.emplace_back(now); tansaku(i, now, a); }else { se = a; } } } void coun(int now, int prev, int fukasa){ if(fukasa<cell((double)se.size()/2.0)&&se[fukasa-1]==now) else{ if(now!=1) fe.insert(now); rep(i, G[now].size()){ if(i==now||i==prev) continue; if(G[now][i]){ tansaku(i, now, a); } } } } int main() { std::cin >> n; rep(i,n) { std::cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } std::vector<int> a; tansaku(1,0,a); coun(1,0,0); f=fe.size(); if(f>n-2-f) std::cout << "Fennec" << '\n'; else std::cout << "Snuke" << '\n'; return 0; }
a.cc:29:18: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 29 | vector<int> G[1e5+2]; | ~~~^~ a.cc:29:18: error: could not convert '(1.0e+5 + (double)2)' from 'double' to 'long unsigned int' 29 | vector<int> G[1e5+2]; | ~~~^~ | | | double a.cc:29:18: error: size of array 'G' has non-integral type 'double' a.cc: In function 'void tansaku(int, int, std::vector<int>)': a.cc:37:11: error: 'class std::vector<int>' has no member named 'emplace_back\U0000ff08now\U0000ff09' 37 | tmp.emplace_back(now); | ^~~~~~~~~~~~~~~~~~~ a.cc: In function 'void coun(int, int, int)': a.cc:46:13: error: 'cell' was not declared in this scope; did you mean 'ceill'? 46 | if(fukasa<cell((double)se.size()/2.0)&&se[fukasa-1]==now) | ^~~~ | ceill a.cc:47:3: error: expected primary-expression before 'else' 47 | else{ | ^~~~ a.cc: In function 'int main()': a.cc:68:3: error: 'f' was not declared in this scope 68 | f=fe.size(); | ^
s679095266
p03662
C++
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; typedef long long LL; const int MAXN=1e5+5; int tot,head[MAXN]; bool mark[MAXN]; int ans1,ans2; int n; int num; int slit; int father; struct Edge { int from,to; int next; }e[MAXN*2]; void add(int u,int v) { e[tot].from=u; e[tot].to=v; e[tot].next=head[u]; head[u]=tot++; } bool dfs(int rt,int fa) { for(int i=head[rt];i!=-1;i=e[i].next) { int to=e[i].to; if(to==fa) continue; if(to==n) return true; if(dfs(to,rt)) { mark[to]=true; return true; } } return false; } int dfs2(int rt,int fa) { for(int i=head[rt];i!=-1;i=e[i].next) { int to=e[i].to; if(to==fa) continue; if(!mark[to]) continue; else { num++; if(num==slit) { father=rt; return to; } else return dfs2(to,rt); } } } void dfs3(int rt,int fa) { for(int i=head[rt];i!=-1;i=e[i].next) { int to=e[i].to; if(to==fa) continue; ans1++; dfs3(to,rt); } } void dfs4(int rt,int fa) { for(int i=head[rt];i!=-1;i=e[i].next) { int to=e[i].to; if(to==fa) continue; ans2++; dfs4(to,rt); } } int main() { //ios::sync_with_stdio(false); while(cin>>n) { memset(head,-1,sizeof(head)); memset(mark,false,sizeof(mark)); memset(vis,false,sizeof(vis)); tot=0; int u,v; for(int i=1;i<=n-1;i++) { cin>>u>>v; add(u,v);add(v,u); } dfs(1,0); mark[1]=true;mark[n]=true; int cnt=0; for(int i=1;i<=n;i++) { if(mark[i]) { cnt++; //cout<<i<<" "; } } //cout<<endl; if(cnt&1) slit=cnt/2+1; else slit=cnt/2; //cout<<"slit: "<<slit<<endl; num=1; int id=dfs2(1,0); //cout<<id<<endl; int child; for(int i=head[id];i!=-1;i=e[i].next) { int to=e[i].to; if(mark[to]&&to!=father) child=to; } //cout<<father<<" "<<id<<" "<<child<<endl; ans1=0;ans2=0; dfs3(id,child); dfs4(child,id); //cout<<ans1<<" "<<ans2<<endl; if(ans1>ans2) cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; } return 0; } /* 11 1 2 1 6 1 8 3 6 4 6 5 8 5 7 4 9 4 10 10 11 */
a.cc: In function 'int main()': a.cc:97:16: error: 'vis' was not declared in this scope 97 | memset(vis,false,sizeof(vis)); | ^~~ a.cc: In function 'int dfs2(int, int)': a.cc:66:1: warning: control reaches end of non-void function [-Wreturn-type] 66 | } | ^
s027900345
p03662
C++
#include<iostream> #include<queue> using namespace std; const int MAX = 100000; struct board { static queue<board *> graph; int type; // 0:普通マス 1:黒マス 2:白マス }; board *nowRead; int count(board *read, int level) { if (read->type == 2) return level / -2; int judge, ret = 0; while(!read->graph.empty()) { nowRead = read->graph.front(); read->graph.pop(); judge = count(nowRead, level + 1); if (-judge >= 0) { if (-judge < level) return judge; else continue; } ret += judge; } return ret + 1; } int main() { int N, a, b, cnt; static board m[MAX]; cin >> N; m[0].type = 1; m[N - 1].type = 2; for (int i = 1;i < N - 1;i ++) { m[i].type = 0; } for (int i = 0;i < N - 1;i ++) { cin >> a >> b; m[a - 1].graph.push(&m[b - 1]); m[b - 1].graph.push(&m[a - 1]); } cnt = count(&m[0], 0); // cout << cnt << ":"; if (cnt > N - cnt) cout << "Fennec"; else cout << "Snuke"; return 0; }
/usr/bin/ld: /tmp/cc3muzbr.o: warning: relocation against `_ZN5board5graphE' in read-only section `.text' /usr/bin/ld: /tmp/cc3muzbr.o: in function `count(board*, int)': a.cc:(.text+0x39): undefined reference to `board::graph' /usr/bin/ld: a.cc:(.text+0x52): undefined reference to `board::graph' /usr/bin/ld: a.cc:(.text+0x96): undefined reference to `board::graph' /usr/bin/ld: /tmp/cc3muzbr.o: in function `main': a.cc:(.text+0x186): undefined reference to `board::graph' /usr/bin/ld: a.cc:(.text+0x1ba): undefined reference to `board::graph' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status
s841117589
p03662
C++
#include <bits/stdc++.h> using namespace std; int N; std::vector<std::vector<int>> adjlist; std::vector<int> do_search_path (int src, int dst, int prev = -1) { if (src == dst) return {dst}; vector<int> path; for ( auto neighbor : adjlist[src] ) { if (neighbor == prev) continue; path = do_search_path (neighbor, dst, src); if (path.size () > 0) { path.push_back (neighbor); return path; } } return {}; } std::vector<int> search_path () { auto p = do_search_path (0, N - 1); p.push_back (0); reverse (p.begin (), p.end ()); p.pop_back (); return p; } int count (int node, int prev = -1, int r = 0) { if (adjlist[node].size () == 1) return 1; int sum = 0; for (auto n : adjlist[node]) { if (n == prev) continue; sum += count (n, node); } return sum + 1; } int count (int node, int prev = -1) { if (adjlist[node].size () == 1) return 1; int sum = 0; for (auto n : adjlist[node]) { if (n == prev) continue; sum += count (n, node); } return sum + 1; } std::string solve () { auto path = search_path (); int n = path.size () / 2; if (path.size () % 2 != 0) n += 1; int f = 0, s = 0; for (int i = 0; i < path.size (); ++i) { int a = path[i]; for (auto t : adjlist[a]) { if (t == path[min(0, i - 1)]) continue; if (t == path[max(i + 1, static_cast<int> (path.size () - 1))]) continue; if (i < n) f += count (t, a) + 1; else s += count (t, a) + 1; } } return (f > s) ? "fennec" : "sunuke"; } int main () { cin >> N; adjlist.resize(N); for (int i = 0; i < N; ++i) { int a, b; cin >> a >> b; adjlist[a - 1].push_back (b - 1); adjlist[b - 1].push_back (a - 1); } cout << solve () << endl; return 0; }
a.cc: In function 'int count(int, int)': a.cc:55:22: error: call of overloaded 'count(int&, int&)' is ambiguous 55 | sum += count (n, node); | ~~~~~~^~~~~~~~~ a.cc:35:5: note: candidate: 'int count(int, int, int)' 35 | int count (int node, int prev = -1, int r = 0) { | ^~~~~ a.cc:48:5: note: candidate: 'int count(int, int)' 48 | int count (int node, int prev = -1) { | ^~~~~ a.cc: In function 'std::string solve()': a.cc:74:28: error: call of overloaded 'count(int&, int&)' is ambiguous 74 | f += count (t, a) + 1; | ~~~~~~^~~~~~ a.cc:35:5: note: candidate: 'int count(int, int, int)' 35 | int count (int node, int prev = -1, int r = 0) { | ^~~~~ a.cc:48:5: note: candidate: 'int count(int, int)' 48 | int count (int node, int prev = -1) { | ^~~~~ a.cc:76:28: error: call of overloaded 'count(int&, int&)' is ambiguous 76 | s += count (t, a) + 1; | ~~~~~~^~~~~~ a.cc:35:5: note: candidate: 'int count(int, int, int)' 35 | int count (int node, int prev = -1, int r = 0) { | ^~~~~ a.cc:48:5: note: candidate: 'int count(int, int)' 48 | int count (int node, int prev = -1) { | ^~~~~
s737655829
p03662
C++
#if 1 #include <iostream> #include <fstream> #include <string> #include <vector> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <queue> #include <stack> #include <array> #include <deque> #include <algorithm> #include <utility> #include <cstdint> #include <functional> #include <iomanip> #include <numeric> #include <assert.h> #include <bitset> auto& in = std::cin; auto& out = std::cout; int64_t N; std::vector<int64_t> graph[200000]; bool used[200000] = {}; bool seted[200000] = {}; template<typename T> void fill_all(T& arr, const T& v) { arr = v; } template<typename T, typename ARR> void fill_all(ARR& arr, const T& v) { for (auto& i : arr) { fill_all(i, v); } } //0->N-1パス bool func_1(int64_t i) { used[i] = true; if (i == N - 1) { return true; } for (auto& nex : graph[i]) { if (used[nex] == false) { if (func_1(nex)) { return true; } } } used[i] = false; return false; } int64_t count(int64_t i, int64_t parent) { int64_t sum = 1; for (auto& nex : graph[i]) { if (nex != parent) { sum += count(nex,i); } } return sum; } int64_t main() { using std::endl; in.sync_with_stdio(false); out.sync_with_stdio(false); in.tie(nullptr); out.tie(nullptr); in >> N; for (int64_t i = 0; i < N-1; ++i) { int64_t a,b; in >> a >> b; --a; --b; graph[a].push_back(b); graph[b].push_back(a); } func_1(0); seted[0] = true; seted[N - 1] = true; int64_t first_num = 0;//1 int64_t fpos = 0; int64_t second_num = 0; int64_t spos = N-1; for (auto& v : graph[fpos]) { if (!used[v]) { first_num += count(v, fpos); } } for (auto& v : graph[spos]) { if (!used[v]) { second_num += count(v, spos); } } bool updated = true; while(updated) { updated = false; for (auto& v : graph[fpos]) { if (used[v]) { if (seted[v]) { break; } updated = true; seted[v] = true; fpos = v; ++first_num; break; } } if (!updated) { break; } for (auto& v : graph[fpos]) { if (!used[v]) { first_num += count(v, fpos); } } updated = false; for (auto& v : graph[spos]) { if (used[v]) { if (seted[v]) { break; } updated = true; seted[v] = true; spos = v; ++second_num; break; } } if (!updated) { break; } for (auto& v : graph[spos]) { if (!used[v]) { second_num += count(v, spos); } } } if (first_num > second_num) { out << "Fennec" << endl; } else if (second_num > first_num) { out << "Snuke" << endl; } else { out << "Snuke" << endl; } return 0; } #endif
a.cc:70:1: error: '::main' must return 'int' 70 | int64_t main() | ^~~~~~~
s317471693
p03662
C++
#include <stdio.h> #include <math.h> #include <algorithm> #include <iostream> #include <string.h> using namespace std; vector<int> v[100010]; int vis[100010]; int ans=0; int dfs(int n,int w) { if(vis[n]==1||n==w) return 0; else { vis[n]=1; for(int i=0;i<v[n].size();i++) { ans+=dfs(v[n][i],w); } return 1; } } int main() { int n,a,b,sa,sb; scanf("%d",&n); for(int i=0;i<n-1;i++) { cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } dfs(1,n); sa=ans; ans=0; memset(vis,0,sizeof(vis)); dfs(n,1); sb=ans; if(sa>sb) printf("Fennec"); else if(sa<sb) printf("Snuke"); else if(sa%2==0) printf("Snuke"); else printf("Fennec"); return 0; }
a.cc:7:1: error: 'vector' does not name a type 7 | vector<int> v[100010]; | ^~~~~~ a.cc: In function 'int dfs(int, int)': a.cc:16:23: error: 'v' was not declared in this scope 16 | for(int i=0;i<v[n].size();i++) | ^ a.cc: In function 'int main()': a.cc:31:9: error: 'v' was not declared in this scope 31 | v[a].push_back(b); | ^
s002323965
p03662
Java
import java.util.*; public class Main { static boolean[] memo; static int[] choice; static ArrayList[] edge; static int N; static int[] wa; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); edge = new ArrayList[N + 1]; memo = new boolean[N + 1]; choice = new int[N + 1]; wa = new int[N + 1]; for(int i = 1; i < N + 1; i++) { edge[i] = new ArrayList<Integer>(); } for(int i = 0; i < N; i++) { int a = sc.nextInt(); int b = sc.nextInt(); edge[a].add(b); edge[b].add(a); } dfs(1, -1); ArrayList<Integer> road = new ArrayList<Integer>(); road.add(1); int ve = 1; int oya = 1; while(ve != N) { ArrayList<Integer> e = edge[ve]; for(int i = 0; i < e.size(); i++) { int ko = e.get(i); if(ko != oya) { if(memo[ko]) { road.add(ko); ve = ko; oya = ve; } } } } int sente = (road.size() + 1) / 2; int senten = 0; for(int i = sente - 1; i >= 0; i--) { int u = road[i]; senten += sum[u]; } String ans = "Snuke"; if(senten > N - senten) ans = "Fennec"; System.out.println(ans); } public static boolean dfs(int v, int p) { choice[v] = 1; if(v == N) return true; ArrayList<Integer> e = edge[v]; boolean ret = false; for(int i = 0; i < e.size(); i++) { int c = e.get(i); if(c != p) { boolean flg = false; if(choice[c] == 0) { flg = dfs(c, v); } else { flg = memo[c]; } ret = ret || flg; } } return memo[v] = ret; } public static int sum(int v, int p) { ArrayList<Integer> e = edge[v]; int ret = 0; for(int i = 0; i < e.size(); i++) { int ko = e.get(i); if(ko != p && !memo[ko]) { int s = 0; if(wa[ko] == 0) { s = sum(ko, v); } else { s = wa[ko]; } ret += s; } } return ret; } }
Main.java:46: error: array required, but ArrayList<Integer> found int u = road[i]; ^ Main.java:47: error: cannot find symbol senten += sum[u]; ^ symbol: variable sum location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s136167605
p03662
C++
#include <iostream> #include <cmath> using namespace std; int end[100005],next[100005],last[100005],fu[10005],n,flag,son[100005]; int dfs(int p,int deep) { int sum=0,t,b; if(p==n)flag=deep; if(son[p]==0)return 0; t=last[p]; while(t) { b=end[t]; sum+=1+dfs(b,deep+1); t=next[t]; } return sum; } int main() { int ans1,ans2,i,x,y,m,k=0; cin>>n; for(i=1;i<=n-1;i++) { cin>>x>>y; son[x]++; end[++k]=y; next[k]=last[x]; last[x]=k; fu[y]=x; } ans1=dfs(1,1); m=flag-(flag/2+1)-1; for(i=1;i<=m;i++) { n=fu[n]; flag--; } ans2=dfs(n,flag); if(ans1-ans2+1<=ans2)cout<<"Snuke"; else cout<<"Fennec"; }
a.cc: In function 'int dfs(int, int)': a.cc:13:19: error: reference to 'end' is ambiguous 13 | b=end[t]; | ^~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/14/bits/range_access.h:36: /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:4:5: note: 'int end [100005]' 4 | int end[100005],next[100005],last[100005],fu[10005],n,flag,son[100005]; | ^~~ a.cc:15:19: error: reference to 'next' is ambiguous 15 | t=next[t]; | ^~~~ In file included from /usr/include/c++/14/string:47: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:4:17: note: 'int next [100005]' 4 | int end[100005],next[100005],last[100005],fu[10005],n,flag,son[100005]; | ^~~~ a.cc: In function 'int main()': a.cc:27:17: error: reference to 'end' is ambiguous 27 | end[++k]=y; | ^~~ /usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:4:5: note: 'int end [100005]' 4 | int end[100005],next[100005],last[100005],fu[10005],n,flag,son[100005]; | ^~~ a.cc:28:17: error: reference to 'next' is ambiguous 28 | next[k]=last[x]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:4:17: note: 'int next [100005]' 4 | int end[100005],next[100005],last[100005],fu[10005],n,flag,son[100005]; | ^~~~
s014142840
p03662
C++
#include <stdio.h> #include <vector> #include <queue> using namespace std; vector<int> edges[100001]; int distA[100001]; int distB[100001]; int main() { int N; scanf("%d", &N); for (int i = 0; i < N - 1; i++) { int a, b; scanf("%d %d", &a, &b); edges[a].push_back(b); edges[b].push_back(a); distA[i] = -1; distB[i] = -1; } queue<int> q; distA[1] = 0; q.push(1); while (!q.empty()) { int pos = q.front(); q.pop(); // printf("dist A cur = %d\n", pos); for (int i = 0, ilim = edges[pos].size(); i < ilim; i++) { int next_pos = edges[pos][i]; if (distA[next_pos] != -1 || next_pos = N) continue; distA[next_pos] = distA[pos] + 1; q.push(next_pos); } } distB[N] = 0; q.push(N); while (!q.empty()) { int pos = q.front(); q.pop(); for (int i = 0, ilim = edges[pos].size(); i < ilim; i++) { int next_pos = edges[pos][i]; if (distB[next_pos] != -1 || next_pos = 1) continue; distB[next_pos] = distB[pos] + 1; q.push(next_pos); } } int nearer_to_A = 0; for (int i = 1; i <= N - 2; i++) { if (distA[i] <= distB[i]) { nearer_to_A++; } } if (nearer_to_A > N - nearer_to_A) { printf("Fennec\n"); } else { printf("Snuke\n"); } return 0; }
a.cc: In function 'int main()': a.cc:33:33: error: lvalue required as left operand of assignment 33 | if (distA[next_pos] != -1 || next_pos = N) continue; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ a.cc:46:33: error: lvalue required as left operand of assignment 46 | if (distB[next_pos] != -1 || next_pos = 1) continue; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
s344285297
p03662
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; int n; vector<int> g[100005]; // int dis[100005]; int prev[100005], c[100005]; bool used[100005]; void setDis(int from) { FOR(i, g[from].size()) { int v = g[from][i]; if (used[v]) continue; prev[v] = from; // dis[v] = dis[from]+1; used[v] = true; setDis(v); } return; } vector<int> get_path(int t) { vector<int> path; for (; t != -1; t = prev[t]) path.push_back(t); reverse(path.begin(), path.end()); return path; } void dfs(int from) { FOR(i, g[from].size()) { int v = g[from][i]; if (used[v]) continue; if (c[v] == 0) c[v] = c[from]; used[v] = true; dfs(v); } } int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n; FOR(i, n-1) { int a, b; cin >> a >> b; a--; b--; g[a].push_back(b); g[b].push_back(a); } // dis[0] = 0; used[0] = true; fill(prev, prev+n, -1); setDis(0); vector<int> path = get_path(n-1); // FOR(i, path.size()) { // cout << path[i] << endl; // } fill(c, c+n, 0); FOR(i, path.size()) { if (i < (path.size()+1)/2) c[path[i]] = 1; else c[path[i]] = -1; } // FOR(i, n) cout << c[i] << endl; fill(used, used+n, false); used[0] = true; dfs(0); int cnt = 0; FOR(i, n) { if (c[i] > 0) cnt++; } if (cnt >= (n+1)/2) cout << "Fennec" << endl; else cout << "Snuke" << endl; return 0; }
a.cc: In function 'void setDis(int)': a.cc:19:17: error: reference to 'prev' is ambiguous 19 | prev[v] = from; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100005]' 12 | int prev[100005], c[100005]; | ^~~~ a.cc: In function 'std::vector<int> get_path(int)': a.cc:29:29: error: reference to 'prev' is ambiguous 29 | for (; t != -1; t = prev[t]) path.push_back(t); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100005]' 12 | int prev[100005], c[100005]; | ^~~~ a.cc: In function 'int main(int, const char**)': a.cc:57:14: error: reference to 'prev' is ambiguous 57 | fill(prev, prev+n, -1); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100005]' 12 | int prev[100005], c[100005]; | ^~~~ a.cc:57:20: error: reference to 'prev' is ambiguous 57 | fill(prev, prev+n, -1); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:12:5: note: 'int prev [100005]' 12 | int prev[100005], c[100005]; | ^~~~
s613891313
p03662
C
#include <stdio.h> #include<queue> using namespace std; int main(void){ int N; scanf("%d",&N); int a[N-1],b[N-1]; for(int i=0;i<N-1;i++){ scanf("%d %d",&a[i],&b[i]); } queue<int> po; int Ftyouten[N+1]; int Styouten[N+1]; for(int i=0;i<=N;i++){Ftyouten[i]=-1;Styouten[i]=-1;} po.push(1); po.push(0); while(!po.empty()){ int pa=po.front(); po.pop(); int pi=po.front(); po.pop(); for(int i=0;i<N-1;i++){ if(a[i]==pa&&Ftyouten[b[i]]==-1){ Ftyouten[b[i]]=pi+1; po.push(Ftyouten[b[i]]); po.push(pi+1); } if(b[i]==pa&&Ftyouten[a[i]]==-1){ Ftyouten[a[i]]=pi+1; po.push(Ftyouten[a[i]]); po.push(pi+1); } } } po.push(N); po.push(0); while(!po.empty()){ int pa=po.front(); po.pop(); int pi=po.front(); po.pop(); for(int i=0;i<N-1;i++){ if(a[i]==pa&&Styouten[b[i]]==-1){ Styouten[b[i]]=pi+1; po.push(Ftyouten[b[i]]); po.push(pi+1); } if(b[i]==pa&&Styouten[a[i]]==-1){ Styouten[a[i]]=pi+1; po.push(Ftyouten[a[i]]); po.push(pi+1); } } } int F=0; int S=0; for(int i=1;i<=N;i++){ if(Ftyouten[i]>=Styouten[i])F++; else S++; } if(F<=S)printf("Snuke"); else printf("Fennec"); return 0; }
main.c:2:9: fatal error: queue: No such file or directory 2 | #include<queue> | ^~~~~~~ compilation terminated.
s094005519
p03662
C++
#include <iostream> #include <vector> #include <queue> #include <map> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define vec vector #define mp make_pair #define pb push_back #define piiv pair<int, pair<int, vector<int>>> int INF = 1000000007; int n; vec<vec<int>> edge; vec<int> bfs(void) { priority_queue<piiv, vec<piiv>, greater<piiv>> que; vec<int> dp(n, INF); vec<vec<int>> dr(n); vec<int> init(1, 0); dr[0] = init; que.push(mp(0, mp(0, init))); dp[0] = 0; while(!que.empty()) { piiv get = que.top(); que.pop(); int v = get.second.first; if (dp[v] < get.first) continue; rep(i, edge[v].size()) { if (dp[edge[v][i]] > dp[v] + 1) { dp[edge[v][i]] = dp[v] + 1; get.second.second.pb(edge[v][i]); dr[edge[v][i]] = get.second.second; que.push(mp(dp[v] + 1, mp(edge[v][i], get.second.second))); } } } return dr[n - 1]; } vec<int> dp; void dfs(int c, int s) { if (dp[s] == 1 - c || dp[s] == 3 - c || dp[s] == c) return; dp[s] = c; rep(i, edge[s].size()) { dfs(c, edge[s][i]); } } int main(void) {
a.cc: In function 'int main()': a.cc:56:2: error: expected '}' at end of input 56 | { | ~^
s571033055
p03662
C++
#include<bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; int n,x,y; bool vis[300000]; vector<int>v[300000]; int dfs(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]&&v[x][i]!=n){ res+=dfs(v[x][i]); } } return res; } int dfs2(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]&&v[x][i]!=1){ res+=dfs2(v[x][i]); } } return res; } int dfs4(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]){ res+=dfs4(v[x][i]); } } return res; } int dfs3(int x,int d){ if(x==1)return d; vis[x]=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]){ int p=dfs3(v[x][i],d+1); if(p)return p; } } return 0; } main(){ cin>>n; r(i,n-1){ cin>>x>>y; v[x].push_back(y); v[y].push_back(x); } memset(vis,0,sizeof(vis)); int a1=dfs(1); memset(vis,0,sizeof(vis)); int a2=dfs2(n); memset(vis,0,sizeof(vis)); int a3=dfs3(n,0); if(a3%2)a1+=a3/2+1,a2+=a3/2; else a2+=a3/2,a1+=a3/2; if(a1>=a2)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; }#include<bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; int n,x,y; bool vis[300000]; vector<int>v[300000]; int dfs(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]&&v[x][i]!=n){ res+=dfs(v[x][i]); } } return res; } int dfs2(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]&&v[x][i]!=1){ res+=dfs2(v[x][i]); } } return res; } int dfs4(int x){ vis[x]=1; int res=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]){ res+=dfs4(v[x][i]); } } return res; } int dfs3(int x,int d){ if(x==1)return d; vis[x]=1; for(int i=0;i<v[x].size();i++){ if(!vis[v[x][i]]){ int p=dfs3(v[x][i],d+1); if(p)return p; } } return 0; } main(){ cin>>n; r(i,n-1){ cin>>x>>y; v[x].push_back(y); v[y].push_back(x); } memset(vis,0,sizeof(vis)); int a1=dfs(1); memset(vis,0,sizeof(vis)); int a2=dfs2(n); memset(vis,0,sizeof(vis)); int a3=dfs3(n,0); if(a3%2)a1+=a3/2+1,a2+=a3/2; else a2+=a3/2,a1+=a3/2; if(a1>=a2)cout<<"Fennec"<<endl; else cout<<"Snuke"<<endl; }
a.cc:65:2: error: stray '#' in program 65 | }#include<bits/stdc++.h> | ^ a.cc:48:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 48 | main(){ | ^~~~ a.cc:65:3: error: 'include' does not name a type 65 | }#include<bits/stdc++.h> | ^~~~~~~ a.cc:68:5: error: redefinition of 'int n' 68 | int n,x,y; | ^ a.cc:4:5: note: 'int n' previously declared here 4 | int n,x,y; | ^ a.cc:68:7: error: redefinition of 'int x' 68 | int n,x,y; | ^ a.cc:4:7: note: 'int x' previously declared here 4 | int n,x,y; | ^ a.cc:68:9: error: redefinition of 'int y' 68 | int n,x,y; | ^ a.cc:4:9: note: 'int y' previously declared here 4 | int n,x,y; | ^ a.cc:69:6: error: redefinition of 'bool vis [300000]' 69 | bool vis[300000]; | ^~~ a.cc:5:6: note: 'bool vis [300000]' previously declared here 5 | bool vis[300000]; | ^~~ a.cc:70:12: error: redefinition of 'std::vector<int> v [300000]' 70 | vector<int>v[300000]; | ^ a.cc:6:12: note: 'std::vector<int> v [300000]' previously declared here 6 | vector<int>v[300000]; | ^ a.cc:71:5: error: redefinition of 'int dfs(int)' 71 | int dfs(int x){ | ^~~ a.cc:7:5: note: 'int dfs(int)' previously defined here 7 | int dfs(int x){ | ^~~ a.cc:81:5: error: redefinition of 'int dfs2(int)' 81 | int dfs2(int x){ | ^~~~ a.cc:17:5: note: 'int dfs2(int)' previously defined here 17 | int dfs2(int x){ | ^~~~ a.cc:91:5: error: redefinition of 'int dfs4(int)' 91 | int dfs4(int x){ | ^~~~ a.cc:27:5: note: 'int dfs4(int)' previously defined here 27 | int dfs4(int x){ | ^~~~ a.cc:101:5: error: redefinition of 'int dfs3(int, int)' 101 | int dfs3(int x,int d){ | ^~~~ a.cc:37:5: note: 'int dfs3(int, int)' previously defined here 37 | int dfs3(int x,int d){ | ^~~~ a.cc:112:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 112 | main(){ | ^~~~ a.cc:112:1: error: redefinition of 'int main()' a.cc:48:1: note: 'int main()' previously defined here 48 | main(){ | ^~~~
s479308814
p03662
C++
// need #include <iostream> #include <algorithm> // data structure #include <bitset> //#include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> //#include <array> //#include <tuple> //#include <unordered_map> //#include <unordered_set> #include <complex> //#include <deque> #include<valarray> // stream //#include <istream> //#include <sstream> //#include <ostream> #include <fstream> // etc #include <cassert> #include <functional> #include <iomanip> //#include <typeinfo> #include <chrono> #include <random> #include <numeric> #define INIT std::ios::sync_with_stdio(false);std::cin.tie(0); #define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; } template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { std::cin >> first; MACRO_VAR_Scan(rest...); } #define VEC_ROW(type, n, ...)std::vector<type> __VA_ARGS__;MACRO_VEC_ROW_Init(n, __VA_ARGS__); for(int i=0; i<n; ++i){MACRO_VEC_ROW_Scan(i, __VA_ARGS__);} template<typename T> void MACRO_VEC_ROW_Init(int n, T& t) { t.resize(n); } template<typename First, typename...Rest>void MACRO_VEC_ROW_Init(int n, First& first, Rest&...rest) { first.resize(n); MACRO_VEC_ROW_Init(n, rest...); } template<typename T> void MACRO_VEC_ROW_Scan(int p, T& t) { std::cin >> t[p]; } template<typename First, typename...Rest>void MACRO_VEC_ROW_Scan(int p, First& first, Rest&...rest) { std::cin >> first[p]; MACRO_VEC_ROW_Scan(p, rest...); } #define OUT(d) std::cout<<d; #define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d; #define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d; #define SP std::cout<<" "; #define TAB std::cout<<"\t"; #define BR std::cout<<"\n"; #define SPBR(i, n) std::cout<<(i + 1 == n ? '\n' : ' '); #define ENDL std::cout<<std::endl; #define FLUSH std::cout<<std::flush; #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i; #define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i; #define ALL(a) (a).begin(),(a).end() #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i) #define REP(i, n) for(int i=0;i<int(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) #define FORLL(i, a, b) for(ll i=ll(a);i<ll(b);++i) #define RFORLL(i, a, b) for(ll i=ll(b)-1;i>=ll(a);--i) #define REPLL(i, n) for(ll i=0;i<ll(n);++i) #define RREPLL(i, n) for(ll i=ll(n)-1;i>=0;--i) #define PAIR std::pair<int, int> #define PAIRLL std::pair<ll, ll> #define IN(a, x, b) (a<=x && x<b) #define SHOW(d) {std::cerr << #d << "\t:" << d << "\n";} #define SHOWVECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";} #define SHOWVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr << yyy << " ";}std::cerr << "\n";}} #define SHOWPAIR(p) {std::cerr << #p << "\t:(" << p.first << ",\t" << p.second << ")\n";} #define SHOWPAIRVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr<<'('<<yyy.first<<", "<<yyy.second<<") ";}std::cerr << "\n";}} #define SHOWPAIRVECTOR(v) {for(const auto& xxx:v){std::cerr<<'('<<xxx.first<<", "<<xxx.second<<") ";}std::cerr<<"\n";} #define SHOWQUEUE(a) {auto tmp(a);std::cerr << #a << "\t:";while(!tmp.empty()){std::cerr << tmp.front() << " ";tmp.pop();}std::cerr << "\n";} template<typename T> inline T CHMAX(T& a, const T b) { return a = (a < b) ? b : a; } template<typename T> inline T CHMIN(T& a, const T b) { return a = (a > b) ? b : a; } #define EXCEPTION(msg) throw std::string("Exception : " msg " [ in ") + __func__ + " : " + std::to_string(__LINE__) + " lines ]" #define TRY(cond, msg) try {if (cond) EXCEPTION(msg);}catch (std::string s) {std::cerr << s << std::endl;} void CHECKTIME(std::function<void()> f) { auto start = std::chrono::system_clock::now(); f(); auto end = std::chrono::system_clock::now(); auto res = std::chrono::duration_cast<std::chrono::nanoseconds>((end - start)).count(); std::cerr << "[Time:" << res << "ns (" << res / (1.0e9) << "s)]\n"; } #define int ll using ll = long long; using ull = unsigned long long; constexpr int INFINT = 1 << 30; // 1.07x10^ 9 constexpr int INFINT_LIM = (1LL << 31) - 1; // 2.15x10^ 9 constexpr ll INFLL = 1LL << 60; // 1.15x10^18 constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62); // 9.22x10^18 constexpr double EPS = 1e-7; constexpr int MOD = 1000000007; constexpr double PI = 3.141592653589793238462643383279; signed main() { INIT; VAR(int, n); VEC_ROW(int, n - 1, a, b); std::vector<std::vector<int>> g(n); REP(i, n - 1) { --a[i]; --b[i]; g[a[i]].emplace_back(b[i]); g[b[i]].emplace_back(a[i]); } std::queue<int> que; que.push(0); std::vector<bool> visited(n, false); std::vector<int> pre(n, -1); visited[0] = true; while (!que.empty()) { int now = que.front(); que.pop(); for (auto to : g[now]) { if (visited[to]) continue; visited[to] = true; pre[to] = now; que.push(to); } } int cnt = -1; int p = n - 1; while (p == 0) { p = pre[p]; ++cnt; } cnt /= 2; int p = n - 1; while (cnt != 0) { p = pre[p]; --cnt; } int white = 0; visited = std::vector<bool>(n, false); visited[pre[p]] = true; visited[p] = true; que.push(p); while (!que.empty()) { int now = que.front(); que.pop(); ++white; for (auto to : g[now]) { if (visited[to]) continue; visited[to] = true; que.push(to); } } int black = n - white; SHOW(black); SHOW(white); OUT(((black <= white) ? "Snuke" : "Fennec"))BR; return 0; }
a.cc: In function 'int main()': a.cc:125:13: error: redeclaration of 'll p' 125 | int p = n - 1; | ^ a.cc:119:13: note: 'll p' previously declared here 119 | int p = n - 1; | ^
s484112300
p03662
C++
#include <bits/stdc++.h> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x)) #define fi first #define se second #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__) void _dbg(string){cout<<endl;} template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);} template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} #define INF 1120000000 vector<int> tree[100005]; int main(){ int n; cin>>n; rep(i,n-1){ int a,b; cin>>a>>b; a--;b--; tree[a].pb(b); tree[b].pb(a); } vector<int> df(n, INF), ds(n,INF); auto djk = [&](vector<int> d, int from){ d[from] = 0; queue<int> q; q.push(from); while(!q.empty()){ int x = q.front(); q.pop(); for(auto to : tree[x]) if(d[to]==INF){ d[to] = d[x] +1; prev[to] = x; q.push(to); } } }; int fe=0, su=0; rep(i,n){ if(df[i]<=du[i]) fe++; else su++; } assert(fe + su == n); if(fe > su) cout << "Fennec" << endl; else cout << "Snuke" << endl; return 0; }
a.cc: In lambda function: a.cc:42:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 42 | prev[to] = x; | ^ a.cc: In function 'int main()': a.cc:50:15: error: 'du' was not declared in this scope; did you mean 'su'? 50 | if(df[i]<=du[i]) fe++; | ^~ | su
s808803431
p03662
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <queue> using namespace std; int n; vector<int> v[100005]; bool vis[100005]; int END; int cntB,cntW; void dij(int x){ priority_queue<pair<int,int> > q; q.push(make_pair(0,x)); vis[x]=true; while (!q.empty()){ pair<int,int> t=q.top(); q.pop(); int dist=-t.first; int pl=t.second; if (pl==END){ if (dist%2){ if (cntB<=cntW){ cout<<"Snuke"; } else{ cout<<"Fennec"; } } else{ if (cntB<=cntW-1){ cout<<"Snuke"; } else{ cout<<"Fennec"; } } exit(0); } for (int i=0;i<v[pl].size();i++){ if (vis[v[pl][i]]){ continue; } vis[v[pl][i]]=true; q.push(make_pair(-(dist+1),v[pl][i])); } } } void dfs(int x,int d,bool y){ if (v[x].size()==1 && y==0){ cntB+=d; return; } for (int i=0;i<v[x].size();i++){ if (vis[v[x][i]]){ continue; } vis[v[x][i]]=true; if (v[x][i]==n){ dfs(v[x][i],d+1,1); } else{ dfs(v[x][i],d+1,y); } } } int main(){ cin>>n; END=n; for (int i=1;i<n;i++){ int a,b; cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } vis[1]=true; dfs(1,0,0); cntW=n-2-cntB; memset(vis,0,sizeof(vis)); dij(1); }
a.cc: In function 'int main()': a.cc:79:9: error: 'memset' was not declared in this scope 79 | memset(vis,0,sizeof(vis)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <queue> +++ |+#include <cstring> 6 | using namespace std;
s850922960
p03662
C++
def spaceinput(): return list(map(int,input().split(" "))) def f(c): return abs(sum(aa[:c])-sum(aa[c:])) N=int(input()) aa=spaceinput() l=0 r=len(aa)-1 vl=f(l+1) vr=f(r) while True: c=int((l+r)/2) if c==0: c+=1 vc=f(c) if vl >vc: l=c vl=vc elif vr >vc: r=c vr=vc else: break print(f(c))
a.cc:1:1: error: 'def' does not name a type 1 | def spaceinput(): | ^~~
s141104483
p03662
C++
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v; void add(int u,int v) { next[++num]=head[u]; head[u]=num; to[num]=v; } int dfs(int now,int deep) { vis[now]=1; int nowans=0; if(now==n) return deep; for(int i=head[now];i;i=next[i]) if(!vis[to[i]]) { nowans=max(dfs(to[i],deep+1),nowans); } return nowans; } void color(int now,int c,int nowdeep,int topdeep) { vis[now]=c; if(nowdeep==topdeep) { return; } for(int i=head[now];i;i=next[i]) if(!vis[to[i]]) { color(to[i],c,nowdeep+1,topdeep); } } int main() { scanf("%d",&n); for(int i=1;i<n;++i) { scanf("%d%d",&u,&v); add(u,v); add(v,u); } int maxdeep=dfs(1,0); memset(vis,0,sizeof vis); color(1,1,0,maxdeep/2); color(n,2,0,n*2); for(int i=1;i<=n;++i) if(vis[i]==2) ans++; if(ans>=(n-ans)) { printf("Snuke"); } else printf("Fennec"); return 0; }
a.cc: In function 'void add(int, int)': a.cc:10:9: error: reference to 'next' is ambiguous 10 | next[++num]=head[u]; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:7:29: note: 'int next [200005]' 7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v; | ^~~~ a.cc: In function 'int dfs(int, int)': a.cc:19:33: error: reference to 'next' is ambiguous 19 | for(int i=head[now];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:7:29: note: 'int next [200005]' 7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v; | ^~~~ a.cc: In function 'void color(int, int, int, int)': a.cc:33:33: error: reference to 'next' is ambiguous 33 | for(int i=head[now];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:7:29: note: 'int next [200005]' 7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v; | ^~~~
s454520716
p03662
C++
//QWsin #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int maxn=100000+10; const int maxm=200000+10; struct Edge{int u,v;Edge(int u=0,int v=0):u(u),v(v){}}e[maxn]; int first[maxn],next[maxm],ecnt; inline void add_edge(int u,int v){ next[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v); next[ecnt]=first[v];first[v]=ecnt;e[ecnt++]=Edge(v,u); } int sz[maxn],fa[maxn],opp,cur; int n; int dfs(int u,int pre,int dep) { if(u==n){ opp=(dep+1)/2; cur=u; for(int j=dep;j>opp+1;--j) cur=fa[cur]; } sz[u]=1; for(int i=first[u];i!=-1;i=next[i]) { int v=e[i].v; if(v!=pre) sz[u]+=dfs(v,u,dep+1); } return sz[u]; } int main() { cin>>n;memset(first,-1,sizeof first); for(int i=1,u,v;i<=n;++i) { cin>>u>>v; add_edge(u,v); } dfs(1,1,1); puts(sz[cur] >= n - sz[cur] ? "Snuke":"Fennec"); return 0; }
a.cc: In function 'void add_edge(int, int)': a.cc:15:9: error: reference to 'next' is ambiguous 15 | next[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v); | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:4: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:13:17: note: 'int next [200010]' 13 | int first[maxn],next[maxm],ecnt; | ^~~~ a.cc:16:9: error: reference to 'next' is ambiguous 16 | next[ecnt]=first[v];first[v]=ecnt;e[ecnt++]=Edge(v,u); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:13:17: note: 'int next [200010]' 13 | int first[maxn],next[maxm],ecnt; | ^~~~ a.cc: In function 'int dfs(int, int, int)': a.cc:32:36: error: reference to 'next' is ambiguous 32 | for(int i=first[u];i!=-1;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:13:17: note: 'int next [200010]' 13 | int first[maxn],next[maxm],ecnt; | ^~~~
s723726887
p03662
C++
#include <cstdio> #include <iostream> #include <cstdlib> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; const int N=200010; int e[N],next[N],head[N],ed=0; void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;} int p[N],isr[N],cnt=0,sum=0,n; bool dfs(int x,int fa){ if(x==n){p[++cnt]=x;return true;} for(int i=head[x];i;i=next[i]) if(e[i]!=fa&&dfs(e[i],x)){ p[++cnt]=x; return true; } return false; } void dfs2(int x,int fa){ sum++; for(int i=head[x];i;i=next[i]) if(e[i]!=fa&&!isr[e[i]]) dfs2(e[i],x); } int main(){ int i,x,y; scanf("%d",&n); for(i=1;i<n;i++){ scanf("%d %d",&x,&y); adde(x,y); adde(y,x); } dfs(1,0); for(i=1;i<=cnt;i++) isr[p[i]]=1; for(i=1;i<=cnt/2;i++) dfs2(p[i],0); if(sum*2<n) printf("Fennec\n"); else printf("Snuke\n"); return 0; }
a.cc: In function 'void adde(int, int)': a.cc:11:34: error: reference to 'next' is ambiguous 11 | void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;} | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:10:10: note: 'int next [200010]' 10 | int e[N],next[N],head[N],ed=0; | ^~~~ a.cc: In function 'bool dfs(int, int)': a.cc:15:27: error: reference to 'next' is ambiguous 15 | for(int i=head[x];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:10:10: note: 'int next [200010]' 10 | int e[N],next[N],head[N],ed=0; | ^~~~ a.cc: In function 'void dfs2(int, int)': a.cc:24:27: error: reference to 'next' is ambiguous 24 | for(int i=head[x];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:10:10: note: 'int next [200010]' 10 | int e[N],next[N],head[N],ed=0; | ^~~~
s192938317
p03662
C++
def spaceinput(): return list(map(int,input().split(" "))) def f(c): return abs(sum(aa[:c])-sum(aa[c:])) N=int(input()) aa=spaceinput() l=0 r=len(aa)-1 vl=f(l+1) vr=f(r) while True: c=int((l+r)/2) if c==0: c+=1 vc=f(c) if vl >vc: l=c vl=vc elif vr >vc: r=c vr=vc else: break print(f(c))
a.cc:2:1: error: 'def' does not name a type 2 | def spaceinput(): | ^~~
s725753270
p03662
C++
#include<bits/stdc++.h> using namespace std; const int maxi=1e6; int lev,rez,n,sum,x,y; vector<int> v[maxi]; int pr[maxi]; void dfs(int x, int pred) { lev++; sum++; pr[x]=pred; if (x==n) rez=lev; for (int i:v[x]) if (i!=pred) dfs(i,x); lev--; } int main() { cin>>n; for (int i=1;i<n;i++) { scanf("%d%d",&x,&y); v[x].push_back(y); v[y].push_back(x); } dfs(1,0); rez-=2; rez/=2; while(rez>0) { x=pr[x]; rez--; } sum=0; dfs(x,pr[x]); #include<bits/stdc++.h> using namespace std; const int maxi=1e6; int lev,rez,n,sum,x,y; vector<int> v[maxi]; int pr[maxi]; void dfs(int x, int pred) { lev++; sum++; pr[x]=pred; if (x==n) rez=lev; for (int i:v[x]) if (i!=pred) dfs(i,x); lev--; } int main() { cin>>n; for (int i=1;i<n;i++) { scanf("%d%d",&x,&y); v[x].push_back(y); v[y].push_back(x); } dfs(1,0); rez-=2; rez/=2; while(rez>0) { x=pr[x]; rez--; } sum=0; dfs(x,pr[x]); if (sum>n-sum) printf("Fennec\n"); else printf("Snuke\n"); return 0; } if (sum>n-sum) printf("Fennec\n"); else printf("Snuke\n"); return 0; }
a.cc: In function 'int main()': a.cc:57:1: error: a function-definition is not allowed here before '{' token 57 | { | ^ a.cc:69:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 69 | int main() | ^~ a.cc:69:9: note: remove parentheses to default-initialize a variable 69 | int main() | ^~ | -- a.cc:69:9: note: or replace parentheses with braces to value-initialize a variable a.cc:70:1: error: a function-definition is not allowed here before '{' token 70 | { | ^
s313724219
p03662
C++
def spaceinput(): return list(map(int,input().split(" "))) def f(c): return abs(sum(aa[:c])-sum(aa[c:])) N=int(input()) aa=spaceinput() l=0 r=len(aa)-1 vl=f(l+1) vr=f(r) while True: c=int((l+r)/2) if c==0: c+=1 vc=f(c) if vl >vc: l=c vl=vc elif vr >vc: r=c vr=vc else: break print(f(c))
a.cc:2:1: error: 'def' does not name a type 2 | def spaceinput(): | ^~~
s019207403
p03663
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define poly vector<ll> #define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++) #define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--) #define pb push_back inline char gc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++; } #define gc getchar inline ll read(){ ll x=0;char ch=gc();bool positive=1; for(;!isdigit(ch);ch=gc()) if(ch=='-') positive=0; for(;isdigit(ch);ch=gc()) x=x*10+ch-'0'; return positive?x:-x; } inline void write(ll x){ if(x<0){ x=-x;putchar('-'); } if(x>=10) write(x/10); putchar('0'+x%10); } inline void writeln(ll x){write(x);puts("");} inline void writep(ll x){write(x);putchar(' ');} inline ull rnd(){ return ((ull)rand()<<30^rand())<<4|rand()%4; } const int N=10; int a[N]; char s[N]; int void query(ll x){ printf("? %lld\n",x); fflush(stdout);scanf("%s",s); } int main(){ ll ssw=0; For(i,1,10){ int ksg=-1; For(j,(i==1),9){ query(ssw*10+j); if(s[0]=='N'){ ksg=j-1;break; } } if(ksg==-1){ ll mjn=ssw,sana=1;ll lny=0; if(i==1){ mjn=1;bool d=0; For(j,1,18){ mjn*=10;query(mjn);lny++; if(s[0]=='N'){ d=1;break; } } if(d==0){ ssw=1;break; } if(lny>=2) ssw=ssw*10+9; else{ For(j,1,9){ query(j*10); if(s[0]=='Y'){ ssw=j;break; } } break; } }else{ bool d=0; For(j,1,18){ if(mjn>1e17) break; mjn*=10;query(mjn);lny++; if(s[0]=='N'){ d=1;break; } sana*=10; } if(d==0){ ssw*=10;break; } if(lny==2){ For(j,1,9){ query(mjn+j*10); if(s[0]=='Y'){ ssw=ssw*10+j;break; } } break; }else ssw=ssw*10+9; } }else ssw=ssw*10+ksg; } printf("! %lld",ssw); }
a.cc:40:1: error: two or more data types in declaration of 'query' 40 | int | ^~~ a.cc: In function 'int main()': a.cc:50:25: error: 'query' was not declared in this scope 50 | query(ssw*10+j); | ^~~~~ a.cc:60:49: error: 'query' was not declared in this scope 60 | mjn*=10;query(mjn);lny++; | ^~~~~ a.cc:71:49: error: 'query' was not declared in this scope 71 | query(j*10); | ^~~~~ a.cc:82:49: error: 'query' was not declared in this scope 82 | mjn*=10;query(mjn);lny++; | ^~~~~ a.cc:93:49: error: 'query' was not declared in this scope 93 | query(mjn+j*10); | ^~~~~
s051336489
p03663
C++
#include <bits/stdc++.h> using namespace std; typedef int64_t llo; #define mp make_pair #define pb push_back #define a first #define b second llo coo=0; llo ask(llo aa){ coo+=1; if(coo==65){ while(true){ continue; } } cout<<"? "<<aa<<endl; char x; cin>>x; if(x=='Y'){ return 1; } else{ return 0; } } llo pre[13]; llo pre2[13]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); llo pp=1; llo ind=0; pre[0]=1; for(llo i=1;i<13;i++){ pre[i]=pre[i-1]*(llo)10; } pre2[0]=9; for(llo i=1;i<13;i++){ pre2[i]=pre2[i-1]+9*pre[i]; } for(llo i=1;i<11;i++){ if(ask(pp)){ ind=max(ind,i); } else{ break; } pp*=10; } if(ind==10){ llo num=1; if(ask(9)){ cout<<"! "<<1<<endl; return 0; } for(llo i=1;i<10;i++){ num*=10; if(ask(num+pre[i-1]*9)){ cout<<"! "<<(num)<<endl; return 0; } } } else{ llo num=0; for(llo i=0;i<ind;i++){ llo low=0; llo high=9; /*if(ask(num+pre[ind-i]*9)){ num+=9*pre[ind-i]; continue; }*/ while(low<high-1){ llo mid=(low+high)/2; if(ask(num+pre[ind-i]*mid+pre2[ind-i-1])){ high=mid; } else{ low=mid+1; } } llo ans=9; for(int i=low;i<high+1;i++){ // if() /*} if(low!=high){*/ if(ask(num+pre[ind-i]*i+pre2[ind-i-1])){ ans=min(ans,i); } } num+=(pre[ind-i]*(ans)); } cout<<"!"<<" "<<(num)/(llo)10<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:91:48: error: no matching function for call to 'min(llo&, int&)' 91 | ans=min(ans,i); | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:91:48: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') 91 | ans=min(ans,i); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:91:48: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 91 | ans=min(ans,i); | ~~~^~~~~~~
s001973498
p03663
C++
.
a.cc:1:1: error: expected unqualified-id before '.' token 1 | . | ^