Submission #219202

# Submission time Handle Problem Language Result Execution time Memory
219202 2020-04-04T14:10:08 Z dolphingarlic Izlet (COI19_izlet) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i=x;i < y;i++)
int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}

Compilation message

izlet.cpp:3:89: error: 'pair' does not name a type; did you mean 'wait'?
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                         ^~~~
                                                                                         wait
izlet.cpp: In function 'void E(int)':
izlet.cpp:3:246: error: 'A' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                      ^
izlet.cpp:3:422: error: 'A' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
izlet.cpp: In function 'int main()':
izlet.cpp:3:453: error: 'cin' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^~~
izlet.cpp:3:453: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from izlet.cpp:1:
/usr/include/c++/7/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^~~
izlet.cpp:3:523: error: 'cout' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^~~~
izlet.cpp:3:523: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from izlet.cpp:1:
/usr/include/c++/7/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
izlet.cpp:3:539: error: 'cout' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^~~~
izlet.cpp:3:539: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from izlet.cpp:1:
/usr/include/c++/7/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
izlet.cpp:3:566: error: 'A' was not declared in this scope
 int k,n,a[3001][3001],D[3001][3001];int F[3001],c=1,e=1;bool B[3001];std::vector<int> C;pair<int,int> A[3001];void E(int N=1){B[N]=true;C.push_back(N);FOR(i,1,n+1)if(!B[i]&&a[N][i]==1){B[i]=true;F[i]=F[N];for(int j : C)D[i][j]=D[j][i]=D[N][j]+1;A[e++]={N,i};}FOR(i,1,n+1)if(!B[i]&&a[N][i]==2){int M=0;for(int j : C){D[i][j]=D[j][i]=D[N][j]+1;if(a[i][j]==a[N][j]&&(!M||D[i][j] < D[i][M]))M=j;}if(M)F[i]=F[M];else F[i]=++c;A[e++]={N,i};E(i);}}int main(){cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^