이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "game.h"
using namespace std;
int n,m,k,l,i,j,a,b;
void initialize(int n) {
for(int i=0;i<n*(n-1)/2;i++)
{
cin>>a>>b;
cout<<hasEdge(a,b);
}
}
void unite(int a,int b){
sz[a]+=sz[b];
for(int i=0;i<n;i++){
if(col[i]==b) col[i]=a;
d[a][i]+=d[b][i];
}
}
int hasEdge(int u, int v) {
if(d[col[a]][col[b]]+1==sz[a]*sz[b])
{
unite(col[a],col[b]);
return 1;
}
else
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
game.cpp: In function 'void unite(int, int)':
game.cpp:17:5: error: 'sz' was not declared in this scope
sz[a]+=sz[b];
^~
game.cpp:19:12: error: 'col' was not declared in this scope
if(col[i]==b) col[i]=a;
^~~
game.cpp:19:12: note: suggested alternative: 'cosl'
if(col[i]==b) col[i]=a;
^~~
cosl
game.cpp:20:9: error: 'd' was not declared in this scope
d[a][i]+=d[b][i];
^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:25:8: error: 'd' was not declared in this scope
if(d[col[a]][col[b]]+1==sz[a]*sz[b])
^
game.cpp:25:10: error: 'col' was not declared in this scope
if(d[col[a]][col[b]]+1==sz[a]*sz[b])
^~~
game.cpp:25:10: note: suggested alternative: 'cosl'
if(d[col[a]][col[b]]+1==sz[a]*sz[b])
^~~
cosl
game.cpp:25:29: error: 'sz' was not declared in this scope
if(d[col[a]][col[b]]+1==sz[a]*sz[b])
^~
game.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^