foo.cc:5:13: error: array bound is not an integer constant before ']' token
int pre[MAXN];
^
foo.cc: In function 'int find(int)':
foo.cc:8:11: error: 'pre' was not declared in this scope
if (x == pre[x]) return x;
^~~
foo.cc:8:11: note: suggested alternative: 'drem'
if (x == pre[x]) return x;
^~~
drem
foo.cc:9:9: error: 'pre' was not declared in this scope
return pre[x] = find(pre[x])
^~~
foo.cc:9:9: note: suggested alternative: 'drem'
return pre[x] = find(pre[x])
^~~
drem
foo.cc:10:1: error: expected ';' before '}' token
}
^
foo.cc: At global scope:
foo.cc:12:11: error: expected identifier before '(' token
void union(int x, int y){
^
foo.cc:12:12: error: expected unqualified-id before 'int'
void union(int x, int y){
^~~
foo.cc:12:12: error: expected ')' before 'int'
foo.cc: In function 'int main()':
foo.cc:23:27: error: 'pre' was not declared in this scope
for (int i=0; i<n; ++i) pre[i] = i;
^~~
foo.cc:23:27: note: suggested alternative: 'drem'
for (int i=0; i<n; ++i) pre[i] = i;
^~~
drem
foo.cc:26:4: error: expected primary-expression before 'union'
union(a,b);
^~~~~
foo.cc:25:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&a,&b);
~~~~~^~~~~~~~~~~~~~
foo.cc:29:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&a,&b);
~~~~~^~~~~~~~~~~~~~
自豪的采用HydroJudge(https://github.com/hydro-dev/Hydro)进行评测。