Submission #599616

# Submission time Handle Problem Language Result Execution time Memory
599616 2022-07-19T16:52:43 Z Ahmadsm2005 Simurgh (IOI17_simurgh) C++14
30 / 100
142 ms 2968 KB
#include<bits/stdc++.h>
#include "simurgh.h"
//#include "grader.cpp"
using namespace std;
int DSU[300],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<CUR2.size();i++){
int A=FIND(u[CUR2[i]]),B=FIND(v[CUR2[i]]);
DSU[A]=B;
}
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;
DSU[A]=B;
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>30000)
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<CUR2.size();i++){
      |             ~^~~~~~~~~~~~
simurgh.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
simurgh.cpp:27:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 | if(CUR.size()==n-2)
      |    ~~~~~~~~~~^~~~~
simurgh.cpp:36:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 | for(int i=0;i<u.size();i++){
      |             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Correct 0 ms 212 KB correct
3 Correct 0 ms 212 KB correct
4 Correct 0 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 0 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 0 ms 212 KB correct
13 Correct 0 ms 212 KB correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Correct 0 ms 212 KB correct
3 Correct 0 ms 212 KB correct
4 Correct 0 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 0 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 0 ms 212 KB correct
13 Correct 0 ms 212 KB correct
14 Correct 8 ms 212 KB correct
15 Correct 6 ms 324 KB correct
16 Correct 5 ms 320 KB correct
17 Correct 8 ms 212 KB correct
18 Correct 2 ms 212 KB correct
19 Correct 7 ms 212 KB correct
20 Correct 6 ms 212 KB correct
21 Correct 6 ms 212 KB correct
22 Correct 0 ms 212 KB correct
23 Correct 1 ms 212 KB correct
24 Correct 1 ms 212 KB correct
25 Correct 1 ms 212 KB correct
26 Correct 1 ms 212 KB correct
27 Correct 1 ms 212 KB correct
28 Correct 0 ms 212 KB correct
29 Correct 0 ms 212 KB correct
30 Correct 1 ms 212 KB correct
31 Correct 1 ms 212 KB correct
32 Correct 1 ms 212 KB correct
33 Correct 1 ms 212 KB correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Correct 0 ms 212 KB correct
3 Correct 0 ms 212 KB correct
4 Correct 0 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 0 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 0 ms 212 KB correct
13 Correct 0 ms 212 KB correct
14 Correct 8 ms 212 KB correct
15 Correct 6 ms 324 KB correct
16 Correct 5 ms 320 KB correct
17 Correct 8 ms 212 KB correct
18 Correct 2 ms 212 KB correct
19 Correct 7 ms 212 KB correct
20 Correct 6 ms 212 KB correct
21 Correct 6 ms 212 KB correct
22 Correct 0 ms 212 KB correct
23 Correct 1 ms 212 KB correct
24 Correct 1 ms 212 KB correct
25 Correct 1 ms 212 KB correct
26 Correct 1 ms 212 KB correct
27 Correct 1 ms 212 KB correct
28 Correct 0 ms 212 KB correct
29 Correct 0 ms 212 KB correct
30 Correct 1 ms 212 KB correct
31 Correct 1 ms 212 KB correct
32 Correct 1 ms 212 KB correct
33 Correct 1 ms 212 KB correct
34 Incorrect 142 ms 744 KB WA in grader: NO
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Correct 0 ms 212 KB correct
3 Runtime error 15 ms 2968 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Correct 0 ms 212 KB correct
3 Correct 0 ms 212 KB correct
4 Correct 0 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 0 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 0 ms 212 KB correct
13 Correct 0 ms 212 KB correct
14 Correct 8 ms 212 KB correct
15 Correct 6 ms 324 KB correct
16 Correct 5 ms 320 KB correct
17 Correct 8 ms 212 KB correct
18 Correct 2 ms 212 KB correct
19 Correct 7 ms 212 KB correct
20 Correct 6 ms 212 KB correct
21 Correct 6 ms 212 KB correct
22 Correct 0 ms 212 KB correct
23 Correct 1 ms 212 KB correct
24 Correct 1 ms 212 KB correct
25 Correct 1 ms 212 KB correct
26 Correct 1 ms 212 KB correct
27 Correct 1 ms 212 KB correct
28 Correct 0 ms 212 KB correct
29 Correct 0 ms 212 KB correct
30 Correct 1 ms 212 KB correct
31 Correct 1 ms 212 KB correct
32 Correct 1 ms 212 KB correct
33 Correct 1 ms 212 KB correct
34 Incorrect 142 ms 744 KB WA in grader: NO
35 Halted 0 ms 0 KB -