# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
828230 | 2023-08-17T06:54:01 Z | Minindu206 | Simurgh (IOI17_simurgh) | C++14 | 4 ms | 340 KB |
#include "simurgh.h" #include<bits/stdc++.h> using namespace std; struct dsu { int n; vector<int> rank, parent; void init(int _n) { this->n = _n; rank.resize(n + 1, 0); parent.resize(n + 1, -1); } int finds(int i) { if(parent[i] == -1) return i; return parent[i] = finds(parent[i]); } void unions(int a, int b) { int s1 = finds(a); int s2 = finds(b); if(s1 == s2) return; if(rank[s1] < rank[s2]) swap(s1, s2); parent[s2] = s1; rank[s1] += rank[s2]; } }; vector<int> find_roads(int n, vector<int> u, vector<int> v) { int m = u.size(); dsu d; for(int i=0;i<(1<<m);i++) { vector<int> arr; d.init(n); int flag = 1; for(int j=0;j<m;j++) { if(!(i & (1 << j))) continue; if(d.finds(u[j]) == d.finds(v[j])) flag = 0; d.unions(u[j], v[j]); arr.push_back(j); } for(int j=1;j<n;j++) { if(d.finds(j) != d.finds(0)) flag = 0; } if(!flag) continue; if(count_common_roads(arr) == n - 1) return arr; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | correct |
2 | Runtime error | 4 ms | 340 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |