# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599615 | 2022-07-19T16:52:16 Z | Ahmadsm2005 | Simurgh (IOI17_simurgh) | C++14 | 16 ms | 3540 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<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>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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | correct |
2 | Correct | 0 ms | 296 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 | 1 ms | 212 KB | correct |
9 | Correct | 0 ms | 212 KB | correct |
10 | Correct | 1 ms | 300 KB | correct |
11 | Correct | 0 ms | 300 KB | correct |
12 | Correct | 1 ms | 300 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 | 296 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 | 1 ms | 212 KB | correct |
9 | Correct | 0 ms | 212 KB | correct |
10 | Correct | 1 ms | 300 KB | correct |
11 | Correct | 0 ms | 300 KB | correct |
12 | Correct | 1 ms | 300 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 8 ms | 324 KB | correct |
15 | Correct | 6 ms | 212 KB | correct |
16 | Correct | 6 ms | 212 KB | correct |
17 | Correct | 9 ms | 316 KB | correct |
18 | Correct | 3 ms | 212 KB | correct |
19 | Correct | 8 ms | 320 KB | correct |
20 | Correct | 6 ms | 436 KB | correct |
21 | Correct | 6 ms | 212 KB | correct |
22 | Correct | 1 ms | 212 KB | correct |
23 | Correct | 0 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 | 1 ms | 296 KB | correct |
30 | Correct | 1 ms | 296 KB | correct |
31 | Correct | 1 ms | 212 KB | correct |
32 | Correct | 1 ms | 296 KB | correct |
33 | Correct | 1 ms | 300 KB | correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | correct |
2 | Correct | 0 ms | 296 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 | 1 ms | 212 KB | correct |
9 | Correct | 0 ms | 212 KB | correct |
10 | Correct | 1 ms | 300 KB | correct |
11 | Correct | 0 ms | 300 KB | correct |
12 | Correct | 1 ms | 300 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 8 ms | 324 KB | correct |
15 | Correct | 6 ms | 212 KB | correct |
16 | Correct | 6 ms | 212 KB | correct |
17 | Correct | 9 ms | 316 KB | correct |
18 | Correct | 3 ms | 212 KB | correct |
19 | Correct | 8 ms | 320 KB | correct |
20 | Correct | 6 ms | 436 KB | correct |
21 | Correct | 6 ms | 212 KB | correct |
22 | Correct | 1 ms | 212 KB | correct |
23 | Correct | 0 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 | 1 ms | 296 KB | correct |
30 | Correct | 1 ms | 296 KB | correct |
31 | Correct | 1 ms | 212 KB | correct |
32 | Correct | 1 ms | 296 KB | correct |
33 | Correct | 1 ms | 300 KB | correct |
34 | Runtime error | 6 ms | 1468 KB | Execution killed with signal 11 |
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 | 16 ms | 3540 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 | 296 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 | 1 ms | 212 KB | correct |
9 | Correct | 0 ms | 212 KB | correct |
10 | Correct | 1 ms | 300 KB | correct |
11 | Correct | 0 ms | 300 KB | correct |
12 | Correct | 1 ms | 300 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 8 ms | 324 KB | correct |
15 | Correct | 6 ms | 212 KB | correct |
16 | Correct | 6 ms | 212 KB | correct |
17 | Correct | 9 ms | 316 KB | correct |
18 | Correct | 3 ms | 212 KB | correct |
19 | Correct | 8 ms | 320 KB | correct |
20 | Correct | 6 ms | 436 KB | correct |
21 | Correct | 6 ms | 212 KB | correct |
22 | Correct | 1 ms | 212 KB | correct |
23 | Correct | 0 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 | 1 ms | 296 KB | correct |
30 | Correct | 1 ms | 296 KB | correct |
31 | Correct | 1 ms | 212 KB | correct |
32 | Correct | 1 ms | 296 KB | correct |
33 | Correct | 1 ms | 300 KB | correct |
34 | Runtime error | 6 ms | 1468 KB | Execution killed with signal 11 |
35 | Halted | 0 ms | 0 KB | - |