# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
47899 |
2018-05-08T13:31:30 Z |
robert |
ICC (CEOI16_icc) |
C++14 |
|
0 ms |
0 KB |
#include "icc.h"
using namespace std;
const int MAXN = 110;
int UFDS[MAXN];
int p(int n){
if(UFDS[n]==n)
return n;
else
return UFDS[n] = p(UFDS[n]);
}
int merge(int i, int j){
UFDS[p(i)] = p(j);
}
void findRoad(){
for(int i=1; i<=N; i++){
// if(UFDS[i]==i){
for(int j=i+1; j<=N; j++){
if(p(j)!=p(i)){
//both i and j are leaders of their group
/* int *f = new int[110], *s = new int[110];
int fs=0, ss=0;
for(int x=1; x<=N; x++){
if(p(x)==i){
f[fs++] = x;
} else if(p(x)==j){
s[ss++] = x;
}
}
if(query(fs, ss, f, s)){
//found between which two sets a road has been built
merge(i, j);
setRoad
}
*/ int f[] = {i}, s[] = {j};
if(query(1, 1, f, s)){
merge(i, j);
setRoad(i, j);
return;
}
}
}
// }
}
}
void run(int N){
for(int n=0; n<=N; n++){
UFDS[n] = n;
}
for(int n=1; n<N; n++)
findRoad();
}
Compilation message
icc.cpp: In function 'int merge(int, int)':
icc.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
icc.cpp: In function 'void findRoad()':
icc.cpp:21:18: error: 'N' was not declared in this scope
for(int i=1; i<=N; i++){
^