# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
766867 | 2023-06-26T08:20:04 Z | danikoynov | Simurgh (IOI17_simurgh) | C++14 | 86 ms | 1876 KB |
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; const int maxn = 510; struct disjoint_set_union { int par[maxn]; disjoint_set_union(){}; disjoint_set_union(int n) { for (int i = 0; i < n; i ++) par[i] = i; } int find_leader(int v) { if (v == par[v]) return v; return (par[v] = find_leader(par[v])); } bool is_connected(int v, int u) { return find_leader(v) == find_leader(u); } void unite(int v, int u) { v = find_leader(v); u = find_leader(u); if (v == u) return; par[v] = u; } }; int used[maxn * maxn]; vector<int> find_roads(int n, vector<int> u, vector<int> v) { vector < int > gold; int m = u.size(); while(gold.size() < n - 1) { disjoint_set_union dsu(n); int cp = n; vector < int > res; for (int edge : gold) { dsu.unite(u[edge], v[edge]); cp --; res.push_back(edge); } for (int j = 0; j < m && cp > 2; j ++) { if (!dsu.is_connected(u[j], v[j])) { dsu.unite(u[j], v[j]); cp --; res.push_back(j); } } vector < pair < int, int > > pot; for (int i = 0; i < m; i ++) { if (!dsu.is_connected(u[i], v[i]) && !used[i]) { used[i] = 1; pot.push_back({i, 0}); } } int mx = -1, rd = -1; for (int i = 0; i < pot.size(); i ++) { res.push_back(pot[i].first); pot[i].second = count_common_roads(res); if (pot[i].second > mx) { mx = pot[i].second; } res.pop_back(); } for (int i = 0; i < pot.size(); i ++) { if (pot[i].second == mx) gold.push_back(pot[i].first); } } return gold; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 212 KB | correct |
11 | Correct | 1 ms | 212 KB | correct |
12 | Correct | 0 ms | 212 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 212 KB | correct |
11 | Correct | 1 ms | 212 KB | correct |
12 | Correct | 0 ms | 212 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 1 ms | 212 KB | correct |
15 | Correct | 1 ms | 308 KB | correct |
16 | Correct | 1 ms | 212 KB | correct |
17 | Correct | 1 ms | 212 KB | correct |
18 | Correct | 1 ms | 212 KB | correct |
19 | Correct | 1 ms | 212 KB | correct |
20 | Correct | 1 ms | 212 KB | correct |
21 | Correct | 1 ms | 212 KB | correct |
22 | Correct | 1 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 | 2 ms | 212 KB | correct |
27 | Correct | 1 ms | 212 KB | correct |
28 | Correct | 1 ms | 212 KB | correct |
29 | Correct | 1 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 212 KB | correct |
11 | Correct | 1 ms | 212 KB | correct |
12 | Correct | 0 ms | 212 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 1 ms | 212 KB | correct |
15 | Correct | 1 ms | 308 KB | correct |
16 | Correct | 1 ms | 212 KB | correct |
17 | Correct | 1 ms | 212 KB | correct |
18 | Correct | 1 ms | 212 KB | correct |
19 | Correct | 1 ms | 212 KB | correct |
20 | Correct | 1 ms | 212 KB | correct |
21 | Correct | 1 ms | 212 KB | correct |
22 | Correct | 1 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 | 2 ms | 212 KB | correct |
27 | Correct | 1 ms | 212 KB | correct |
28 | Correct | 1 ms | 212 KB | correct |
29 | Correct | 1 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 | Correct | 86 ms | 864 KB | correct |
35 | Correct | 73 ms | 1064 KB | correct |
36 | Correct | 61 ms | 816 KB | correct |
37 | Correct | 4 ms | 312 KB | correct |
38 | Correct | 85 ms | 1064 KB | correct |
39 | Correct | 66 ms | 956 KB | correct |
40 | Correct | 52 ms | 724 KB | correct |
41 | Correct | 37 ms | 980 KB | correct |
42 | Correct | 64 ms | 1072 KB | correct |
43 | Correct | 44 ms | 728 KB | correct |
44 | Correct | 36 ms | 644 KB | correct |
45 | Correct | 43 ms | 704 KB | correct |
46 | Correct | 37 ms | 744 KB | correct |
47 | Correct | 15 ms | 316 KB | correct |
48 | Correct | 3 ms | 312 KB | correct |
49 | Correct | 5 ms | 344 KB | correct |
50 | Correct | 15 ms | 320 KB | correct |
51 | Correct | 41 ms | 692 KB | correct |
52 | Correct | 37 ms | 632 KB | correct |
53 | Correct | 33 ms | 592 KB | correct |
54 | Correct | 44 ms | 724 KB | correct |
55 | Correct | 50 ms | 716 KB | correct |
56 | Correct | 42 ms | 708 KB | correct |
57 | Correct | 42 ms | 724 KB | correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | correct |
2 | Correct | 0 ms | 212 KB | correct |
3 | Incorrect | 62 ms | 1876 KB | WA in grader: NO |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 212 KB | correct |
11 | Correct | 1 ms | 212 KB | correct |
12 | Correct | 0 ms | 212 KB | correct |
13 | Correct | 0 ms | 212 KB | correct |
14 | Correct | 1 ms | 212 KB | correct |
15 | Correct | 1 ms | 308 KB | correct |
16 | Correct | 1 ms | 212 KB | correct |
17 | Correct | 1 ms | 212 KB | correct |
18 | Correct | 1 ms | 212 KB | correct |
19 | Correct | 1 ms | 212 KB | correct |
20 | Correct | 1 ms | 212 KB | correct |
21 | Correct | 1 ms | 212 KB | correct |
22 | Correct | 1 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 | 2 ms | 212 KB | correct |
27 | Correct | 1 ms | 212 KB | correct |
28 | Correct | 1 ms | 212 KB | correct |
29 | Correct | 1 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 | Correct | 86 ms | 864 KB | correct |
35 | Correct | 73 ms | 1064 KB | correct |
36 | Correct | 61 ms | 816 KB | correct |
37 | Correct | 4 ms | 312 KB | correct |
38 | Correct | 85 ms | 1064 KB | correct |
39 | Correct | 66 ms | 956 KB | correct |
40 | Correct | 52 ms | 724 KB | correct |
41 | Correct | 37 ms | 980 KB | correct |
42 | Correct | 64 ms | 1072 KB | correct |
43 | Correct | 44 ms | 728 KB | correct |
44 | Correct | 36 ms | 644 KB | correct |
45 | Correct | 43 ms | 704 KB | correct |
46 | Correct | 37 ms | 744 KB | correct |
47 | Correct | 15 ms | 316 KB | correct |
48 | Correct | 3 ms | 312 KB | correct |
49 | Correct | 5 ms | 344 KB | correct |
50 | Correct | 15 ms | 320 KB | correct |
51 | Correct | 41 ms | 692 KB | correct |
52 | Correct | 37 ms | 632 KB | correct |
53 | Correct | 33 ms | 592 KB | correct |
54 | Correct | 44 ms | 724 KB | correct |
55 | Correct | 50 ms | 716 KB | correct |
56 | Correct | 42 ms | 708 KB | correct |
57 | Correct | 42 ms | 724 KB | correct |
58 | Correct | 0 ms | 212 KB | correct |
59 | Correct | 0 ms | 212 KB | correct |
60 | Incorrect | 62 ms | 1876 KB | WA in grader: NO |
61 | Halted | 0 ms | 0 KB | - |