# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599611 | 2022-07-19T16:46:44 Z | Ahmadsm2005 | Simurgh (IOI17_simurgh) | C++17 | 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |