submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s428228595 | p03660 | C++ | #include <iostream>
#include <ostream>
#include <istream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <vector>
#include <set>
#define pb push_back
#define ppb pop_back
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define for1(i, n) for (int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"
#define pi 3.1415926535897932
#define NMAX 100005
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod=1e9+7;
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);
forn(i,n-1) {
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;
forn(u,n)if(d1[u]<=d2[u])n1++;
else n2++;
cout<<(n1>n2?"Fennec":"Snuke")<<endl;
return 0;
}
| a.cc:35:15: error: 'INT_MAX' was not declared in this scope
35 | const int INF=INT_MAX/2;
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <set>
+++ |+#include <climits>
18 | #define pb push_back
|
s961715508 | p03660 | C++ | #include <iostream>
#include <ostream>
#include <istream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <vector>
#include <set>
#define pb push_back
#define ppb pop_back
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define for1(i, n) for (int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"
#define pi 3.1415926535897932
#define NMAX 100005
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod=1e9+7;
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);
forn(i,n-1) {
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);
int n1=0,n2=0;
forn(u,n)if(d1[u]<=d2[u])n1++;
else n2++;
cout<<(n1>n2?"Fennec":"Snuke")<<endl;
return 0;
}
| a.cc:35:15: error: 'INT_MAX' was not declared in this scope
35 | const int INF=INT_MAX/2;
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <set>
+++ |+#include <climits>
18 | #define pb push_back
|
s638884563 | p03660 | C++ | #include <iostream>
#include <ostream>
#include <istream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <vector>
#include <set>
#define pb push_back
#define ppb pop_back
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define for1(i, n) for (int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"
#define pi 3.1415926535897932
#define NMAX 100005
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod=1e9+7;
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);
forn(i,n-1) {
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);
int n1=0,n2=0;
forn(u,n)if(d1[u]<=d2[u])n1++;
else n2++;
cout<<(n1>n2?"Fennec":"Snuke")<<endl;
return 0;
}
| a.cc:35:15: error: 'INT_MAX' was not declared in this scope
35 | const int INF=INT_MAX/2;
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <set>
+++ |+#include <climits>
18 | #define pb push_back
|
s354001475 | p03660 | C++ | #include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
const int SIZE=100005;
vector<int> mp[SIZE];
int color[SIZE],dist[SIZE],dist2[SIZE];
void bfs(int s,int dist[]){
queue<int> que;
que.push(s);
while(!que.empty()){
int u=que.front();
que.pop();
for(int i=0;i<mp[u].size();i++){
int t=mp[u][i];
if(dist[t] || t==s) continue;
dist[t]=dist[u]+1;
que.push(t);
}
}
}
int main(){
int n;
scanf("%d",&n);
for(int i=0,a,b;i<n-1;i++){
scanf("%d%d",&a,&b)
a--;
b--;
mp[a].push_back(b);
mp[b].push_back(a);
}
bfs(0,dist);
bfs(n-1,dist2);
int s=0,f=0;
for(int i=0;i<n;i++){
if(dist[i]<=dist2[i]) f++; else s++;
}
if(s>=f){
puts("Snuke");
}
else{
puts("Fennec");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:42:36: error: expected ';' before 'a'
42 | scanf("%d%d",&a,&b)
| ^
| ;
43 | a--;
| ~
|
s933697954 | p03660 | 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 <map>
#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 <tuple>
#include <conio.h>
#include <numeric>
#include <list>
#include <windows.h>
#include <cfloat>
#include <climits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
const int INF=1000000007;
vector<int> g[100005];
int dist1[100005],dist2[100005];
int main()
{
int n;
cin>>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);
}
for(int i=0;i<n;i++)
dist1[i]=INF,dist2[i]=INF;
queue<int> q;
q.push(0);
dist1[0]=0;
while(!q.empty())
{
int f=q.front();
q.pop();
for(int i=0;i<g[f].size();i++)
{
int s=g[f][i];
if(dist1[s]==INF)
{
dist1[s]=dist1[f]+1;
q.push(s);
}
}
}
q.push(n-1);
dist2[n-1]=0;
while(!q.empty())
{
int f=q.front();
q.pop();
for(int i=0;i<g[f].size();i++)
{
int s=g[f][i];
if(dist2[s]==INF)
{
dist2[s]=dist2[f]+1;
q.push(s);
}
}
}
int s1=0,s2=0;
for(int i=0;i<n;i++)
if(dist1[i]<=dist2[i])
s1++;
else
s2++;
if(s1>s2)
cout<<"Fennec"<<endl;
else
cout<<"Snuke"<<endl;
return 0;
} | a.cc:55:10: fatal error: conio.h: No such file or directory
55 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s274882045 | p03660 | C++ | #include <iostream>
#include <ostream>
#include <istream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <vector>
#include <set>
#define pb push_back
#define ppb pop_back
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define for1(i, n) for (int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"
#define pi 3.1415926535897932
#define NMAX 100005
#define INF 1000000009
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
bool absd[100001][100001];
int ab[100001];
int n;
bool b[100001];
int at[100001];
int v;
int bfs(int t) {
v=t;
if(t==0)
return o;
int f=1;
for(int i=0; i<n; i++) {
if(absd[i][t]==1&&!b[i])f=0,at[v]=++o;
}
if(f) {
b[t]=1;
v=2,o=0;
return bfs(1);
}
}
int check(int y);
{
int ans=0;
if(at[y]==0) {
for(int i=0; i<n; i++) {
if(absd[i][y]==0&&at[i]==0)ans++,y=i;
}
}
return ans;
}
int main() {
at[1]=1;
int n;
for(int i=0; i<n; i++) {
int a,b;
cin>>a>>b;
if(a>b)
absd[b][a]=true;
else
absd[a][b]=true;
}
ab[0]=2;
ab[1]=3;
int ast=bfs(2);
int d1=0,d2=1;
int q=2,i=0;
int h=1;
while(true) {
if(!i) {
for(int j=0; j<n; j++) {
if(absd[j][d1]&&!at[j]&&check(j)>ast-q)cout<<"Fennec",return 0;
}
for(int j=0;j<n;j++)
{
if(at[j]==q-2&&ab[j]==3&&!check(j))cout<<"Snuke",return 0;
else if(at[j]==q-2&&ab[j]!=2&&ab[j]!=3)ab[j]=2,i++,q++;
}
}
else{
for(int j=0; j<n; j++) {
if(absd[j][d1]&&!at[j]&&check(j)>ast-q)cout<<"Snuke",return 0;
}
for(int j=0;j<n;j++)
{
if(at[j]==q-2&&ab[j]==3&&!check(j))cout<<"Fennec",return 0;
else if(at[j]==q-2&&ab[j]!=2&&ab[j]!=3)ab[j]=3,i--,q++;
}
}
if(ast-q==0)h=0,break;
}
if(h==0)
cout<<"Snuke"
return 0;
} | a.cc: In function 'int bfs(int)':
a.cc:44:24: error: 'o' was not declared in this scope
44 | return o;
| ^
a.cc:47:53: error: 'o' was not declared in this scope
47 | if(absd[i][t]==1&&!b[i])f=0,at[v]=++o;
| ^
a.cc:51:21: error: 'o' was not declared in this scope
51 | v=2,o=0;
| ^
a.cc: At global scope:
a.cc:56:1: error: expected unqualified-id before '{' token
56 | {
| ^
a.cc: In function 'int main()':
a.cc:85:87: error: expected primary-expression before 'return'
85 | if(absd[j][d1]&&!at[j]&&check(j)>ast-q)cout<<"Fennec",return 0;
| ^~~~~~
a.cc:89:82: error: expected primary-expression before 'return'
89 | if(at[j]==q-2&&ab[j]==3&&!check(j))cout<<"Snuke",return 0;
| ^~~~~~
a.cc:95:86: error: expected primary-expression before 'return'
95 | if(absd[j][d1]&&!at[j]&&check(j)>ast-q)cout<<"Snuke",return 0;
| ^~~~~~
a.cc:99:83: error: expected primary-expression before 'return'
99 | if(at[j]==q-2&&ab[j]==3&&!check(j))cout<<"Fennec",return 0;
| ^~~~~~
a.cc:103:33: error: expected primary-expression before 'break'
103 | if(ast-q==0)h=0,break;
| ^~~~~
a.cc:106:25: error: expected ';' before 'return'
106 | cout<<"Snuke"
| ^
| ;
107 | return 0;
| ~~~~~~
|
s353324767 | p03660 | C++ | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
bool used[N];
vector<int> g[N];
ll d[N];
void dfs(int u){
if(used[u]) return;
used[u] = true;
for(auto v: g[u]) dfs(v);
}
int main(){
int n;
cin>>n;
rep(i, n){
int a, b;
cin>>a>>b;
a--; b--;
g[a].pb(b);
g[b].pb(a);
}
dfs(a);
cout<<(d[b]%2?"Snuke":"Fennec")<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:60:13: error: 'a' was not declared in this scope
60 | dfs(a);
| ^
a.cc:61:18: error: 'b' was not declared in this scope
61 | cout<<(d[b]%2?"Snuke":"Fennec")<<endl;
| ^
|
s945355783 | p03660 | C++ | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#define reg register
#define LL long long
#define cmin(a,b) ((a)<(b)?(a):(b))
#define cmax(a,b) ((a)>(b)?(a):(b))
const int MaxN = 100010;
struct Data{
int Next, To;
}Tree[MaxN*2];
int Last[MaxN], T, N, Cnt, Dis_S[MaxN], Dis_T[MaxN];
bool Vis[MaxN];
inline int Read()
{
reg int aa;reg char ch;while(ch=getchar(),ch<'0'||ch>'9'); aa=ch-'0';
while(ch=getchar(),ch>='0'&&ch<='9') aa=(aa<<1)+(aa<<3)+ch-'0'; return aa;
}
inline void Insert(reg int u, reg int v)
{
Tree[++Cnt].To = v;
Tree[Cnt].Next = Last[u];
Last[u] = Cnt;
}
inline void Dfs(reg int Node,reg int dep, reg int* Dis)
{
//printf("%d\n", Node);
Vis[Node] = 1;
for(reg int x = Last[Node]; x; x = Tree[x].Next)
{
reg int y = Tree[x].To;
// printf("To : %d Vis : %d\n", y, Vis[y]);
if(!Vis[y])
{
Dis[y] = dep;
Dfs(y, dep+1, Dis);
}
}
}
int main()
Cnt = 0;
N = Read();
for(reg int i = 1; i < N; ++i)
{
reg int a, b;
a = Read(), b = Read();
Insert(a, b);
Insert(b, a);
}
Dis_S[0] = Dis_T[N] = 0;
Dfs(1, 1, Dis_S);
memset(Vis, 0, sizeof(Vis));
Dfs(N, 1, Dis_T);
Cnt = 0;
// for(reg int i = 1; i <= N; ++i)
// printf("DisS[%d] = %d, DisT[%d] = %d\n", i, Dis_S[i], i, Dis_T[i]);
for(reg int i = 1; i <= N; ++i)
Dis_S[i] <= Dis_T[i] ? ++Cnt : --Cnt;
Cnt > 0 ? puts("Fennec") : puts("Snuke");
return 0;
} | a.cc: In function 'int Read()':
a.cc:24:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | reg int aa;reg char ch;while(ch=getchar(),ch<'0'||ch>'9'); aa=ch-'0';
| ^~
a.cc:24:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | reg int aa;reg char ch;while(ch=getchar(),ch<'0'||ch>'9'); aa=ch-'0';
| ^~
a.cc: At global scope:
a.cc:28:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | inline void Insert(reg int u, reg int v)
| ^
a.cc:28:39: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | inline void Insert(reg int u, reg int v)
| ^
a.cc:35:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
35 | inline void Dfs(reg int Node,reg int dep, reg int* Dis)
| ^~~~
a.cc:35:38: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
35 | inline void Dfs(reg int Node,reg int dep, reg int* Dis)
| ^~~
a.cc:35:52: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
35 | inline void Dfs(reg int Node,reg int dep, reg int* Dis)
| ^~~
a.cc: In function 'void Dfs(int, int, int*)':
a.cc:39:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
39 | for(reg int x = Last[Node]; x; x = Tree[x].Next)
| ^
a.cc:41:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
41 | reg int y = Tree[x].To;
| ^
a.cc: At global scope:
a.cc:53:9: error: expected initializer before 'Cnt'
53 | Cnt = 0;
| ^~~
a.cc:54:9: error: 'N' does not name a type
54 | N = Read();
| ^
a.cc:55:9: error: expected unqualified-id before 'for'
55 | for(reg int i = 1; i < N; ++i)
| ^~~
a.cc:55:28: error: 'i' does not name a type
55 | for(reg int i = 1; i < N; ++i)
| ^
a.cc:55:35: error: expected unqualified-id before '++' token
55 | for(reg int i = 1; i < N; ++i)
| ^~
a.cc:62:9: error: 'Dis_S' does not name a type
62 | Dis_S[0] = Dis_T[N] = 0;
| ^~~~~
a.cc:63:12: error: expected constructor, destructor, or type conversion before '(' token
63 | Dfs(1, 1, Dis_S);
| ^
a.cc:64:15: error: expected constructor, destructor, or type conversion before '(' token
64 | memset(Vis, 0, sizeof(Vis));
| ^
a.cc:65:12: error: expected constructor, destructor, or type conversion before '(' token
65 | Dfs(N, 1, Dis_T);
| ^
a.cc:66:9: error: 'Cnt' does not name a type; did you mean 'int'?
66 | Cnt = 0;
| ^~~
| int
a.cc:69:9: error: expected unqualified-id before 'for'
69 | for(reg int i = 1; i <= N; ++i)
| ^~~
a.cc:69:28: error: 'i' does not name a type
69 | for(reg int i = 1; i <= N; ++i)
| ^
a.cc:69:36: error: expected unqualified-id before '++' token
69 | for(reg int i = 1; i <= N; ++i)
| ^~
a.cc:71:9: error: 'Cnt' does not name a type; did you mean 'int'?
71 | Cnt > 0 ? puts("Fennec") : puts("Snuke");
| ^~~
| int
a.cc:72:9: error: expected unqualified-id before 'return'
72 | return 0;
| ^~~~~~
a.cc:73:2: error: expected declaration before '}' token
73 | }
| ^
|
s366364745 | p03660 | C++ | #include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>
#include <set>
#include <cmath>
#include <functional>
#include <numeric>
using namespace std;
int n;
int color[100001];
vector <int> adj[100001];
int depth[2][100001];
const int INF = 210000000;
void bfs()
{
queue <int> que;
memset(depth, INF, sizeof(depth));
//first fennce
que.push(1);
depth[0][1] = 0;
while (!que.empty())
{
int a = que.front();
que.pop();
for (int i = 0; i < adj[a].size(); i++)
{
if (depth[0][adj[a][i]] == INF)
{
depth[0][adj[a][i]] = depth[0][a] + 1;
que.push(adj[a][i]);
}
}
}
//second
que.push(n);
depth[1][n] = 0;
while (!que.empty())
{
int a = que.front();
que.pop();
for (int i = 0; i < adj[a].size(); i++)
{
if (depth[1][adj[a][i]] == INF)
{
depth[1][adj[a][i]] = depth[1][a] + 1;
que.push(adj[a][i]);
}
}
}
}
int main()
{
int a, b;
int f = 0, s = 0;
cin >> n;
for (int i = 0; i < n - 1; i++)
{
cin >> a >> b;
adj[a].push_back(b);
adj[b].push_back(a);
}
bfs();
for (int i = 1; i <= n; i++)
{
if (depth[0][i] <= depth[1][i])
{
f++;
}
else
{
s++;
}
}
if (f > s)
{
cout << "Fennec" << endl;
}
else
{
cout << "Snuke" << endl;
}
return 0;
} | a.cc: In function 'void bfs()':
a.cc:27:9: error: 'memset' was not declared in this scope
27 | memset(depth, INF, sizeof(depth));
| ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
13 | #include <numeric>
+++ |+#include <cstring>
14 |
|
s001075297 | p03660 | C++ | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define REP(i, n) for(int i=0; i<n; i++)
typedef pair<int, int> pii;
const int max_n = 10e5;
int INF = 10e8;
struct edge{
int to, cost;
};
int d[max_n];
int n;
vector<edge> g[max_n];
vector<int> spath;
int pre[max_n];
void dijkstra(int s){
priority_queue<pii, vector<pii>, greater<pii> > que;
fill(d, d+n, INF);
fill(pre, pre+n, -1);
d[s] = 0;
que.push(pii(0, s));
while(!que.empty()){
pii p = que.top();
que.pop();
int v = p.second;
if(d[v]<p.first) continue;
REP(i, g[v].size()){
edge e = g[v][i];
if(d[e.to] > d[v]+e.cost){
d[e.to] = d[v]+e.cost;
que.push(pii(d[e.to], e.to));
pre[e.to] = v;
}
}
}
}
vector<int> get_path(int t){
vector<int> path;
while(t!=-1){
path.push_back(t);
t = pre[t];
}
reverse(path.begin(), path.end());
return path;
}
int node_size(int v){
int sum = 0;
bool used[max_n];
REP(i, n) used[i] = false;
REP(i, spath.size()){
used[spath[i]] = true;
}
queue<int> que;
que.push(v);
while(!que.empty()){
int p = que.front();
que.pop();
REP(i, g[p].size()){
edge e = g[p][i];
if(!used[e.to]){
sum += 1;
que.push(e.to);
used[e.to] = true;
}
}
}
return sum;
}
int main(){
cin >> n;
REP(i, n) g[i].clear();
REP(i, n-1){
int a, b;
cin >> a >> b;
a = a-1;
b = b-1;
edge e;
e.to = b;
e.cost = 1;
g[a].push_back(e);
e.to = a;
g[b].push_back(e);
}
dijkstra(0);
spath = get_path(n-1);
int fe = 0;
int su = 0;
int meet;
vector<int> medge;
if(spath.size()%2==0){
meet = spath.size()/2;
} else {
meet = spath.size()/2 + 1;
}
fe += meet;
su = spath.size() - meet;
REP(i, spath.size()){
if(i<meet){
fe += node_size(spath[i]);
} else {
su += node_size(spath[i]);
}
}
if(fe>su){
cout << "Fennec" << endl;
} else {
cout << "Snuke" << endl;
}
}
| a.cc: In function 'std::vector<int> get_path(int)':
a.cc:54:5: error: 'reverse' was not declared in this scope
54 | reverse(path.begin(), path.end());
| ^~~~~~~
|
s455707476 | p03660 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
int N;
vector <pii> ab;
int res;
bool flag[100100]={0};
int F=0, S=0, SF=0;
int graph[100100]={0};
void rec(int n, int m, int gl){
if(gl==n){
return;
}
flag[n]=true;
graph[n]+=m;
for(int i=0;i<N;i++){
if(!flag[ab[i].second]&&ab[i].first==n){
rec(ab[i].second, m, gl);
}
else if(!flag[ab[i].first]&&ab[i].second==n){
rec(ab[i].first, m, gl);
}
}
}
int main(){
cin>>N;
for(int i=0;i<N-1;i++){
int aa, bb;
cin>>aa>>bb;
if(aa<bb){
ab.push_back(make_pair(aa, bb));
}
else{
ab.push_back(make_pair(bb, aa));
}
}
rec(1, 1, N);
for(int i=0;i<=N;i++){
flag[i]=false;
}
rec(N, 2, 1);
for(int i=2;i<=N-1;i++){
//cout<<graph[i]<<" ";
if(graph[i]==1){
F++;
}
else if(graph[i]==2){
S++;
}
else if(graph[i]==3){
SF++;
}
}
//cout<<endl;
//cout<<S<<":"<<F<<":"<<SF<<endl;
if(SF%2!=0){
F++;
}
if(F>=S){
cout<<"Fennec"<<endl;
}
else{
cout<<"Snuke"<<endl;
}
return 0;
| a.cc: In function 'int main()':
a.cc:70:18: error: expected '}' at end of input
70 | return 0;
| ^
a.cc:30:11: note: to match this '{'
30 | int main(){
| ^
|
s111848465 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5+10;
struct edge {
int to, next;
}ed[MAXN << 1];
int head[MAXN], cnt;
void addedge(int u, int v) {
ed[cnt].to = v;
ed[cnt].next = head[u];
head[u] = cnt++;
}
int sz[MAXN], fa[MAXN], dep[MAXN];
void dfs(int u, int pre) {
sz[u] = 1;
dep[u] = dep[pre] + 1;
fa[u] = pre;
for ( int i = head[u]; i != -1; i = ed[i].next ) {
int v = ed[i].to;
if ( v != pre ) {
dfs(v, u);
sz[u] += sz[v];
}
}
}
int main() {
memset(head, -1, sizeof(head));
int n;
cin >> n;
for ( int i = 1; i < n; i++ ) {
int u, v;
cin >> u >> v;
addedge(u, v);
addedge(v, u);
}
dfs(1, 0);
int d = (dep[n] - 2) / 2;
int ans = n;
while ( d ) {
d--;
ans = fa[ans];
}
if ( sz[ans] * 2 >= n ) cout << "Snuke" << endl;
else cout << "Fennec" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:37:5: error: 'memset' was not declared in this scope
37 | memset(head, -1, sizeof(head));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdlib>
+++ |+#include <cstring>
6 | using namespace std;
|
s606907753 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5+10;
struct edge {
int to, next;
}ed[MAXN << 1];
int head[MAXN], cnt;
void addedge(int u, int v) {
ed[cnt].to = v;
ed[cnt].next = head[u];
head[u] = cnt++;
}
int sz[MAXN], fa[MAXN], dep[MAXN];
void dfs(int u, int pre) {
sz[u] = 1;
dep[u] = dep[pre] + 1;
fa[u] = pre;
for ( int i = head[u]; i != -1; i = ed[i].next ) {
int v = ed[i].to;
if ( v != pre ) {
dfs(v, u);
sz[u] += sz[v];
}
}
}
int main() {
memset(head, -1, sizeof(head));
int n;
cin >> n;
for ( int i = 1; i < n; i++ ) {
int u, v;
cin >> u >> v;
addedge(u, v);
addedge(v, u);
}
dfs(1, 0);
int d = (dep[n] - 2) / 2;
int ans = n;
while ( d ) {
d--;
ans = fa[ans];
}
if ( sz[ans] * 2 >= n ) cout << "Snuke" << endl;
else cout << "Fennec" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:37:5: error: 'memset' was not declared in this scope
37 | memset(head, -1, sizeof(head));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdlib>
+++ |+#include <cstring>
6 | using namespace std;
|
s321065945 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5+10;
struct edge {
int to, next;
}ed[MAXN << 1];
int head[MAXN], cnt;
void addedge(int u, int v) {
ed[cnt].to = v;
ed[cnt].next = head[u];
head[u] = cnt++;
}
int sz[MAXN], fa[MAXN], dep[MAXN];
void dfs(int u, int pre) {
sz[u] = 1;
dep[u] = dep[pre] + 1;
fa[u] = pre;
for ( int i = head[u]; i != -1; i = ed[i].next ) {
int v = ed[i].to;
if ( v != pre ) {
dfs(v, u);
sz[u] += sz[v];
}
}
}
int main() {
memset(head, -1, sizeof(head));
int n;
cin >> n;
for ( int i = 1; i < n; i++ ) {
int u, v;
cin >> u >> v;
addedge(u, v);
addedge(v, u);
}
dfs(1, 0);
int d = (dep[n] - 2) / 2;
int ans = n;
while ( d ) {
d--;
ans = fa[ans];
}
if ( sz[ans] * 2 >= n ) cout << "Snuke" << endl;
else cout << "Fennec" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:36:5: error: 'memset' was not declared in this scope
36 | memset(head, -1, sizeof(head));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <stack>
+++ |+#include <cstring>
5 | using namespace std;
|
s228776207 | p03660 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Map<Integer, Set<Integer>> graph = new HashMap<>(n);
for (int i = 1; i <= n; i++) {
graph.put(i, new HashSet<>());
}
for (int r = 0; r < n - 1; r++) {
int a = sc.nextInt();
int b = sc.nextInt();
graph.get(a).add(b);
graph.get(b).add(a);
}
boolean[] claimedCache = new boolean[n + 1];
Deque<List<Integer>> queue = new Deque<>();
queue.addLast(Arrays.asList(1, 1));
claimedCache[1] = true;
queue.addLast(Arrays.asList(n, -1));
claimedCache[n] = true;
int fennecCount = 1;
int snukeCount = 1;
while (!queue.isEmpty()) {
List<Integer> data = queue.removeFirst();
int nodeId = data.get(0);
int colorId = data.get(1);
for (Integer neighbor : graph.get(nodeId)) {
if (!claimedCache[neighbor]) {
claimedCache[neighbor] = true;
if (colorId == 1) {
fennecCount++;
}
else {
snukeCount++;
}
queue.addLast(Arrays.asList(neighbor, colorId));
}
}
}
System.out.println((fennecCount > snukeCount) ? "Fennec" : "Snuke");
}
}
| Main.java:21: error: Deque is abstract; cannot be instantiated
Deque<List<Integer>> queue = new Deque<>();
^
1 error
|
s180586551 | p03660 | C++ | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
typedef long long ll;
int n, m;
vector<int> graph[100001];
int fennec, snuke;
bool visited[100001];
void dfsSnuke(int node, int prev){
if(node == 0)return;
visited[node] = true;
snuke ++;
for(int i =0 ; i < graph[node].size(); i ++){
int sosed = graph[node][i];
if(sosed == prev)continue;
dfsSnuke(sosed, node);
}
}
void dfsFennec(int node, int prev){
if(visited[node] && node != 0)return;
fennec ++;
for(int i =0; i < graph[node].size(); i ++){
int sosed = graph[node][i];
if(sosed == prev)continue;
dfsFennec(sosed, node);
}
}
int main(int argc, const char * argv[]) {
ios_base::sync_with_stdio(false);
cin >> n;
int a, b;
for(int i =0 ; i < n - 1; i ++){
cin >> a >> b;
a --;
b --;
graph[a].push_back(b);
graph[b].push_back(a);
}
fennec = snuke = 0;
memset(visited, false, sizeof visited);
dfsSnuke(n - 1, -1);
dfsFennec(0, -1);
fennec --;
snuke --;
// cout << fennec << " " << snuke << endl;
if(fenec == snuke){
if(fennec % 2 == 1)puts("Fennec");
else puts("Snuke") ;
return 0;
}
if(fennec < snuke)puts("Snuke");
else puts("Fennec");
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:47:8: error: 'fenec' was not declared in this scope; did you mean 'fennec'?
47 | if(fenec == snuke){
| ^~~~~
| fennec
|
s600797973 | p03660 | C++ | int d[2][100000];
vector <int> v[100000];
void dfs(int x, int y, int z, int w) {
int i;
d[w][x] = z;
for (i = 0; i < v[x].size(); i++) {
if (v[x][i] == y) continue;
dfs(v[x][i], x, z + 1, w);
}
}
int main() {
int n, c1 = 0, c2 = 0, i;
scanf("%d", &n);
for (i = 0; i < n - 1; i++) {
int x, y;
scanf("%d %d", &x, &y);
x--;
y--;
v[x].push_back(y);
v[y].push_back(x);
}
dfs(0, -1, 0, 0);
dfs(n - 1, -1, 0, 1);
for (i = 0; i < n; i++) {
if (d[0][i] <= d[1][i]) {
c1++;
} else {
c2++;
}
}
if (c1 > c2) {
puts("Fennec");
} else {
puts("Snuke");
}
return 0;
} | a.cc:2:1: error: 'vector' does not name a type
2 | vector <int> v[100000];
| ^~~~~~
a.cc: In function 'void dfs(int, int, int, int)':
a.cc:9:21: error: 'v' was not declared in this scope
9 | for (i = 0; i < v[x].size(); i++) {
| ^
a.cc: In function 'int main()':
a.cc:19:5: error: 'scanf' was not declared in this scope
19 | scanf("%d", &n);
| ^~~~~
a.cc:29:9: error: 'v' was not declared in this scope
29 | v[x].push_back(y);
| ^
a.cc:45:9: error: 'puts' was not declared in this scope
45 | puts("Fennec");
| ^~~~
a.cc:47:9: error: 'puts' was not declared in this scope
47 | puts("Snuke");
| ^~~~
|
s379497204 | p03660 | C++ | #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int N;
vector<int> *g;
vector<int> bfn(int spoit);
int main(){
cin >> N;
g = new vector<int>[N+1];
int a, b;
for(int i=1; i<N; i++){
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
vector<int> dist1 = bfn(1);
vector<int> dist2 = bfn(N);
int l=0; int r=0;
for(int i=1; i<=N; i++){
if(dist1[i]<=dist2[i]) l++;
else r++;
}
if(l>r) cout << "Fennec" << endl;
else cout << "Snuke" << endl;
}
vector<int> bfn(int spoit){
vector<int> dist(N+1,-1);
queue<int> q;
dist[spoint] = 0;
q.push(spoint);
while(!q.empty()){
int u = q.front();
q.pop();
for(auto i: g[u]){
if(dist[i]==-1){
dist[i] = dist[u] + 1;
q.push(i);
}
}
}
return dist;
}
| a.cc: In function 'std::vector<int> bfn(int)':
a.cc:46:8: error: 'spoint' was not declared in this scope; did you mean 'spoit'?
46 | dist[spoint] = 0;
| ^~~~~~
| spoit
|
s832354004 | p03660 | C++ |
}
int main(void) {
int n;
vector<vector<int>> v;
cin >> n;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
v[a - 1].push_back(b - 1);
v[b - 1].push_back(a - 1);
}
if (isFirst(n, v)) {
cout << "Fennec";
}
else {
cout << "Sunuke";
}
return 0;
}
| a.cc:3:1: error: expected declaration before '}' token
3 | }
| ^
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
8 | vector<vector<int>> v;
| ^~~~~~
a.cc:8:19: error: expected primary-expression before 'int'
8 | vector<vector<int>> v;
| ^~~
a.cc:10:5: error: 'cin' was not declared in this scope
10 | cin >> n;
| ^~~
a.cc:18:9: error: 'v' was not declared in this scope
18 | v[a - 1].push_back(b - 1);
| ^
a.cc:25:20: error: 'v' was not declared in this scope
25 | if (isFirst(n, v)) {
| ^
a.cc:25:9: error: 'isFirst' was not declared in this scope
25 | if (isFirst(n, v)) {
| ^~~~~~~
a.cc:27:9: error: 'cout' was not declared in this scope
27 | cout << "Fennec";
| ^~~~
a.cc:32:9: error: 'cout' was not declared in this scope
32 | cout << "Sunuke";
| ^~~~
|
s939676215 | p03660 | C++ | #include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;
class Node{
public:
vector<int> next_node;
void set_node(int _a){
next_node.push_back(_a);
}
};
int count_tree(int size,
vector<int> route,
vector<Node> all_node){
int now_pos=route[route.size()-1];
for(int i=0;i<all_node[now_pos].next_node.size();i++){
int next=all_node[now_pos].next_node[i];
auto itr=find(route.begin(),
route.end(),
next);
size_t index=distance(route.begin(),itr);
if(index==route.size()){
size++;
route.push_back(next);
size=count_tree(size,
route,
all_node);
route.pop_back();
}
}
return size;
}
vector<int> tree_dfs(vector<int> goal_route,
vector<Node> all_node){
int now_pos=goal_route[goal_route.size()-1];
for(int i=0;i<all_node[now_pos].next_node.size();i++){
int next=all_node[now_pos].next_node[i];
auto itr=find(goal_route.begin(),
goal_route.end(),
next);
size_t index=distance(goal_route.begin(),itr);
if(index==goal_route.size()){
goal_route.push_back(next);
if(next==all_node.size()-1){
return goal_route;
}else{
goal_route=tree_dfs(goal_route,all_node);
if(goal_route[goal_route.size()-1]
==all_node.size()-1){
return goal_route;
}
goal_route.pop_back();
}
}
}
return goal_route;
}
int main(){
int N;
cin >> N;
vector<int> a(N);
vector<int> b(N);
vector<Node> node(N);
for(int i=0;i<N-1;i++){
cin >> a[i] >> b[i];
node[a[i]-1].set_node(b[i]-1);
node[b[i]-1].set_node(a[i]-1);
}
vector<int> goal_route={0};
goal_route=tree_dfs(goal_route,node);
for(int i=0;i<goal_route.size();i++){
cout << goal_route[i] << " ";
}
cout << endl;
int black_end,white_end;
if(goal_route.size()%2==0){
black_end=goal_route[goal_route.size()/2-1];
white_end=goal_route[goal_route.size()/2];
}else{
black_end=goal_route[goal_route.size()/2];
white_end=goal_route[goal_route.size()/2+1];
}
for(int i=0;i<node[black_end].next_node.size();i++){
if(node[black_end].next_node[i]==white_end){
node[black_end].next_node.erase(node[black_end].next_node.begin()+i);
break;
}
}
for(int i=0;i<node[white_end].next_node.size();i++){
if(node[white_end].next_node[i]==black_end){
node[white_end].next_node.erase(node[white_end].next_node.begin()+i);
break;
}
}
int black_size,white_size;
vector <int> black_route={0};
vector <int> white_route={N-1};
black_size=count_tree(1,black_route,node);
white_size=count_tree(1,white_route,node);
if(black_size>white_size){
cout << "Fennec" << endl;
} else{
cout << "Snuke" << endl;
}
return 0;
}
Yoshito-MacBook:cpp yoshitoi$ fg
emacs-25.1 -nw template.cpp
[1]+ Stopped emacs-25.1 -nw template.cpp
Yoshito-MacBook:cpp yoshitoi$ cat abc067_d.cpp
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;
class Node{
public:
vector<int> next_node;
void set_node(int _a){
next_node.push_back(_a);
}
};
int count_tree(int size,
int now_pos,
vector<int> visited,
vector<Node> all_node){
visited[now_pos]=1;
for(int i=0;i<all_node[now_pos].next_node.size();i++){
int next=all_node[now_pos].next_node[i];
if(visited[next]==0){
size++;
size=count_tree(size,
next,
visited,
all_node);
}
}
return size;
}
vector<int> tree_dfs(vector<int> goal_route,
vector<int> visited,
vector<Node> all_node){
int now_pos=goal_route[goal_route.size()-1];
visited[now_pos]=1;
for(int i=0;i<all_node[now_pos].next_node.size();i++){
int next=all_node[now_pos].next_node[i];
if(visited[next]==0){
goal_route.push_back(next);
if(next==all_node.size()-1){
return goal_route;
}else{
goal_route=tree_dfs(goal_route,visited,all_node);
if(goal_route[goal_route.size()-1]
==all_node.size()-1){
return goal_route;
}
goal_route.pop_back();
}
}
}
return goal_route;
}
int main(){
int N;
cin >> N;
vector<int> a(N);
vector<int> b(N);
vector<Node> node(N);
for(int i=0;i<N-1;i++){
cin >> a[i] >> b[i];
node[a[i]-1].set_node(b[i]-1);
node[b[i]-1].set_node(a[i]-1);
}
vector<int> goal_route={0};
vector<int> visited1(N,0);
goal_route=tree_dfs(goal_route,visited1,node);
int black_end,white_end;
if(goal_route.size()%2==0){
black_end=goal_route[goal_route.size()/2-1];
white_end=goal_route[goal_route.size()/2];
}else{
black_end=goal_route[goal_route.size()/2];
white_end=goal_route[goal_route.size()/2+1];
}
for(int i=0;i<node[black_end].next_node.size();i++){
if(node[black_end].next_node[i]==white_end){
node[black_end].next_node.erase(node[black_end].next_node.begin()+i);
break;
}
}
for(int i=0;i<node[white_end].next_node.size();i++){
if(node[white_end].next_node[i]==black_end){
node[white_end].next_node.erase(node[white_end].next_node.begin()+i);
break;
}
}
int black_size,white_size;
vector <int> visited2(N,0);
black_size=count_tree(1,0,visited2,node);
white_size=count_tree(1,N-1,visited2,node);
if(black_size>white_size){
cout << "Fennec" << endl;
} else{
cout << "Snuke" << endl;
}
return 0;
} | a.cc:131:1: error: 'Yoshito' does not name a type
131 | Yoshito-MacBook:cpp yoshitoi$ fg
| ^~~~~~~
a.cc:142:7: error: redefinition of 'class Node'
142 | class Node{
| ^~~~
a.cc:7:7: note: previous definition of 'class Node'
7 | class Node{
| ^~~~
a.cc:197:5: error: redefinition of 'int main()'
197 | int main(){
| ^~~~
a.cc:69:5: note: 'int main()' previously defined here
69 | int main(){
| ^~~~
|
s029683710 | p03660 | C++ | #include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
int N;
cin >> N;
vector<vector<int>> nvec;
int check[100000];
for (int i = 0; i < N; i++) {
vector<int> temp;
nvec.push_back(temp);
check[i] = 0;
}
check[0] = check[N-1] = 1;
for (int i = 0; i < N-1; i++) {
int a, b;
cin >> a >> b;
a--; b--;
nvec.at(a).push_back(b);
nvec.at(b).push_back(a);
}
set<int> vB, vW;
vB.insert(0);
vW.insert(N-1);
int cB, cW;
cB = cW = 1;
while(1) {
/*
cout << "vB: ";
for (auto x: vB) cout << x << " ";
cout << endl;
cout << "vW: ";
for (auto x: vW) cout << x << " ";
cout << endl;
cout << "----" << endl;*/
int tempB, tempW;
tempB = tempW = 0;
vector<int> delB, delW;
for (auto x: vB) {
bool isfound = false;
for (auto y: nvec.at(x)) {
if (check[y] == 0) {
isfound = true;
vB.push_back(y);
check[y] = 1;
tempB++;
}
}
if (!isfound) delB.push_back(x);
}
for (auto x: delB) vB.erase(x);
for (auto x: vW) {
bool isfound = false;
for (auto y: nvec.at(x)) {
if (check[y] == 0) {
isfound = true;
vW.push_back(y);
check[y] = 1;
tempW++;
}
}
if (!isfound) delW.push_back(x);
}
for (auto x: delW) vW.erase(x);
if (tempB == 0 && tempW == 0) break;
else {
cB += tempB;
cW += tempW;
}
}
if (cB <= cW) {
cout << "Snuke" << endl;
} else {
cout << "Fennec" << endl;
}
free(check);
return 0;
}
| a.cc: In function 'int main()':
a.cc:51:14: error: 'class std::set<int>' has no member named 'push_back'
51 | vB.push_back(y);
| ^~~~~~~~~
a.cc:65:14: error: 'class std::set<int>' has no member named 'push_back'
65 | vW.push_back(y);
| ^~~~~~~~~
|
s858639553 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 30000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccFLtrni.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccFLtrni.o
collect2: error: ld returned 1 exit status
|
s163280496 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 40000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/cc54CBue.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc54CBue.o
collect2: error: ld returned 1 exit status
|
s553970515 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 50000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccqnUHFE.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqnUHFE.o
collect2: error: ld returned 1 exit status
|
s333131575 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 60000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccB9QZHS.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccB9QZHS.o
collect2: error: ld returned 1 exit status
|
s209731313 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 70000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/cc6590ff.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc6590ff.o
collect2: error: ld returned 1 exit status
|
s188232461 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 80000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/cc4CTopm.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc4CTopm.o
collect2: error: ld returned 1 exit status
|
s130404416 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 90000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/cc5CHQfy.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc5CHQfy.o
collect2: error: ld returned 1 exit status
|
s828791945 | p03660 | C++ | #include <iostream>
#include <vector>
#include <queue>
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
int n;
int M[N][N];
int color[N];
void bfs(int s1, int s2){
queue<int> q1,q2;
q1.push(s1);
q2.push(s2);
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
q1.push(v);
}
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
q2.push(v);
}
}
if(!q1.empty()) cout<<"Fennec"<<endl;
else cout<<"Snuke"<<endl;
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1);
return 0;
} | /tmp/ccZMScZF.o: in function `bfs(int, int)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
a.cc:(.text+0x22b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZMScZF.o
collect2: error: ld returned 1 exit status
|
s314708563 | p03660 | C++ | #include <iostream>
#include <vector>
#include <queue>
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
int n;
int M[N][N];
int color[N];
void bfs(int s1, int s2){
queue<int> q1,q2;
q1.push(s1);
q2.push(s2);
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
q1.push(v);
}
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
q2.push(v);
}
}
if(!q1.empty()) cout<<"Fennec"<<endl;
else cout<<"Snuke"<<endl;
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1);
return 0;
} | /tmp/ccjxOhm6.o: in function `bfs(int, int)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
a.cc:(.text+0x22b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjxOhm6.o
collect2: error: ld returned 1 exit status
|
s034873826 | p03660 | C++ | #include <iostream>
#include <vector>
#include <queue>
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
int n;
int M[N][N];
int color[N];
void bfs(int s1, int s2){
queue<int> q1,q2;q1.push(s1);q2.push(s2);for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
q1.push(v);
}
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
q2.push(v);
}
}
if(!q1.empty()) cout<<"Fennec"<<endl;
else cout<<"Snuke"<<endl;
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1);
return 0;
} | /tmp/ccjzx3sl.o: in function `bfs(int, int)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
a.cc:(.text+0x22b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjzx3sl.o
collect2: error: ld returned 1 exit status
|
s514491276 | p03660 | C++ | #include <iostream>
#include <vector>
#include <queue>
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
int n;
int M[N][N];
int color[N];
void bfs(int s1, int s2){
queue<int> q1,q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
u2=q2.front(); q2.pop();
// cout<<"Snuke's Turn"<<endl;
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
}
if(!q1.empty()) cout<<"Fennec"<<endl;
else cout<<"Snuke"<<endl;
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1);
return 0;
} | /tmp/ccNgF4MF.o: in function `bfs(int, int)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
a.cc:(.text+0x22b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccNgF4MF.o
collect2: error: ld returned 1 exit status
|
s730920338 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int M[N][N] = {};
int color[N] = {};
void bfs(int n, int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(n,0,n-1,0);
return 0;
} | /tmp/ccx5ay0n.o: in function `bfs(int, int, int, int)':
a.cc:(.text+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0x169): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0x233): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
a.cc:(.text+0x251): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccx5ay0n.o
collect2: error: ld returned 1 exit status
|
s152879596 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int n=0;
int M[N][N]={};
int color[N]={};
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccQqsmcz.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccQqsmcz.o
collect2: error: ld returned 1 exit status
|
s371582261 | p03660 | C++ | //前向星+SPFA
/*
edeg[]: 邻接表
dis[]: 最短路数组
vis[]: 出入队标记数组
cnt[]: 入队次数统计
head[u]:表示起点为u的最后一条边的标号,如果是-1表示没有以u为起点的边
init::初始化边
add::(u起点, v终点, w权值)
spfa::(s起点,n点数)[-1存在负环,反之为到点n最短路权值]
*/
#include<iostream>
#include<queue>
#include<algorithm>
#define N 100005
#define INF 0x3f3f3f3f
using namespace std;
struct Edge
{
int to;
int next;//表示和该边有共同起点的上一条边的标号
int val;
}edge[300000];
int tot;
int head[N];
int dis1[N];
int dis2[N];
int vis[N];
int cnt[N];
void init()
{
tot=0;
for(int i=0;i<N;i++)
head[i]=-1;
memset(vis,0,sizeof(vis));
memset(cnt,0,sizeof(cnt));
}
void add(int u,int v,int w)
{
edge[tot].to=v;
edge[tot].val=w;
edge[tot].next=head[u];
head[u]=tot++;
}
int spfa1(int s,int n)
{
queue<int> q;
for(int i=1;i<=n;i++)
{
vis[i]=0;
cnt[i]=0;
dis1[i]=INF;
}
cnt[s]=1;
vis[s]=1;
dis1[s]=0;
q.push(s);
while(!q.empty())
{
int u=q.front();
q.pop();
vis[u]=0;
for(int i=head[u];i!=-1;i=edge[i].next)
{
int v=edge[i].to;
int w=edge[i].val=w;
if(dis1[u]+w<dis1[v])
{
dis1[v]=dis1[u]+w;
if(!vis[v])
{
vis[v]=1;
if(++cnt[v]>n) return -1;
q.push(v);
}
}
}
}
return dis1[n];//默认返回最后一个点最短距离,可更改
}
int spfa2(int s,int n)
{
queue<int> q;
for(int i=1;i<=n;i++)
{
vis[i]=0;
cnt[i]=0;
dis2[i]=INF;
}
cnt[s]=1;
vis[s]=1;
dis2[s]=0;
q.push(s);
while(!q.empty())
{
int u=q.front();
q.pop();
vis[u]=0;
for(int i=head[u];i!=-1;i=edge[i].next)
{
int v=edge[i].to;
int w=edge[i].val=w;
if(dis2[u]+w<dis2[v])
{
dis2[v]=dis2[u]+w;
if(!vis[v])
{
vis[v]=1;
if(++cnt[v]>n) return -1;
q.push(v);
}
}
}
}
return dis2[n];//默认返回最后一个点最短距离,可更改
}
int n;
int main()
{
init();
cin>>n;
for(int i=1;i<n;i++)
{
int a,b;
cin>>a>>b;
add(a,b,1);
add(b,a,1);
}
spfa1(1,n);
memset(vis,0,sizeof(vis));
memset(cnt,0,sizeof(cnt));
spfa2(n,n);
int s=0;
for(int i=1;i<=n;i++)
if(dis1[i]<=dis2[i])
s++;
if((s-1)>(n-s))
cout<<"Fennec"<<endl;
else
cout<<"Snuke"<<endl;
return 0;
}
| a.cc: In function 'void init()':
a.cc:36:9: error: 'memset' was not declared in this scope
36 | memset(vis,0,sizeof(vis));
| ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
15 | #include<algorithm>
+++ |+#include <cstring>
16 | #define N 100005
a.cc: In function 'int main()':
a.cc:133:9: error: 'memset' was not declared in this scope
133 | memset(vis,0,sizeof(vis));
| ^~~~~~
a.cc:133:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s782101641 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int M[N][N];
int color[N];
void bfs(int n, int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b,n;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(n,0,n-1,0);
return 0;
} | /tmp/cczyPtE5.o: in function `bfs(int, int, int, int)':
a.cc:(.text+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0x169): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0x233): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
a.cc:(.text+0x251): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cczyPtE5.o
collect2: error: ld returned 1 exit status
|
s145523536 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[n-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
cin.sync_with_stdio(false);
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccUNn4SX.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccUNn4SX.o
collect2: error: ld returned 1 exit status
|
s947063421 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int main(void){
cin.sync_with_stdio(false);
int a,b;
int n=0, M[N][N];
int color[N];
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
cin>>a>>b;
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
int s1=0,s2=n-1;
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[N-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:45:12: error: 'turn' was not declared in this scope
45 | if(turn==0){
| ^~~~
|
s110375801 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int n=0, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[N-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
int a,b;
scanf("%d",&n);
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
scanf("%d %d", &a,&b);
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccP07S0Q.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0x12e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0x218): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccP07S0Q.o
collect2: error: ld returned 1 exit status
|
s943636836 | p03660 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[N-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
// cout<<"Fennec's Turn"<<endl;
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
// cout<<"proceed"<<v<<endl;
q1.push(v);
}
turn=1;//next snuke
}else{
// cout<<"Snuke's Turn"<<endl;
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
// cout<<"proceed"<<v<<endl;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
int a,b;
scanf("%d",&n);
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n-1; i++){
int a,b;
scanf("%d %d", &a,&b);
a--; b--;
M[a][b]=1;
M[b][a]=1;
}
bfs(0,n-1,0);
return 0;
} | /tmp/ccpGigl4.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0x12e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0x218): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccpGigl4.o
collect2: error: ld returned 1 exit status
|
s090791718 | p03660 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <list>
//color
#define NOCOLOR 0
#define BLACK 1 //Fennec
#define WHITE 2 //Snuke
#define N 100000
using namespace std;
static const int INFTY = 1000;
int n, M[N][N];
int color[N];
void bfs(int s1, int s2, int turn){
queue<int> q1;
queue<int> q2;
q1.push(s1); //init state(fennec)
q2.push(s2); //init state(snuke)
for(int i = 0; i < n; i++) color[i]=NOCOLOR;
color[0]=BLACK;
color[N-1]=WHITE;
int u1,u2;
while(!q1.empty() && !q2.empty()){
if(turn==0){
u1=q1.front(); q1.pop();
for(int v = 0; v < n; v++){
if(M[u1][v]==0) continue;
if(color[v]==WHITE) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = BLACK;
q1.push(v);
}
turn=1;//next snuke
}else{
u2=q2.front(); q2.pop();
for(int v = 0; v < n; v++){
if(M[u2][v]==0) continue;
if(color[v]==BLACK) continue;
if(color[v]!=NOCOLOR) continue;
color[v] = WHITE;
q2.push(v);
}
turn=0;//next fennec
}
}
if(!q1.empty()){
cout<<"Fennec"<<endl;
}else{
cout<<"Snuke"<<endl;
}
}
int main(void){
int a,b;
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(int i = 0; i < n; i++){
cin>>a>>b;
a--; b--;
M[a][b] = 1;
}
bfs(0,N-1,0);
return 0;
} | /tmp/ccZcEfc1.o: in function `bfs(int, int, int)':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x12e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x14d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x16b): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x23a): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x259): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
a.cc:(.text+0x277): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZcEfc1.o
collect2: error: ld returned 1 exit status
|
s011677370 | p03660 | C++ | #include<bits/stdc++.h>
using namespace std;
#define nmax 100000
#define ll long long
int n;
int a,b;
int s[nmax][nmax];
int d[nmax]={0};
ll Calc(int depth,int pl,int *f){
ll re;
int fs[nmax];
for(int i=0;i<n;i++)
fs[i]=f[i];
if(fs[pl]!=0)
return depth%2?1:-1;
if(depth%2){ //maxCalc
re=0;
for(int i=0;i<d[pl];i++)
re=max(re,Calc(depth+1,s[pl][i],fs));
}
else{ //minCalc
re=LLONG_MAX;
for(int i=0;i<d[pl];i++)
re=min(re,Calc(depth+1,s[pl][i],fs));
}
}
int main(){
cin>>n;
int f[nmax]={0};
f[n-1]=1;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
s[i][j]=0;
for(int i=0;i<n;i++){
cin>>a>>b;
a--;b--;
s[a][d[a]++]=b;
s[b][d[b]++]=a;
}
cout<<(Calc(0,0,f)==1?"Fennec":"Snuke")<<endl;;
return 0;
} | a.cc: In function 'long long int Calc(int, int, int*)':
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
27 | }
| ^
/tmp/ccCCuWUq.o: in function `Calc(int, int, int*)':
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
a.cc:(.text+0x1cf): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
/tmp/ccCCuWUq.o: in function `main':
a.cc:(.text+0x309): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
a.cc:(.text+0x321): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
a.cc:(.text+0x36a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
a.cc:(.text+0x382): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccCCuWUq.o
collect2: error: ld returned 1 exit status
|
s858615366 | p03660 | C | #include<stdio.h>
int main()
{
int N;
scanf("%d",&N);
int st[N][N];
int leng[N];//STの配列の長さcount
for(int i=0;i<=N;i++){
leng[i]=1;//初期化
}
for(int i=0;i<=N;i++){
int a,b;
scanf("%d %d",&a,&b);
st[a][leng[a]]=b;
st[b][leng[b]]=a;
leng[a]++;
leng[b]++;
}
st[0][0]=1;//1=black
st[N][0]=2;//2=white
for(int i=0;i<=N-2;i++){
int ch=check(1,N,st);
if(ch==2){
printf("Snuke");
ch=check(2,N,st);
}
if(ch==2){
printf("Fenneck");
}
}
}
int check(int x,int N,int st[][]){
int flg;
int now=-1;
for(int i=0;i<=N;i++){
if(st[i][0]==x){
flg=1;
now=i;
for(int i=0;i<=N;i++){
if(st[st[now][i+1]][0]==0){
st[now][0]=1;
return 1;//1=ok
}
st[now][0]=3;//3=dame
}
}
return 2;//2=no
}
| main.c: In function 'main':
main.c:22:9: error: implicit declaration of function 'check' [-Wimplicit-function-declaration]
22 | int ch=check(1,N,st);
| ^~~~~
main.c: At top level:
main.c:34:27: error: array type has incomplete element type 'int[]'
34 | int check(int x,int N,int st[][]){
| ^~
main.c:34:27: note: declaration of 'st' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'check':
main.c:51:1: error: expected declaration or statement at end of input
51 | }
| ^
|
s188485780 | p03660 | C++ | #include<bits/stdc++.h>
using namespace std;
#define nmax 100000
#define ll long long
int n;
int a,b;
int s[nmax][nmax];
int d[nmax]={0};
ll Calc(int depth,int pl,int *f){
ll re;
int fs[nmax];
for(int i=0;i<n;i++)
fs[i]=f[i]
if(fs[pl]!=0)
return depth%2?1:-1;
if(depth%2){ //maxCalc
re=0;
for(int i=0;i<d[pl];i++)
re=max(re,Calc(depth+1,s[pl][i],fs));
}
else{ //minCalc
re=LLONG_MAX;
for(int i=0;i<d[pl];i++)
re=min(re,Calc(depth+1,s[pl][i],fs));
}
}
int main(){
cin>>n;
int f[nmax]={0};
f[n-1]=1;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
s[i][j]=0;
for(int i=0;i<n;i++){
cin>>a>>b;
a--;b--;
s[a][d[a]++]=b;
s[b][d[b]++]=a;
}
cout<<(Calc(0,0,f)==1?"Fennec":"Snuke")<<endl;;
return 0;
} | a.cc: In function 'long long int Calc(int, int, int*)':
a.cc:13:19: error: expected ';' before 'if'
13 | fs[i]=f[i]
| ^
| ;
14 | if(fs[pl]!=0)
| ~~
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
27 | }
| ^
|
s244577311 | p03660 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 1e5 + 5;
int n;
vector <int> G[N];
bool visited[N];
int dist1[N], dist2[N];
char color[N];
void dfs1(int x, int d) {
if(x == n)
return;
visited[x] = 1;
color[x] = 'B';
dist1[x] = d;
for(int y: G[x]) {
if(!visited[y])
dfs1(y, d + 1);
}
}
void dfs2(int x, int d) {
if(x == 1)
return;
if(dist1[x] <= dist2[x])
return;
visited[x] = 1;
color[x] = 'W';
dist2[x] = d;
for(int y: G[x]) {
if(!visited[y])
dfs(y, d + 1);
}
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i = 1 ; i < n; i++)
{
int x, y;
cin>>x>>y;
G[x].pb(y);
G[y].pb(x);
}
dfs1(1, 0);
memset(visited, 0, sizeof(visited));
dfs2(n, 0);
int b = 0, w = 0;
for(int i = 1; i <= n; i++)
{
if(color[i] == 'B')
b++;
else
w++;
}
cout<<( b >= w ? "Fennec\n" : "Snuke\n");
return 0;
} | a.cc: In function 'void dfs2(int, int)':
a.cc:41:13: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
41 | dfs(y, d + 1);
| ^~~
| ffs
|
s948812315 | p03660 | C++ | //D
/*==========================================================*/
/* Template ver 2017-0401 | Created by AVM.Martin */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cassert>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cctype>
#include<utility>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<list>
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
typedef std::vector<int> vi;
const int OO=(int)2e9;
const ll INF=(ll)4e18;
const double EPS=(double)1e-12;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define INL(i,a,b) ((a<=i)&&(i<=b))
#define EXL(i,a,b) ((a< i)&&(i< b))
#define REPP(i,a,b,c) for(int i=a;i<=b;i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a;i>=b;i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
using namespace std;
int n,a,b,sz;
vi dat[100005];
int flag[100005];
priority_queue<int>bfsa,bfsb;
int main(){
//reset
while(!bfsa.empty())bfsa.pop();
while(!bfsb.empty())bfsb.pop();
REP(i,0,100003){
dat[i].clear();
flag[i]=0;
}
//input
scanf("%d",&n);
REP(i,1,n-1){
scanf("%d %d",&a,&b);
dat[a].pb(b);
dat[b].pb(a);
}
REP(i,1,n)sort(dat[i].begin(),dat[i].end());
//bodoh
puts(n%2==0?"Snuke""Fennec");
return 0;
} | a.cc: In function 'int main()':
a.cc:73:36: error: expected ':' before ')' token
73 | puts(n%2==0?"Snuke""Fennec");
| ^
| :
a.cc:73:36: error: expected primary-expression before ')' token
|
s042550145 | p03660 | C++ | #include <bits/stdc++.h>
#include <memory>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 100005;
#define FI first
#define SE second
typedef pair<int, int>pii;
int mod = 1000000007;
vector<int> tr[N];
int dep, n;
int next[N];
bool vis[N];
void dfs(int u, int pre, int d)
{
if (u == n)
{
dep = d;
next[pre] = u;
}
for (int i = 0; i < tr[u].size(); i++)
{
int v = tr[u][i];
if (pre != v)
{
dfs(v, u, d + 1);
if (~next[v])
next[u] = v;
}
}
}
void white(int u, int pre, int &cnt)
{
cnt++;
for (int i = 0; i < tr[u].size(); i++)
{
int v = tr[u][i];
if (!vis[v] && v != pre)
white(v, u, cnt);
}
}
int main()
{
// ios::sync_with_stdio(0);
while (~scanf("%d", &n))
{
int a, b;
for (int i = 0; i < n; i++)
tr[i].clear();
memset(next, -1, sizeof(next));
memset(vis, 0, sizeof(vis));
for (int i = 1; i < n; i++)
{
scanf("%d%d", &a, &b);
tr[a].push_back(b);
tr[b].push_back(a);
}
dep = 0;
dfs(1, -1, 1);
dep -= 2;
dep = (dep&1) + (dep>>1);
int cur = 1;
vis[1] = true;
while (dep--)
{
vis[next[cur]] = true;
cur = next[cur];
}
int cnt = 0;
white(n, -1, cnt);
int f = n - cnt;
cnt--;
f--;
// printf("f:%d s:%d\n", f, cnt);
printf("%s\n", f <= cnt?"Snuke":"Fennec");
}
return 0;
} | a.cc: In function 'void dfs(int, int, int)':
a.cc:21:7: error: reference to 'next' is ambiguous
21 | next[pre] = u;
| ^~~~
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: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:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc:29:15: error: reference to 'next' is ambiguous
29 | if (~next[v])
| ^~~~
/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:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc:30:13: error: reference to 'next' is ambiguous
30 | next[u] = v;
| ^~~~
/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:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc: In function 'int main()':
a.cc:54:14: error: reference to 'next' is ambiguous
54 | memset(next, -1, 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:13:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc:54:31: error: reference to 'next' is ambiguous
54 | memset(next, -1, 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:13:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc:70:14: error: reference to 'next' is ambiguous
70 | vis[next[cur]] = true;
| ^~~~
/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:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
a.cc:71:16: error: reference to 'next' is ambiguous
71 | cur = next[cur];
| ^~~~
/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:5: note: 'int next [100005]'
13 | int next[N];
| ^~~~
|
s928005687 | p03660 | C++ | #include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
using namespace std;
vi g[100100];
int n, lvl[100100], s[100100], par[100100];
int F, S;
void dfs(int v, int p, int l) {
par[v] = p;
lvl[v] = l;
s[v] = 1;
for(int i = 0; i < g[v].sz; i++) {
int to = g[v][i];
if(to == p) continue;
dfs(to, v, l + 1);
s[v] += s[to];
}
}
int main() {
cin >> n;
for(int i = 1, a, b; i < n; i++) {
cin >> a >> b;
g[a].pb(b);
g[b].pb(a);
}
dfs(1, 0, 1);
int cnt = (lvl[n] - 2 ) /2;
int cur = n;
S = s[n];
for(int i = 0; i < cnt; i++) {
ans += s[par[cur]] - s[cur];
cur = par[cur];
}
F = n - S;
cerr << F << " " << S << endl;
if(F > S) {
cout << "Fennec\n";
} else {
cout << "Snuke\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:52:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
52 | ans += s[par[cur]] - s[cur];
| ^~~
| abs
|
s703151362 | p03661 | C++ | #include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) begin(x),end(x)
#define RALL(a) (a).rbegin(), (a).rend()
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int fact(int i) {
if (i == 0) return 1;
return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
int keta(int n) {
if (n == 0) return 1;
int count = 0;
while (n != 0) {
n /= 10;
count++;
}
return count;
}
int ketasum(int n) {
int sum = 0;
while (n != 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
int modpow(int a, int n, int mod) {
int hi = 1;
while (n > 0) {
if (n & 1) hi = hi * a % mod;
a = a * a % mod;
n >>= 1;
}
return hi;
}
char toSmall(char c) { // 大文字を小文字へ
return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
float x = 1;
while (n > 0) { // 全てのbitが捨てられるまで
if (n & 1) { // 一番右のbitが1のとき
x *= a;
}
a *= a;
n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
}
return x;
}
bool is_prime(const unsigned n) {
switch (n) {
case 0: // fall-through
case 1: return false;
case 2: // fall-through
case 3: return true;
} // n > 3 が保証された
if (n % 2 == 0 || n % 3 == 0) return false;
for (unsigned i = 5; i * i <= n; i += 6) {
if (n % i == 0) return false; // (6の倍数)-1
if (n % (i + 2) == 0) return false; // (6の倍数)+1
}
return true;
}
ll n, ans;
/*signed*/int main(void) {
ans = INF;
cin >> n; vector<ll> v(n + 1);
rep(i, n) {
cin >> v[i]; v[i] += v[i - 1];
}
rep(i, n - 1) {
ans = min(ans, (ll)abs(v[n] - v[i] - v[i]));
return 0;
} | a.cc: In function 'int main()':
a.cc:142:2: error: expected '}' at end of input
142 | }
| ^
a.cc:133:26: note: to match this '{'
133 | /*signed*/int main(void) {
| ^
|
s339212282 | p03661 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin>>N;
vector<int>A(N);
vector<int>B(N);
for(int i=0;i<N;i++){cin>>A[i];B[i]=A[i]+(i!=0? B[i-1]:0);}
long long ans=100000000000000;
for(int i=0;i<N-1;i++)ans=min(ans,abs(B[i]*2-B[N-1]));
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:9:32: error: no matching function for call to 'min(long long int&, int)'
9 | for(int i=0;i<N-1;i++)ans=min(ans,abs(B[i]*2-B[N-1]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:9:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
9 | for(int i=0;i<N-1;i++)ans=min(ans,abs(B[i]*2-B[N-1]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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:9:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
9 | for(int i=0;i<N-1;i++)ans=min(ans,abs(B[i]*2-B[N-1]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
|
s412929715 | p03661 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll int64_t
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);
int n;
cin>>n;
vector<ll> a(n);
for(ll& x:a) cin>>x;
ll sum=accumulate(a.begin(),a.end(),0),pf=0;
ll res=1e18;
for(int i=0;i<n-1;++i){
pf+=a[i];
res=min(res,abs(2ll*pf-sum));
}
cout<<res<<'\n';
}
| a.cc: In function 'int main()':
a.cc:15:24: error: no matching function for call to 'min(int64_t&, long long int)'
15 | res=min(res,abs(2ll*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
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:15:24: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
15 | res=min(res,abs(2ll*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
/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:15:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
15 | res=min(res,abs(2ll*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
|
s822846588 | p03661 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll int64_t
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);
int n;
cin>>n;
vector<ll> a(n);
for(ll& x:a) cin>>x;
ll sum=accumulate(a.begin(),a.end(),0),pf=0;
ll res=1e18;
for(int i=0;i<n-1;++i){
pf+=a[i];
res=min(res,abs(2LL*pf-sum));
}
cout<<res<<'\n';
}
| a.cc: In function 'int main()':
a.cc:15:24: error: no matching function for call to 'min(int64_t&, long long int)'
15 | res=min(res,abs(2LL*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
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:15:24: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
15 | res=min(res,abs(2LL*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
/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:15:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
15 | res=min(res,abs(2LL*pf-sum));
| ~~~^~~~~~~~~~~~~~~~~~~~~
|
s788281034 | p03661 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define int long long
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = (ll)1e9 + 7;
int main() {
int n; cin >> n;
vi v(n);
forn(n) cin >> v[i];
sort(all(v));
int mn = INT_MAX;
for(int i = 1; i < n; i++) {
mn = min(mn, abs(v[i] - v[i - 1]));
}
cout << mn;
return 0;
}
| cc1plus: error: '::main' must return 'int'
|
s326134423 | p03661 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<map>//int dx[4]={0,0,-1,1};int dy[4]={-1,1,0,0};
#include<queue>//int gcd(int a,int b){return b?gcd(b,a%b):a;}
#include<vector>
#include<cmath>
#include<stack>
#include<string.h>
#include<stdlib.h>
#include<cstdio>
#define ll long long
#define maxn 100005
#define eps 0.0000001
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000") ///在c++中是防止暴栈用的
struct eg
{
int e,next;
eg (int x=0,int y=0)
{
e=x;
next=y;
}
}edge[maxn<<1];
int head[maxn];
int tot,a,b;
int d1[maxn],dn[maxn];
void init()
{
memset(d1,0xf,sizeof(d1));
memset(dn,0xf,sizeof(dn));
memset(head,-1,sizeof(head));
tot=0;
}
void add_edge(int a,int b)
{
edge[tot]=eg(b,head[a]);
head[a]=tot++;
}
struct node
{
int u,d;
node(int x=0,int y=0)
{
u=x;
d=y;
}
};
void Bfs(int u)
{
int vis[maxn];
memset(vis,0,sizeof(vis));
vis[u]=1;
if(u==1) d1[u]=0;
else dn[u]=0;
queue<node> q;
q.push(node(u,0));
while(!q.empty())
{
node tp=q.front();
q.pop();
for(int i=head[tp.u];i!=-1;i=edge[i].next)
{
int p=edge[i].e;
if(vis[p]) continue;
vis[p]=1;
if(u==1) d1[p]=min(d1[p],tp.d+1);
else dn[p]=min(dn[p],tp.d+1);
q.push(node(p,tp.d+1));
}
}
}
int main()
{
init();
int n;
scanf("%d",&n);
for(int i=1;i<n;i++)
{
scanf("%d%d",&a,&b);
add_edge(a,b);
add_edge(b,a);
}
Bfs(n);
Bfs(1);
///for(int i=1;i<=n;i++) cout<<d1[i]<<" ";puts("");
///for(int i=1;i<=n;i++) cout<<dn[i]<<" ";puts("");
int cnt1=0,cntn=0;
for(int i=1;i<=n;i++)
{
if(d1[i]<=dn[i]) cnt1++;
else cntn++;
}
if(cnt1<=cntn) puts("Snuke");
else puts("Fennec");
return 0;
}
details/81333376 | a.cc:110:1: error: 'details' does not name a type
110 | details/81333376
| ^~~~~~~
|
s156007895 | p03661 | C++ | #include <iostream>
#include <stack>
#include <climits>
using namespace std;
int abs(int a) {return (a < 0) ? -a : a;}
int main(){
int N; cin >> N; int a[N];
long long s[N], t[N], x=0, y=0;
for (int i = 0; i < N; i++) cin >> a[i];
for (int i = 0; i < N; i++)
s[N-i-1] = (x+=a[i]), t[i] = (y+=a[N-i-1]);
int MIN = INT_MAX;
for (int i = 1; i < N; i++)
MIN = min(MIN, abs(t[i-1]-s[i]));
cout << MIN << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:18: error: no matching function for call to 'min(int&, long long int)'
17 | MIN = min(MIN, abs(t[i-1]-s[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:17:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
17 | MIN = min(MIN, abs(t[i-1]-s[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
|
s988418169 | p03661 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n-1;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
int main(){
ll n;
cin>>n;
vll a(n);
rep(i,n) cin>>a[i];
vll b(n);
rep(i,n){
b[0]+=a[i];
}
b[0]=abs(b[0]);
for(int i=1;i<n;i++){
if(a[i-1]<0){
b[i]=b[i-1]+abs(2*a[i-1]);
}
else{
b[i]=b[i-1]-abs(2*a[i-1]);
}
}
ll ans=INF;
rep(i,n){
ans=min(b[i]);
}
COUT(ans);
}
| a.cc: In function 'int main()':
a.cc:55:12: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
55 | ans=min(b[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: candidate expects 2 arguments, 1 provided
/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, 1 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: template argument deduction/substitution failed:
a.cc:55:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
55 | ans=min(b[i]);
| ~~~^~~~~~
/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: candidate expects 2 arguments, 1 provided
|
s973380835 | p03661 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a;
int b[256],d=0;
cin>>a;
for(int i=0;i<a;i++){
cin>>b[i];
}
sort(b,b+n);
if(a==2){
d=a/2;
}
else{
d=a/2+1;
}
c+=(b.begin(),b[d]);
cout<<c<<'\n';
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:12: error: 'n' was not declared in this scope
10 | sort(b,b+n);
| ^
a.cc:17:3: error: 'c' was not declared in this scope
17 | c+=(b.begin(),b[d]);
| ^
a.cc:17:9: error: request for member 'begin' in 'b', which is of non-class type 'int [256]'
17 | c+=(b.begin(),b[d]);
| ^~~~~
|
s752807685 | p03661 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,c=0,d=0,x=1;
int q,w;
int b[1000000];
int z[1000000];
cin>>a;
for(int i=0;i<1000000;i++){
z[i]=10000000;
}
for(int i=0;i<a;i++){
cin>>b[i];
d+=b[i];
}
sort(b,b+a);
c=b[0];
d+=b[a-1];
}
z[0]=abs(c-d);
for(int i=1;i<a-1;i++){
q=c,w=d;
c+=b[i];
d-=b[i];
z[x]=abs(c-d);
x++;
}
sort(z,z+a+1);
cout<<z[0]<<"\n";
}
| a.cc:20:3: error: 'z' does not name a type
20 | z[0]=abs(c-d);
| ^
a.cc:21:3: error: expected unqualified-id before 'for'
21 | for(int i=1;i<a-1;i++){
| ^~~
a.cc:21:15: error: 'i' does not name a type
21 | for(int i=1;i<a-1;i++){
| ^
a.cc:21:21: error: 'i' does not name a type
21 | for(int i=1;i<a-1;i++){
| ^
a.cc:28:7: error: expected constructor, destructor, or type conversion before '(' token
28 | sort(z,z+a+1);
| ^
a.cc:29:3: error: 'cout' does not name a type
29 | cout<<z[0]<<"\n";
| ^~~~
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
|
s810795850 | p03661 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn=1<<18;
int n;
vector<int> e[maxn];
int cnt[maxn];
vector <int> vct;
int frst;
void dfs(int v,int pr){
cnt[v]=1;
vct.push_back(v);
if(v==n-1){
frst=vct[((int)vct.size()+1)/2];
}
for(int j=0;j<e[v].size();j++){
if(e[v][j]==pr) continue;
dfs(e[v][j],v);
cnt[v]+=cnt[e[v][j]];
}
vct.pop_back();
}
int mian(){
while(scanf("%d",&n)==1){
for(int i=0;i<n;i++){
e[i]=clear();
}
for(int i=0;i<n-1;i++){
int u,v;
scanf("%d%d",&u,&v);
--u;--v;
e[u].push_back(v);
e[v].push_back(u);
}
frst=-1;
dfs(0,0);
bool win=cnt[frst]*2<n;
string ans=win?"Fennec":"Snuke";
cout<<ans<<endl;
}
} | a.cc: In function 'int mian()':
a.cc:26:30: error: 'clear' was not declared in this scope
26 | e[i]=clear();
| ^~~~~
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
41 | }
| ^
|
s907402596 | p03661 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
signed main(){
int a,e=1000000000;
cin>>a;
vector<int> b(a),c(a,0),d(a,0);
fo(i,a)
cin>>b[i];
c[0]=b[0];
d[0]=b[a-1];
for(int i=1;i<a;i++)
c[i]=c[i-1]+b[i];
for(int i=1;i<a;i++)
d[i]=d[i-1]+b[a-1-i];
c.pop_back();
d.pop_back();
rev(d);
fo(i,a-1)
e=min(e,abs(c[i]-d[i]));
cout<<e<<endl;
}
| a.cc: In function 'int main()':
a.cc:71:3: error: 'rev' was not declared in this scope
71 | rev(d);
| ^~~
|
s385327415 | p03661 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
signed main(){
int a,e=1000000000;
cin>>a;
vector<int> b(a),c(a,0),d(a,0);
fo(i,a)
cin>>b[i];
c[0]=b[0];
d[0]=b[a-1];
for(int i=1;i<b;i++)
c[i]=c[i-1]+b[i];
for(int i=1;i<b;i++)
d[i]=d[i-1]+b[a-1-i];
c.pop_back();
d.pop_back();
rev(d);
fo(i,a-1)
e=min(e,abs(c[i]-d[i]));
cout<<e<<endl;
} | a.cc: In function 'int main()':
a.cc:65:16: error: no match for 'operator<' (operand types are 'long long int' and 'std::vector<long long int>')
65 | for(int i=1;i<b;i++)
| ~^~
| | |
| | std::vector<long long int>
| long long int
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: 'std::vector<long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:65:17: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
65 | for(int i=1;i<b;i++)
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: t |
s538551350 | p03661 | C++ | #include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
int main()
{
ll N;
cin >> N;
ll a[N];
ll x = 0;
ll tmp = 0;
ll iMin = INF;
REP(i,N)
{
cin >> a[i];
tmp += a[i];
}
REP(i,N)
{
x += a[i];
iMin = min(iMin,abs(tmp -2*x));
}
cout << iMin << endl;
}
| a.cc: In function 'int main()':
a.cc:25:15: error: 'INF' was not declared in this scope
25 | ll iMin = INF;
| ^~~
|
s138829349 | p03661 | C++ | #include <bits/stdc++.h>
#define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define set(a, v) memset(a, v, sizeof(a))
#define cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl
using namespace std;
template<typename t> inline bool chkmin(t &a, t b) { return b < a ? a = b, 1 : 0; }
template<typename t> inline bool chkmax(t &a, t b) { return b > a ? a = b, 1 : 0; }
inline int read() {
int x(0), sgn(1); char ch(getchar());
for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
return x * sgn;
}
void file() {
#ifdef zjp_shadow
freopen ("c.in", "r", stdin);
freopen ("c.out", "w", stdout);
#endif
}
const int n = 2e5 + 1e3;
int n, a[n];
long long ans, pre, sum;
int main () {
file();
n = read();
for (i, 1, n)
sum += (a[i] = read());
ans = 1e18;
for (i, 1, n - 1)
pre += a[i], chkmin(ans, abs(sum - 2 * pre));
printf ("%lld\n", ans);
return 0;
} | a.cc:17:44: error: macro "for" requires 3 arguments, but only 1 given
17 | for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
| ^
a.cc:3:9: note: macro "for" defined here
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^~~
a.cc:18:43: error: macro "for" requires 3 arguments, but only 1 given
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ^
a.cc:3:9: note: macro "for" defined here
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^~~
a.cc: In function 'int read()':
a.cc:17:46: error: expected '(' before 'if'
17 | for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
| ^~
| (
a.cc:17:46: error: expected primary-expression before 'if'
17 | for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
| ^~
a.cc:18:9: error: expected primary-expression before 'for'
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ^~~
a.cc:17:70: error: expected ';' before 'for'
17 | for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
| ^
| ;
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ~~~
a.cc:18:9: error: expected primary-expression before 'for'
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ^~~
a.cc:17:70: error: expected ')' before 'for'
17 | for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
| ~~ ^
| )
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ~~~
a.cc:18:45: error: expected '(' before 'x'
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ^
| (
a.cc:19:9: error: expected primary-expression before 'return'
19 | return x * sgn;
| ^~~~~~
a.cc:18:70: error: expected ';' before 'return'
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ^
| ;
19 | return x * sgn;
| ~~~~~~
a.cc:19:9: error: expected primary-expression before 'return'
19 | return x * sgn;
| ^~~~~~
a.cc:18:70: error: expected ')' before 'return'
18 | for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
| ~ ^
| )
19 | return x * sgn;
| ~~~~~~
a.cc: At global scope:
a.cc:31:5: error: conflicting declaration 'int n'
31 | int n, a[n];
| ^
a.cc:29:11: note: previous declaration as 'const int n'
29 | const int n = 2e5 + 1e3;
| ^
a.cc: In function 'int main()':
a.cc:39:11: error: assignment of read-only variable 'n'
39 | n = read();
| ~~^~~~~~~~
a.cc:40:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
40 | for (i, 1, n)
| ^
a.cc:3:40: note: in definition of macro 'for'
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^
a.cc:40:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
40 | for (i, 1, n)
| ^
a.cc:3:49: note: in definition of macro 'for'
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^
a.cc:44:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
44 | for (i, 1, n - 1)
| ^
a.cc:3:40: note: in definition of macro 'for'
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^
a.cc:44:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
44 | for (i, 1, n - 1)
| ^
a.cc:3:49: note: in definition of macro 'for'
3 | #define for(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
| ^
a.cc: In function 'int read()':
a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type]
20 | }
| ^
|
s378086498 | p03661 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> A(N);
for(int i=0; i<N; ++i) {
cin >> A[i];
if(i > 0) A[i] += A[i-1];
}
int res = 1001001001001001;
for(int i=0; i+1<N; ++i) {
res = min(res, abs(A[N-1] - A[i] - A[i]));
}
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:13:15: warning: overflow in conversion from 'long int' to 'int' changes value from '1001001001001001' to '-1256873943' [-Woverflow]
13 | int res = 1001001001001001;
| ^~~~~~~~~~~~~~~~
a.cc:15:18: error: no matching function for call to 'min(int&, long long int)'
15 | res = min(res, abs(A[N-1] - A[i] - 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:15:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
15 | res = min(res, abs(A[N-1] - A[i] - 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:15:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
15 | res = min(res, abs(A[N-1] - A[i] - A[i]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s807284048 | p03661 | C++ | #include <bits/stdc++.h>
typedef long long LL;
const int MAXN = 2e5 + 5;
int main()
{
int N; scanf("%d", &N);
static LL a[MAXN]; LL sum = 0;
for (int i = 1; i <= N; i++)
{
scanf("%d", &a[i]);
sum += a[i];
}
LL pre = a[1], mDif = abs(sum - 2 * a[1]);
for (int i = 2; i <= N; i++)
{
pre += a[i];
mDif = std::min(mDif, abs(sum - 2 * pre));
}
printf("%lld\n", mDif);
} | a.cc: In function 'int main()':
a.cc:21:32: error: no matching function for call to 'min(LL&, int)'
21 | mDif = std::min(mDif, abs(sum - 2 * pre));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
21 | mDif = std::min(mDif, abs(sum - 2 * pre));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/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:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
21 | mDif = std::min(mDif, abs(sum - 2 * pre));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
|
s909908570 | p03661 | C++ | #include<vector>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
ll n;
cin>>n;
vector<int>a(n);
for(auto &e:a)cin>>e;
ll sum=accumulate(a.begin(),a.end(),0);
ll tmp=0;
int i=0;
for(;i<n-1;++i){
tmp+=a[i];
if(tmp>sum/2)break;
}
if(n==2)cout<<abs(a[1]-a[0]);
else cout<<abs(a[i-1]-a[i]);
cout<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
10 | cin>>n;
| ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
4 | #include<numeric>
+++ |+#include <iostream>
5 |
a.cc:22:13: error: 'cout' was not declared in this scope
22 | if(n==2)cout<<abs(a[1]-a[0]);
| ^~~~
a.cc:22:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:10: error: 'cout' was not declared in this scope
23 | else cout<<abs(a[i-1]-a[i]);
| ^~~~
a.cc:23:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:5: error: 'cout' was not declared in this scope
24 | cout<<endl;
| ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:11: error: 'endl' was not declared in this scope
24 | cout<<endl;
| ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
4 | #include<numeric>
+++ |+#include <ostream>
5 |
|
s378225727 | p03661 | C++ | #include<iosteam>
#include <string.h>
#include <algorithm>
#include<cstdlib>
typedef long long ll;
using namespace std;
int main()
{
ll n,a[200000],x = 0,y = 0,lim= 9223372036854775807,ans=0;
memset(a,0,sizeof(a));
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> a[i];
ans += a[i];
}
for(int i = 0; i < n-1; i++)
{
x += a[i];
if(abs(ans-2*x) <= lim)
{
lim = abs(ans-2*x);
}
}
cout << lim << endl;
} | a.cc:1:9: fatal error: iosteam: No such file or directory
1 | #include<iosteam>
| ^~~~~~~~~
compilation terminated.
|
s341365234 | p03661 | C++ | #include <string.h>
#include <algorithm>
#include<cstdlib>
typedef long long ll;
using namespace std;
int main()
{
ll n,a[200000],x = 0,y = 0,lim= 9223372036854775807,ans=0;
memset(a,0,sizeof(a));
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> a[i];
ans += a[i];
}
for(int i = 0; i < n-1; i++)
{
x += a[i];
if(abs(ans-2*x) <= lim)
{
lim = abs(ans-2*x);
}
}
cout << lim << endl;
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'cin' was not declared in this scope
11 | cin >> n;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include<cstdlib>
+++ |+#include <iostream>
4 | typedef long long ll;
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout << lim << endl;
| ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:20: error: 'endl' was not declared in this scope
27 | cout << lim << endl;
| ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
3 | #include<cstdlib>
+++ |+#include <ostream>
4 | typedef long long ll;
|
s430607779 | p03661 | C++ |
#include "pch.h"
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> a(N);
for (int i = 0;i < N;i++) {
cin >> a[i];
}
int x = 0;int y = N - x;
int Max = 1000000000;
for (int i = 1;i < N;i++) {
int xC = 0;
int yC = 0;
x = i;
for (int j = 0;j < x;j++) {
xC += a[j];
}
for (int k = x;k < y;k++) {
yC += a[k];
}
if (abs(xC - yC) < Max) {
Max = abs(xC - yC);
}
}
cout << Max << endl;
}
| a.cc:3:10: fatal error: pch.h: No such file or directory
3 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s463481543 | p03661 | C | #include<iostream>
#include<vector>
#include<string.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.
|
s263605898 | p03661 | C++ | Select Code
#include<stdio.h>
int n;
int list[200001];
long long int abs(long long int x) { return x<0 ? -x : x; }
int main() {
while (scanf("%d", &n) != EOF) {
long long int sum = 0;
for (int i = 0; i<n; i++) {
scanf("%d", &list[i]);
sum += list[i];
}
long long int sumi = 0;
long long int ans =1e18;
for (int i = 0; i<n-1; i++) {
sumi += list[i];
long long int tmp = abs(sum - 2 * sumi);
if (tmp<ans) ans = tmp;
}
printf("%I64d\n", ans);
}
return 0;
} | a.cc:1:1: error: 'Select' does not name a type
1 | Select Code
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:16: error: 'scanf' was not declared in this scope
7 | while (scanf("%d", &n) != EOF) {
| ^~~~~
a.cc:20:17: error: 'printf' was not declared in this scope
20 | printf("%I64d\n", ans);
| ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
2 | #include<stdio.h>
+++ |+#include <cstdio>
3 | int n;
|
s219884807 | p03661 | C++ | #include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
long long N;
long long Sum_t[200000]={0};
cin>>N;
cin>>Sum_t[0];
for(int i=1;i<N;i++)
{
cin>>Sum_t[i];
Sum_t[i]=Sum_t[i-1]+Sum_t[i];
}
long long min=abs(Sum[N-1]-2*Sum[0]);
for(int i=0;i<N;i++)
{
long long temp=abs(Sum[N-1]-2*Sum[i]);
if(temp<min) min=temp;
}
cout<<min;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:26: error: 'Sum' was not declared in this scope; did you mean 'Sum_t'?
18 | long long min=abs(Sum[N-1]-2*Sum[0]);
| ^~~
| Sum_t
|
s544348568 | p03661 | C | #include<stdio.h>
#include<math.h>
int main()
{
long long int s1,s2=0,min,x;
int N,i,p=1;
scanf("%d",&N);
long long int a[N];
for(i=0;i<N;i++)
{
scanf("%lld",&a[i]);
}
s1=a[0];
for(i=1;i<N;i++)
{
s2=s2+a[i];
}
min=llabs(s2-s1);
for(p=1;p<N-1;p++){
s1=s1+[p];
s2=s2-a[p];
x=llabs(s2-s1);
if(x<min)
min=x;
}
printf("%lld",min);
return 0;
} | main.c: In function 'main':
main.c:18:9: error: implicit declaration of function 'llabs' [-Wimplicit-function-declaration]
18 | min=llabs(s2-s1);
| ^~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'llabs'
2 | #include<math.h>
+++ |+#include <stdlib.h>
3 | int main()
main.c:18:9: warning: incompatible implicit declaration of built-in function 'llabs' [-Wbuiltin-declaration-mismatch]
18 | min=llabs(s2-s1);
| ^~~~~
main.c:18:9: note: include '<stdlib.h>' or provide a declaration of 'llabs'
main.c:20:11: error: expected expression before '[' token
20 | s1=s1+[p];
| ^
|
s820056671 | p03661 | C++ | #include<iostream>
#include<cmath>
using namespace std;
const long long size=2e+5;
long long a[size],b[size];
long long n,s,min=2e+10,result;
int main()
{
cin>>n>>a[0];
b[0]=a[0];
s=a[0];
for(int i=1;i<n;i++)
{
cin>>a[i];
b[i]=b[i-1]+a[i];
s+=a[i];
}
for(int i=0;i<n-1;i++)
{
result=abs(2*x[i]-s);
if(min>result)
min=result;
}
cout<<min;
return 0;
} | a.cc:5:21: error: reference to 'size' is ambiguous
5 | long long a[size],b[size];
| ^~~~
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: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:17: note: 'const long long int size'
4 | const long long size=2e+5;
| ^~~~
a.cc:5:29: error: reference to 'size' is ambiguous
5 | long long a[size],b[size];
| ^~~~
/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:17: note: 'const long long int size'
4 | const long long size=2e+5;
| ^~~~
a.cc: In function 'int main()':
a.cc:10:17: error: 'a' was not declared in this scope
10 | cin>>n>>a[0];
| ^
a.cc:11:6: error: 'b' was not declared in this scope
11 | b[0]=a[0];
| ^
a.cc:21:22: error: 'x' was not declared in this scope
21 | result=abs(2*x[i]-s);
| ^
a.cc:22:12: error: reference to 'min' is ambiguous
22 | if(min>result)
| ^~~
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:6:23: note: 'long long int min'
6 | long long n,s,min=2e+10,result;
| ^~~
a.cc:23:9: error: reference to 'min' is ambiguous
23 | min=result;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:6:23: note: 'long long int min'
6 | long long n,s,min=2e+10,result;
| ^~~
a.cc:25:15: error: reference to 'min' is ambiguous
25 | cout<<min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:6:23: note: 'long long int min'
6 | long long n,s,min=2e+10,result;
| ^~~
|
s096174768 | p03661 | C++ | #include<iostream>
#include<cmath>
using namespace std;
const long long size=2e+5;
long long a[size],x[size];
long long n,s;
int main()
{
cin>>n>>a[0];
x[0]=a[0];
s=a[0];
for(int i=1;i<n;i++)
{
cin>>a[i];
x[i]=x[i-1]+a[i];
s+=a[i];
}
long long min=2e+10,result;
for(int i=0;i<n-1;i++)
{
result=abs(2*x[i]-s);
if(min>result)
min=result;
}
cout<<min;
return 0;
| a.cc:5:21: error: reference to 'size' is ambiguous
5 | long long a[size],x[size];
| ^~~~
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: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:17: note: 'const long long int size'
4 | const long long size=2e+5;
| ^~~~
a.cc:5:29: error: reference to 'size' is ambiguous
5 | long long a[size],x[size];
| ^~~~
/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:17: note: 'const long long int size'
4 | const long long size=2e+5;
| ^~~~
a.cc: In function 'int main()':
a.cc:9:17: error: 'a' was not declared in this scope
9 | cin>>n>>a[0];
| ^
a.cc:10:6: error: 'x' was not declared in this scope
10 | x[0]=a[0];
| ^
a.cc:26:18: error: expected '}' at end of input
26 | return 0;
| ^
a.cc:8:1: note: to match this '{'
8 | {
| ^
|
s884319088 | p03661 | C++ | #include <iostream>
#include<cmath>
using namespace std ;
int sum(int a , int t[] ,int e)
{int sum=0,j;
for(j=a;j<e;++j)
sum+=t[j];
return sum;
}
int main()
{
int N,i,b;
cin>>N;
int *a= new int g [N];
for(i=0;i<N;++i)
cin>>a[i];
for(i=0;i<N-1;++i)
if(b>abs(sum(0,a,i+1)-sum(i+1,a,N))||i==0)
b=abs(sum(0,a,i+1)-sum(i+1,a,N));
cout<<b;
delete [] a;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:17: error: expected ',' or ';' before 'g'
14 | int *a= new int g [N];
| ^
|
s165318800 | p03661 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<windef.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | a.cc:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s764111970 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<windef.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c:3:9: fatal error: windows.h: No such file or directory
3 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s361949148 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
#include<windef.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c:3:9: fatal error: Windows.h: No such file or directory
3 | #include<Windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s407215300 | p03661 | C | #include<bits/stdc++.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s655731727 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c: In function 'main':
main.c:17:23: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
17 | Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
| ^~~
| main
|
s320029786 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min =1e9;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c: In function 'main':
main.c:16:23: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
16 | Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
| ^~~
| main
|
s839620071 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#define N 2*100000
long long a[N];
long long sum[N + 200];
long long Min = _INTEGRAL_MAX_BITS;
int main() {
long long n, m;
scanf("%lld", &n);
sum[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n - 1; i++) {
Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
}
printf("%lld\n", Min);
return 0;
} | main.c:6:17: error: '_INTEGRAL_MAX_BITS' undeclared here (not in a function)
6 | long long Min = _INTEGRAL_MAX_BITS;
| ^~~~~~~~~~~~~~~~~~
main.c: In function 'main':
main.c:16:23: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
16 | Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
| ^~~
| main
|
s874113965 | p03661 | C++ | #include "iostream"
#include "cmath.h"
#define MAX 100000;
using namespace std;
int main()
{
long int n;int idx=0;
long long int _sum[MAX];
long long int a[MAX];
long long int sum=0;
long long int min=MAX;
cin>>n;
for(idx=1;idx<=n;idx++){
cin>>a[idx];
_sum[idx]=_sum[idx-1]+a[idx];
sum+=a[idx];
}
for(idx=1;idx<n;idx++){
min=abs(2*_sum[idx]-sum);
if(min>abs(2*_sum[idx]-sum))
min=abs(2*_sum[idx]-sum);
}
cout<<min;
cunt<<endl;
return 0;
} | a.cc:2:10: fatal error: cmath.h: No such file or directory
2 | #include "cmath.h"
| ^~~~~~~~~
compilation terminated.
|
s466964621 | p03661 | C | #include "stdio.h"
#include "math.h"
#define MAX 1000000000
int main(){
long int n;
long long int min=0;
long long int a[MAX];
long long int _sum[MAX];
long long int sum=0;
int idx=0;
scanf("%ld",&n);
for(idx=1;idx<=n;idx++){
scanf("%lld",&a[idx]);
sum+=a[idx];
_sum[idx]=_sum[idx-1]+a[idx];
}
for(idx=1;idx<n;idx++){
min=abs(2*_sum[idx]-sum);
if(min>abs(2*_sum[idx]-sum))
min=abs(2*_sum[idx]-sum);
}
printf("%lld\n",min);
return 0; | main.c: In function 'main':
main.c:18:21: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
18 | min=abs(2*_sum[idx]-sum);
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include "math.h"
+++ |+#include <stdlib.h>
3 | #define MAX 1000000000
main.c:18:36: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
18 | min=abs(2*_sum[idx]-sum);
| ~~~~~~~~~~~^~~~
<built-in>: note: built-in 'abs' declared here
main.c:19:39: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
19 | if(min>abs(2*_sum[idx]-sum))
| ~~~~~~~~~~~^~~~
<built-in>: note: built-in 'abs' declared here
main.c:20:36: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
20 | min=abs(2*_sum[idx]-sum);
| ~~~~~~~~~~~^~~~
<built-in>: note: built-in 'abs' declared here
main.c:23:9: error: expected declaration or statement at end of input
23 | return 0;
| ^~~~~~
|
s579612810 | p03661 | C++ | #include<stdio.h>
#include<malloc.h>
int sum(long int *a, int n, int m)
{
long int sum = 0;
for (int i = n; i <= m; i++)
sum += a[i];
return sum;
}
int min(long long int *a, int n)
{
int flag,min=0;
for (int i = 0; i < n-1; i++)
{
if (a[i] > a[i + 1]) min = i + 1;
}
return a[min];
}
int main() {
int n;
long long *a, sumx, sumy, *m;
scanf("%d", &n);
a = (long long int*)malloc(n * sizeof(long long int));
m = (long long int *)malloc((n - 1) * sizeof(long long int));
for (int i = 0; i < n; i++)
scanf("%lld", &a[i]);
for (int i = 0; i < n-1; i++)
{
sumx=sum(a, 0, i);
sumy = sum(a, i + 1, n - 1);
m[i] = sumy - sumx<0?-(sumy-sumx):sumy-sumx;
}
printf("%lld", min(m, n-1));
free(a);
free(m);
} | a.cc: In function 'int main()':
a.cc:29:26: error: invalid conversion from 'long long int*' to 'long int*' [-fpermissive]
29 | sumx=sum(a, 0, i);
| ^
| |
| long long int*
a.cc:3:19: note: initializing argument 1 of 'int sum(long int*, int, int)'
3 | int sum(long int *a, int n, int m)
| ~~~~~~~~~~^
a.cc:30:28: error: invalid conversion from 'long long int*' to 'long int*' [-fpermissive]
30 | sumy = sum(a, i + 1, n - 1);
| ^
| |
| long long int*
a.cc:3:19: note: initializing argument 1 of 'int sum(long int*, int, int)'
3 | int sum(long int *a, int n, int m)
| ~~~~~~~~~~^
|
s399508099 | p03661 | C++ | int main()
{
long size,s,i;
s=i=0;
cin>>size;
long* a=new long[size];
long* b=new long[size];
for(i=0;i<size;i++)
{
cin>>a[i];
s+=a[i];
b[i]=s;
}
long k=abs(s-b[0]*2);
for(i=0;i<size-1;i++)
{
if(abs(s-b[i]*2)<k)
{
k=abs(s-b[i]*2);
}
}
cout<<k;
delete [] a;
delete [] b;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin>>size;
| ^~~
a.cc:14:16: error: 'abs' was not declared in this scope
14 | long k=abs(s-b[0]*2);
| ^~~
a.cc:22:9: error: 'cout' was not declared in this scope
22 | cout<<k;
| ^~~~
|
s432387722 | p03661 | C++ | #include<cmath>
using namespace std;
int main()
{
int N;
cin >> N;
int* a = new int[N],sum = 0,sum1 = 0,r1,r;
for(int i=0;i < N;i++)
{
cin >> a[i];
sum = sum + a[i];
}
r = abs(sum - 2 * a[1]);
for(int k = 0;k < N - 1;k++)
{
for(int i = 0;i < k + 1;i++)
sum1 = sum1 + a[i];
r1 = abs(sum - 2 * sum1);
if(r1 < r)
r = r1;
}
cout << r << endl;
delete []a;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin >> N;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<cmath>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:23:9: error: 'cout' was not declared in this scope
23 | cout << r << endl;
| ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:22: error: 'endl' was not declared in this scope
23 | cout << r << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<cmath>
+++ |+#include <ostream>
2 | using namespace std;
|
s379017104 | p03661 | C++ | #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int N;
cin >> N;
int* a = new int(N),sum = 0,sum1 = 0;
int* r = new int(N-1);
for(int i=0;i < N;i++)
{
cin >> a[i];
sum = sum + a[i];
}
for(int k = 0;k < N - 1;k++)
{
for(int i = 0;i < k + 1;i++)
sum1 = sum1 + a[i];
r[k] = abs(sum - 2*sum1);
}
int* j = min_element(r,r + N - 1);
cout << r[j-r] << endl;
delete []a
return 0;
} | a.cc: In function 'int main()':
a.cc:25:19: error: expected ';' before 'return'
25 | delete []a
| ^
| ;
26 | return 0;
| ~~~~~~
|
s311938035 | p03661 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
const int MOD=1e9+7;
const int qq=2e5+10;
long long sum[qq];
long long min(long long a, long long b)
{
return a<b?a:b;
}
int main()
{
int num;
scanf("%d",&num);
sum[0]=0;
for(int i=1;i<=num;i++)
{
scanf("%lld",sum+i);
sum[i]+=sum[i-1];
}
long long minx=1e18;
for( int i=1;i<num;i++)
{
minx =min(minx,abs(sum[i]-(sum[num]-sum[i])));
}
printf("%lld\n",minx);
return 0;
} | main.c:6:11: error: variably modified 'sum' at file scope
6 | long long sum[qq];
| ^~~
|
s334891435 | p03661 | C++ |
#include<iostream>
#include<math.h>
using namespace std;
#define MLimit 1000000000
char Result[50];
void Add(int a,int a_,int b,int b_,int &Re,int &Re_)
{
int temp;
if (a > 0)
{
if (b > 0)
{
temp = 1000000000 - b - a;
if (temp < 0)//向上越界
{
Re_=1+a_+b_;
Re = -temp;
}
else
{
Re_=a_+b_;
Re = a + b;
}
}
else
{
Re_ = a_ + b_;
Re = a + b;
}
}
else//a<0
{
if (b > 0)
{
Re_ = a_ + b_;
Re = a + b;
}
else
{
temp = -1000000000 - b - a;
if (temp > 0)//向下越界
{
Re_=a_+b_-1;
Re=-temp;
}
else
{
Re_ = a_ + b_;
Re = a + b;
}
}
}
}
void ToStr(int &a, int &a_, char Re[])
{
if (a_ < 0)//化为同号,且保证低位为正
{
if (a > 0)
{
a_++;
a =-( a - 1000000000);
}
else
{
a = -a;
}
}
else if(a_>0)
{
if (a < 0)
{
a_--;
a = a + 1000000000;
}
else;
}
else;
if (a == MLimit)
{
a_++;
a = 0;
}
if (a == -MLimit)
{
a_--;
a = 0;
}
char str[25];
if (a_ != 0)
{
itoa(a_, Re, 10);
itoa(a, str, 10);
strcat(Re, str);
}
else
{
itoa(a, Re, 10);
}
}
int main()
{
int N,*a;
scanf("%d", &N);
a = new int[N];
for (int i = 0; i < N; i++)
{
scanf("%d", &a[i]);
}
int S = 0,S_=0, S2 = 0,S2_=0, temp;
for (int i = 0; i < N; i++)
{
Add(S, S_, a[i],0, S, S_);
}
int m1=0,m1_ = 20000000,Temp1=0,Temp1_=0;
for (int i = 0; i < N-1; i++)
{
Add(S2, S2_, a[i], 0, S2, S2_);
Add(S2, S2_, S2, S2_, Temp1, Temp1_);
Add(S, S_, -Temp1, -Temp1_, Temp1, Temp1_);
if (Temp1_ < 0||(Temp1_ == 0&&Temp1<0))//取绝对值
{
Temp1 = -Temp1;
Temp1_ = -Temp1_;
}
else;
if (Temp1_ < m1_ || (Temp1_ == m1_&&Temp1 < m1))
{
m1 = Temp1;
m1_ = Temp1_;
}
}
ToStr(m1, m1_, Result);
printf("%s", Result);
} | a.cc: In function 'void ToStr(int&, int&, char*)':
a.cc:95:17: error: 'itoa' was not declared in this scope
95 | itoa(a_, Re, 10);
| ^~~~
a.cc:97:17: error: 'strcat' was not declared in this scope
97 | strcat(Re, str);
| ^~~~~~
a.cc:4:1: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<math.h>
+++ |+#include <cstring>
4 | using namespace std;
a.cc:101:17: error: 'itoa' was not declared in this scope
101 | itoa(a, Re, 10);
| ^~~~
|
s019500121 | p03661 | C++ | #include<iostream>
using namespace std;
int main()
{
const int size=2e+5;
int a[size];
int n,s=0;
cin>>n;
if(n<2||n>size)
return -1;
for(int i=0;i<n;i++)
{
cin>>a[i];
s+=a[i];
}
int min=size,x,y,sum;
for(int i=0;i<n-1;i++)
{
x=0;
y=0;
sum=0;
for(int j=0;j<=i;j++)
{
x+=a[j];
}
y=s-x;
if(x>=y)
sum=x-y;
else
sum=y-x;
if(min>sum)
min=sum;
}
cout<<min;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:16: error: unable to find numeric literal operator 'operator""\U0000ff1b'
22 | x=0;
| ^~~
|
s850621954 | p03661 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAXN=2e5+5;
const int MOD=1000000000;
const LL INF=(2e5)*(1e9)+5;
long long a[MAXN];
long long sum[MAXN];
int main()
{
int n;
while(cin>>n)
{
long long tot=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum[i]=sum[i-1]+a[i];
tot+=a[i];
}
long long Min=INF;
for(int i=1;i<n;i++)
{
if(Min>abs(2*sum[i]-tot))
Min=abs(2*sum[i]-tot);
}
cout<<Min<<endl;
}
return 0;
} | a.cc:9:7: error: 'LL' does not name a type
9 | const LL INF=(2e5)*(1e9)+5;
| ^~
a.cc: In function 'int main()':
a.cc:25:23: error: 'INF' was not declared in this scope
25 | long long Min=INF;
| ^~~
|
s293881783 | p03661 | C++ | #include<iostream>
#include<cmath>
using namespace std;
long long a[200000]={0};
long long min[200000] = {0};
int main()
{
int num, counts;
while (cin >> num)
{
for (int i = 0; i < num; i++)
cin >> a[i];//input comlete
int sum, latersum, frontsum, Min;
counts = sum = latersum = frontsum = Min = 0;
for (int i = 0; i < num; i++)
sum += a[i];
for (int j = 0; j < num-1; j++)
{
for (int k = num - counts - 2; k >= 0; k--)//k>0?
{
frontsum += a[k];//少了一个
counts++;
}
latersum = sum - frontsum;
min[j] = abs(latersum - frontsum);
frontsum = 0;
counts = j + 1;
}
Min = min[0];
for (int n = 1; n < num-1; n++)
if (min[n] < Min)
Min = min[n];
cout << Min;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:28:25: error: reference to 'min' is ambiguous
28 | min[j] = abs(latersum - frontsum);
| ^~~
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:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000] = {0};
| ^~~
a.cc:35:23: error: reference to 'min' is ambiguous
35 | Min = min[0];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000] = {0};
| ^~~
a.cc:37:29: error: reference to 'min' is ambiguous
37 | if (min[n] < Min)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000] = {0};
| ^~~
a.cc:38:39: error: reference to 'min' is ambiguous
38 | Min = min[n];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000] = {0};
| ^~~
|
s867373745 | p03661 | C++ | #include<iostream>
#include<cmath>
using namespace std;
long long a[200000];
long long min[200000];
int main()
{
int num, counts;
while (cin >> num)
{
for (int i = 0; i < num; i++)
cin >> a[i];//input comlete
int sum, latersum, frontsum, Min;
counts = sum = latersum = frontsum = Min = 0;
for (int i = 0; i < num; i++)
sum += a[i];
for (int j = 0; j < num-1; j++)
{
for (int k = num - counts - 2; k >= 0; k--)//k>0?
{
frontsum += a[k];//少了一个
counts++;
}
latersum = sum - frontsum;
min[j] = abs(latersum - frontsum);
frontsum = 0;
counts = j + 1;
}
Min = min[0];
for (int n = 1; n < num-1; n++)
if (min[n] < Min)
Min = min[n];
cout << Min;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:25: error: reference to 'min' is ambiguous
28 | min[j] = abs(latersum - frontsum);
| ^~~
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:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000];
| ^~~
a.cc:35:23: error: reference to 'min' is ambiguous
35 | Min = min[0];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000];
| ^~~
a.cc:37:29: error: reference to 'min' is ambiguous
37 | if (min[n] < Min)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000];
| ^~~
a.cc:38:39: error: reference to 'min' is ambiguous
38 | Min = min[n];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:11: note: 'long long int min [200000]'
5 | long long min[200000];
| ^~~
|
s259296045 | p03661 | C | #include <stdio.h>
#include <math.h>
int main()
{
int n=0;
scanf("%d",&n);
int sum[n]={0,0};
int tem;
for(int i=1;i<=n;i++)
{
scanf("%d",&tem);
sum[i]=sum[i-1]+tem;
}
int min=2147483647;
for (int i=1;i<n;i++)
{
if(min>abs(sum[n]-2*sum[i]))
{
min=abs(sum[n]-2*sum[i]);
}
}
printf("%d",min);
return 0;
} | main.c: In function 'main':
main.c:8:20: error: variable-sized object may not be initialized except with an empty initializer
8 | int sum[n]={0,0};
| ^
main.c:18:24: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
18 | if(min>abs(sum[n]-2*sum[i]))
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 | int main()
|
s569059528 | p03661 | C | #include <stdio.h>
#include <math.h>
int main()
{
int n=0;
scanf("%d",&n);
int sum[n]={0,0};
int tem;
for(int i=1;i<=n;i++)
{
scanf("%d",&tem);
sum[i]=sum[i-1]+tem;
}
int min=2147483647;
for (int i=1;i<n;i++)
{
if(min>abs(sum[n]-2*sum[i]))
{
min=abs(sum[n]-2*sum[i]);
}
}
printf("%d",min);
return 0;
} | main.c: In function 'main':
main.c:8:20: error: variable-sized object may not be initialized except with an empty initializer
8 | int sum[n]={0,0};
| ^
main.c:18:24: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
18 | if(min>abs(sum[n]-2*sum[i]))
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 | int main()
|
s152855476 | p03661 | C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int n;
while(scanf_s("%d", &n)&&2<=n<=2*pow(10,5))
break;
int *a=NULL;
a = (int *)malloc(sizeof(int)*n);
int i = 0;
while (scanf_s("%d", &a[i]) && i < n-1&&-pow(10,9)<=a[i]<=pow(10,9))
i++;
int sum = 0;
int j=0;
for ( j = 0; j<n; j++)
{
int x = j,y=0;
for (y = j+1; y < n; y++)
if (a[x] > a[y]) x = y;
if (j != x)
{
int t;
t = a[j];
a[j] = a[x];
a[x] = t;
}
sum += a[j];
}
int k ;
int sum_1 ;
int x;
for ( x = 1 ; x < n; x++)
{
sum_1 = 0;
int j;
for ( j = 0; j < n - x; j++)
sum_1 += a[j];
k = sum - 2 * sum_1;
if (k > 0 && x == 1)
{
printf("%d", k);
break;
}
else if (k == 0)
{
printf("0");
break;
}
else if (k < 0)
continue;
else
{
if (k >=(-1)*(k-2*a[j]))
{
printf("%d",(-1)*(k - 2* a[j])); break;
}
else
{
printf("%d", k);
break;
}
}
}
return 0;
} | main.c: In function 'main':
main.c:8:15: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
8 | while(scanf_s("%d", &n)&&2<=n<=2*pow(10,5))
| ^~~~~~~
| scanf
|
s282117141 | p03661 | C++ | #include<stdio.h>
long int abs_1(long int i){
if(i<0) return -i;
else return i;
}
int main()
{
int N,i,j;
long long int sum1=0,sum2=0;
scanf_s("%d",&N);
long int a[200000]={0},x,min=2e+9;
for(i=0;i<N;i++)
{
scanf_s("%ld",&a[i]);
}
for(i=0;i<N-1;i++)
{
sum1=0,sum2=0;
for(j=i;j>=0;j--)
{
sum1+=a[j];
}
for(j=i+1;j<N;j++)
{
sum2+=a[j];
}
x=abs_1(sum2-sum1);
if(x<=min)
{
min=x;
}
}
printf("%ld",min);
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
11 | scanf_s("%d",&N);
| ^~~~~~~
| scanf
|
s890782970 | p03661 | C++ | #include <stdio.h>
int main(){
int length;
int arr[200000];
int res[200000]={0};
int temp = 0;
int m = 2e5;
scanf("%d",&length);
for(int i=0;i<length;++i){
scanf("%d",&arr[i]);
}
res[0] = arr[0];
for(int i=1;i<length;++i){
res[i] += res[i-1] + arr[i];
}
for(int i=1;i<length;++i){
temp = abs(res[length-1]-res[i-1]*2);
m = min(temp,m);
}
printf("%d\n", m);
return 0;
} | a.cc: In function 'int main()':
a.cc:19:16: error: 'abs' was not declared in this scope
19 | temp = abs(res[length-1]-res[i-1]*2);
| ^~~
a.cc:20:13: error: 'min' was not declared in this scope; did you mean 'main'?
20 | m = min(temp,m);
| ^~~
| main
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.