# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
33225 | 2017-10-23T04:01:54 Z | model_code | Simurgh (IOI17_simurgh) | C++11 | 29 ms | 1936 KB |
#include "simurgh.h" using namespace std; const int MAX = 7; int par[MAX]; int find(int v) { return (par[v] == v ? v : par[v] = find(par[v])); } bool merge(int u, int v) { u = find(u); v = find(v); if (u == v) return false; par[u] = v; return true; } vector<int> find_roads(int n, vector<int> u, vector<int> v) { int m = v.size(); for (int mask = 0; mask < (1 << m); mask++) if (__builtin_popcount(mask) == n - 1) { for (int i = 0; i < n; i++) par[i] = i; bool valid = true; vector<int> edges; for (int i = 0; i < m; i++) if ((1 << i) & mask) { edges.push_back(i); valid &= merge(u[i], v[i]); } if (valid && count_common_roads(edges) == n-1) return edges; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1936 KB | correct |
2 | Correct | 29 ms | 1936 KB | correct |
3 | Correct | 29 ms | 1936 KB | correct |
4 | Correct | 0 ms | 1936 KB | correct |
5 | Correct | 0 ms | 1936 KB | correct |
6 | Correct | 0 ms | 1936 KB | correct |
7 | Correct | 0 ms | 1936 KB | correct |
8 | Correct | 0 ms | 1936 KB | correct |
9 | Correct | 0 ms | 1936 KB | correct |
10 | Correct | 0 ms | 1936 KB | correct |
11 | Correct | 0 ms | 1936 KB | correct |
12 | Correct | 0 ms | 1936 KB | correct |
13 | Correct | 13 ms | 1936 KB | correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1936 KB | correct |
2 | Correct | 29 ms | 1936 KB | correct |
3 | Correct | 29 ms | 1936 KB | correct |
4 | Correct | 0 ms | 1936 KB | correct |
5 | Correct | 0 ms | 1936 KB | correct |
6 | Correct | 0 ms | 1936 KB | correct |
7 | Correct | 0 ms | 1936 KB | correct |
8 | Correct | 0 ms | 1936 KB | correct |
9 | Correct | 0 ms | 1936 KB | correct |
10 | Correct | 0 ms | 1936 KB | correct |
11 | Correct | 0 ms | 1936 KB | correct |
12 | Correct | 0 ms | 1936 KB | correct |
13 | Correct | 13 ms | 1936 KB | correct |
14 | Incorrect | 0 ms | 1936 KB | WA in grader: NO |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1936 KB | correct |
2 | Correct | 29 ms | 1936 KB | correct |
3 | Correct | 29 ms | 1936 KB | correct |
4 | Correct | 0 ms | 1936 KB | correct |
5 | Correct | 0 ms | 1936 KB | correct |
6 | Correct | 0 ms | 1936 KB | correct |
7 | Correct | 0 ms | 1936 KB | correct |
8 | Correct | 0 ms | 1936 KB | correct |
9 | Correct | 0 ms | 1936 KB | correct |
10 | Correct | 0 ms | 1936 KB | correct |
11 | Correct | 0 ms | 1936 KB | correct |
12 | Correct | 0 ms | 1936 KB | correct |
13 | Correct | 13 ms | 1936 KB | correct |
14 | Incorrect | 0 ms | 1936 KB | WA in grader: NO |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1936 KB | correct |
2 | Incorrect | 0 ms | 1936 KB | WA in grader: NO |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1936 KB | correct |
2 | Correct | 29 ms | 1936 KB | correct |
3 | Correct | 29 ms | 1936 KB | correct |
4 | Correct | 0 ms | 1936 KB | correct |
5 | Correct | 0 ms | 1936 KB | correct |
6 | Correct | 0 ms | 1936 KB | correct |
7 | Correct | 0 ms | 1936 KB | correct |
8 | Correct | 0 ms | 1936 KB | correct |
9 | Correct | 0 ms | 1936 KB | correct |
10 | Correct | 0 ms | 1936 KB | correct |
11 | Correct | 0 ms | 1936 KB | correct |
12 | Correct | 0 ms | 1936 KB | correct |
13 | Correct | 13 ms | 1936 KB | correct |
14 | Incorrect | 0 ms | 1936 KB | WA in grader: NO |
15 | Halted | 0 ms | 0 KB | - |