# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169359 | 2019-12-20T05:34:05 Z | gabrielpessoa | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 12408 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; const int ms = 4e5+5; vector<int> g[ms]; int cur[ms]; int z = 0; main() { cin.tie(0); ios::sync_with_stdio(0); int n, k; cin >> n >> k; int maxS = 0; for (int i = 0; i < n; i++) { int d; cin >> d; maxS = max(maxS, d); g[i].resize(d); for(int j = 0; j < d; j++) { cin >> g[i][j]; } } int ans = 1; if(maxS <= 10) { for(int i = 0; i < n; i++) { int t = g[i].size(); for(int j = 0; j < (1 << t); j++) { vector<int> v = {i}; bool isGood = true; for(int k = 0; k < t; k++) { if(j & (1 << k)) { if(g[i][k] < i) { isGood = false; break; } v.push_back(g[i][k]); } } if(!isGood) continue; ++z; for(int k : v) { cur[k] = z; } bool possible = true; for(int k : v) { int cnt = 0; for(int l : g[k]) if(cur[l] == z) cnt++; if(cnt != v.size() -1) possible = false; } if(possible) ans = max(ans, (int) v.size()); } } } else if(n <= 5000 && k <= 3) { for(int i = 0; i < n; i++) { if(g[i].size() > 0) ans = max(ans, 2); set<int> s; for(int j : g[i]) { for(int k : g[j]) { if(s.count(k)) ans = max(ans, 3); } s.insert(j); } } } cout << ans << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Correct | 13 ms | 9976 KB | Output is correct |
4 | Correct | 36 ms | 10104 KB | Output is correct |
5 | Correct | 35 ms | 10104 KB | Output is correct |
6 | Correct | 13 ms | 9976 KB | Output is correct |
7 | Correct | 13 ms | 9980 KB | Output is correct |
8 | Correct | 10 ms | 9720 KB | Output is correct |
9 | Correct | 10 ms | 9720 KB | Output is correct |
10 | Correct | 10 ms | 9724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Correct | 13 ms | 9976 KB | Output is correct |
4 | Correct | 36 ms | 10104 KB | Output is correct |
5 | Correct | 35 ms | 10104 KB | Output is correct |
6 | Correct | 13 ms | 9976 KB | Output is correct |
7 | Correct | 13 ms | 9980 KB | Output is correct |
8 | Correct | 10 ms | 9720 KB | Output is correct |
9 | Correct | 10 ms | 9720 KB | Output is correct |
10 | Correct | 10 ms | 9724 KB | Output is correct |
11 | Correct | 36 ms | 10192 KB | Output is correct |
12 | Correct | 35 ms | 10076 KB | Output is correct |
13 | Correct | 10 ms | 9720 KB | Output is correct |
14 | Correct | 36 ms | 10104 KB | Output is correct |
15 | Correct | 10 ms | 9720 KB | Output is correct |
16 | Correct | 14 ms | 9948 KB | Output is correct |
17 | Correct | 10 ms | 9720 KB | Output is correct |
18 | Correct | 13 ms | 9980 KB | Output is correct |
19 | Correct | 10 ms | 9720 KB | Output is correct |
20 | Correct | 12 ms | 9900 KB | Output is correct |
21 | Correct | 12 ms | 9976 KB | Output is correct |
22 | Correct | 10 ms | 9720 KB | Output is correct |
23 | Correct | 17 ms | 9976 KB | Output is correct |
24 | Correct | 10 ms | 9720 KB | Output is correct |
25 | Correct | 17 ms | 9948 KB | Output is correct |
26 | Correct | 16 ms | 9976 KB | Output is correct |
27 | Correct | 13 ms | 9976 KB | Output is correct |
28 | Correct | 16 ms | 9976 KB | Output is correct |
29 | Correct | 13 ms | 9848 KB | Output is correct |
30 | Correct | 19 ms | 9976 KB | Output is correct |
31 | Correct | 16 ms | 9848 KB | Output is correct |
32 | Correct | 19 ms | 9976 KB | Output is correct |
33 | Correct | 16 ms | 9848 KB | Output is correct |
34 | Correct | 16 ms | 9848 KB | Output is correct |
35 | Correct | 13 ms | 9848 KB | Output is correct |
36 | Correct | 13 ms | 9848 KB | Output is correct |
37 | Correct | 13 ms | 9844 KB | Output is correct |
38 | Correct | 11 ms | 9848 KB | Output is correct |
39 | Correct | 11 ms | 9720 KB | Output is correct |
40 | Correct | 16 ms | 9848 KB | Output is correct |
41 | Correct | 12 ms | 9848 KB | Output is correct |
42 | Correct | 16 ms | 9976 KB | Output is correct |
43 | Correct | 17 ms | 9976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Correct | 10 ms | 9720 KB | Output is correct |
4 | Correct | 10 ms | 9724 KB | Output is correct |
5 | Correct | 10 ms | 9720 KB | Output is correct |
6 | Correct | 10 ms | 9720 KB | Output is correct |
7 | Correct | 10 ms | 9720 KB | Output is correct |
8 | Correct | 10 ms | 9772 KB | Output is correct |
9 | Correct | 10 ms | 9720 KB | Output is correct |
10 | Correct | 10 ms | 9720 KB | Output is correct |
11 | Execution timed out | 3026 ms | 12408 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Correct | 13 ms | 9976 KB | Output is correct |
4 | Correct | 36 ms | 10104 KB | Output is correct |
5 | Correct | 35 ms | 10104 KB | Output is correct |
6 | Correct | 13 ms | 9976 KB | Output is correct |
7 | Correct | 13 ms | 9980 KB | Output is correct |
8 | Correct | 10 ms | 9720 KB | Output is correct |
9 | Correct | 10 ms | 9720 KB | Output is correct |
10 | Correct | 10 ms | 9724 KB | Output is correct |
11 | Correct | 36 ms | 10192 KB | Output is correct |
12 | Correct | 35 ms | 10076 KB | Output is correct |
13 | Correct | 10 ms | 9720 KB | Output is correct |
14 | Correct | 36 ms | 10104 KB | Output is correct |
15 | Correct | 10 ms | 9720 KB | Output is correct |
16 | Correct | 14 ms | 9948 KB | Output is correct |
17 | Correct | 10 ms | 9720 KB | Output is correct |
18 | Correct | 13 ms | 9980 KB | Output is correct |
19 | Correct | 10 ms | 9720 KB | Output is correct |
20 | Correct | 12 ms | 9900 KB | Output is correct |
21 | Correct | 12 ms | 9976 KB | Output is correct |
22 | Correct | 10 ms | 9720 KB | Output is correct |
23 | Correct | 17 ms | 9976 KB | Output is correct |
24 | Correct | 10 ms | 9720 KB | Output is correct |
25 | Correct | 17 ms | 9948 KB | Output is correct |
26 | Correct | 16 ms | 9976 KB | Output is correct |
27 | Correct | 13 ms | 9976 KB | Output is correct |
28 | Correct | 16 ms | 9976 KB | Output is correct |
29 | Correct | 13 ms | 9848 KB | Output is correct |
30 | Correct | 19 ms | 9976 KB | Output is correct |
31 | Correct | 16 ms | 9848 KB | Output is correct |
32 | Correct | 19 ms | 9976 KB | Output is correct |
33 | Correct | 16 ms | 9848 KB | Output is correct |
34 | Correct | 16 ms | 9848 KB | Output is correct |
35 | Correct | 13 ms | 9848 KB | Output is correct |
36 | Correct | 13 ms | 9848 KB | Output is correct |
37 | Correct | 13 ms | 9844 KB | Output is correct |
38 | Correct | 11 ms | 9848 KB | Output is correct |
39 | Correct | 11 ms | 9720 KB | Output is correct |
40 | Correct | 16 ms | 9848 KB | Output is correct |
41 | Correct | 12 ms | 9848 KB | Output is correct |
42 | Correct | 16 ms | 9976 KB | Output is correct |
43 | Correct | 17 ms | 9976 KB | Output is correct |
44 | Correct | 212 ms | 10036 KB | Output is correct |
45 | Correct | 12 ms | 9720 KB | Output is correct |
46 | Incorrect | 15 ms | 9976 KB | Output isn't correct |
47 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Correct | 13 ms | 9976 KB | Output is correct |
4 | Correct | 36 ms | 10104 KB | Output is correct |
5 | Correct | 35 ms | 10104 KB | Output is correct |
6 | Correct | 13 ms | 9976 KB | Output is correct |
7 | Correct | 13 ms | 9980 KB | Output is correct |
8 | Correct | 10 ms | 9720 KB | Output is correct |
9 | Correct | 10 ms | 9720 KB | Output is correct |
10 | Correct | 10 ms | 9724 KB | Output is correct |
11 | Correct | 36 ms | 10192 KB | Output is correct |
12 | Correct | 35 ms | 10076 KB | Output is correct |
13 | Correct | 10 ms | 9720 KB | Output is correct |
14 | Correct | 36 ms | 10104 KB | Output is correct |
15 | Correct | 10 ms | 9720 KB | Output is correct |
16 | Correct | 14 ms | 9948 KB | Output is correct |
17 | Correct | 10 ms | 9720 KB | Output is correct |
18 | Correct | 13 ms | 9980 KB | Output is correct |
19 | Correct | 10 ms | 9720 KB | Output is correct |
20 | Correct | 12 ms | 9900 KB | Output is correct |
21 | Correct | 12 ms | 9976 KB | Output is correct |
22 | Correct | 10 ms | 9720 KB | Output is correct |
23 | Correct | 17 ms | 9976 KB | Output is correct |
24 | Correct | 10 ms | 9720 KB | Output is correct |
25 | Correct | 17 ms | 9948 KB | Output is correct |
26 | Correct | 16 ms | 9976 KB | Output is correct |
27 | Correct | 13 ms | 9976 KB | Output is correct |
28 | Correct | 16 ms | 9976 KB | Output is correct |
29 | Correct | 13 ms | 9848 KB | Output is correct |
30 | Correct | 19 ms | 9976 KB | Output is correct |
31 | Correct | 16 ms | 9848 KB | Output is correct |
32 | Correct | 19 ms | 9976 KB | Output is correct |
33 | Correct | 16 ms | 9848 KB | Output is correct |
34 | Correct | 16 ms | 9848 KB | Output is correct |
35 | Correct | 13 ms | 9848 KB | Output is correct |
36 | Correct | 13 ms | 9848 KB | Output is correct |
37 | Correct | 13 ms | 9844 KB | Output is correct |
38 | Correct | 11 ms | 9848 KB | Output is correct |
39 | Correct | 11 ms | 9720 KB | Output is correct |
40 | Correct | 16 ms | 9848 KB | Output is correct |
41 | Correct | 12 ms | 9848 KB | Output is correct |
42 | Correct | 16 ms | 9976 KB | Output is correct |
43 | Correct | 17 ms | 9976 KB | Output is correct |
44 | Correct | 12 ms | 9720 KB | Output is correct |
45 | Incorrect | 52 ms | 11640 KB | Output isn't correct |
46 | Halted | 0 ms | 0 KB | - |