답안 #599611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599611 2022-07-19T16:46:44 Z Ahmadsm2005 Simurgh (IOI17_simurgh) C++17
0 / 100
1 ms 292 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;
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);
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:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
simurgh.cpp:22:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 | if(CUR.size()==n-2)
      |    ~~~~~~~~~~^~~~~
simurgh.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB correct
2 Incorrect 0 ms 212 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -