답안 #219203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
219203 2020-04-04T14:10:58 Z dolphingarlic Izlet (COI19_izlet) C++14
컴파일 오류
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;std::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(){std::cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)std::cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)std::cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)std::cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}

Compilation message

izlet.cpp: In function 'int main()':
izlet.cpp:3:559: 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;std::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(){std::cin>>k>>n;FOR(i,1,n+1)FOR(j,1,n+1)std::cin>>a[i][j];F[1]=1;E();FOR(i,1,n+1)std::cout<<F[i]<<' ';cout<<'\n';FOR(i,1,n)std::cout<<A[i].first<<' '<<A[i].second<<'\n';return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^~~~
izlet.cpp:3:559: 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
                  ^~~~