답안 #599612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599612 2022-07-19T16:49:04 Z Ahmadsm2005 Simurgh (IOI17_simurgh) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "simurgh.h"
#include "grader.cpp"
using namespace std;
int DSU[51],N;
int FIND(int x){
if(DSU[x]==x)
return x;
return DSU[x]=FIND(DSU[x]);
}
void CLEAR(){
for(int i=0;i<N;i++)
DSU[i]=i;
}
vector<int>find_roads(int n, vector<int>u, vector<int>v){
N=n;
CLEAR();
vector<int>CUR,CUR2;
int Q=0;
while(1){
CUR=CUR2;
for(int i=0;i<u.size();i++){
if(CUR.size()==n-2)
break;
int A=FIND(u[i]),B=FIND(v[i]);
if(A==B)
continue;
CUR.push_back(i);
}
int MX=-1,BEST;
for(int i=0;i<u.size();i++){
int A=FIND(u[i]),B=FIND(v[i]);
if(A==B)
continue;
CUR.push_back(i);
int Z=count_common_roads(CUR);
Q++;
if(Q>20000)
exit(1);
if(Z==n-1)
return CUR;
if(Z>MX)
MX=Z,BEST=i;
CUR.pop_back();
}
CUR2.push_back(BEST);
CLEAR();
}
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:22:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
simurgh.cpp:23:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 | if(CUR.size()==n-2)
      |    ~~~~~~~~~~^~~~~
simurgh.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
/usr/bin/ld: /tmp/ccY1h6LV.o: in function `count_common_roads(std::vector<int, std::allocator<int> > const&)':
grader.cpp:(.text+0x370): multiple definition of `count_common_roads(std::vector<int, std::allocator<int> > const&)'; /tmp/ccsjFakU.o:simurgh.cpp:(.text+0x440): first defined here
/usr/bin/ld: /tmp/ccY1h6LV.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccsjFakU.o:simurgh.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status