# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115852 | 2024-11-21T02:48:31 Z | Thanhs | Political Development (BOI17_politicaldevelopment) | C++17 | 3000 ms | 33036 KB |
#include <bits/stdc++.h> using namespace std; #define name "TENBAI" #define fi first #define se second #define int long long #define endl '\n' #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count()); int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 5e4 + 5; int ans = 1, n, k; bitset<NM> g; void solve() { cin >> n >> k; vector<vector<int>> v; for (int i = 0; i < n; i++) { g.reset(); int t; cin >> t; while (t--) { int x; cin >> x; g[x] = 1; } for (int k = v.size(), j = 0; j < k; j++) { bool sus = 0; for (int x : v[j]) if (!g[x]) { sus = 1; break; } if (!sus) { v.push_back(v[j]); v.back().push_back(i); setmax(ans, (int)v.back().size()); } } v.push_back(vector<int>(1, i)); } cout << ans; } signed main() { if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } else if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int tc = 1; // cin >> tc; while (tc--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 32 ms | 964 KB | Output is correct |
4 | Correct | 41 ms | 1100 KB | Output is correct |
5 | Correct | 39 ms | 1076 KB | Output is correct |
6 | Correct | 32 ms | 1104 KB | Output is correct |
7 | Correct | 32 ms | 1096 KB | Output is correct |
8 | Correct | 20 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 19 ms | 688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 32 ms | 964 KB | Output is correct |
4 | Correct | 41 ms | 1100 KB | Output is correct |
5 | Correct | 39 ms | 1076 KB | Output is correct |
6 | Correct | 32 ms | 1104 KB | Output is correct |
7 | Correct | 32 ms | 1096 KB | Output is correct |
8 | Correct | 20 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 19 ms | 688 KB | Output is correct |
11 | Correct | 48 ms | 1104 KB | Output is correct |
12 | Correct | 39 ms | 1096 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 33 ms | 1104 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 34 ms | 1016 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 32 ms | 1104 KB | Output is correct |
19 | Correct | 20 ms | 592 KB | Output is correct |
20 | Correct | 28 ms | 848 KB | Output is correct |
21 | Correct | 26 ms | 864 KB | Output is correct |
22 | Correct | 19 ms | 812 KB | Output is correct |
23 | Correct | 37 ms | 1104 KB | Output is correct |
24 | Correct | 19 ms | 592 KB | Output is correct |
25 | Correct | 35 ms | 1096 KB | Output is correct |
26 | Correct | 33 ms | 1096 KB | Output is correct |
27 | Correct | 32 ms | 1096 KB | Output is correct |
28 | Correct | 44 ms | 1100 KB | Output is correct |
29 | Correct | 33 ms | 1104 KB | Output is correct |
30 | Correct | 41 ms | 976 KB | Output is correct |
31 | Correct | 38 ms | 1104 KB | Output is correct |
32 | Correct | 46 ms | 1108 KB | Output is correct |
33 | Correct | 36 ms | 1104 KB | Output is correct |
34 | Correct | 36 ms | 1104 KB | Output is correct |
35 | Correct | 11 ms | 760 KB | Output is correct |
36 | Correct | 11 ms | 800 KB | Output is correct |
37 | Correct | 11 ms | 592 KB | Output is correct |
38 | Correct | 4 ms | 584 KB | Output is correct |
39 | Correct | 5 ms | 592 KB | Output is correct |
40 | Correct | 47 ms | 1220 KB | Output is correct |
41 | Correct | 4 ms | 592 KB | Output is correct |
42 | Correct | 45 ms | 1048 KB | Output is correct |
43 | Correct | 46 ms | 1156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 592 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 508 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Execution timed out | 3067 ms | 11616 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 32 ms | 964 KB | Output is correct |
4 | Correct | 41 ms | 1100 KB | Output is correct |
5 | Correct | 39 ms | 1076 KB | Output is correct |
6 | Correct | 32 ms | 1104 KB | Output is correct |
7 | Correct | 32 ms | 1096 KB | Output is correct |
8 | Correct | 20 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 19 ms | 688 KB | Output is correct |
11 | Correct | 48 ms | 1104 KB | Output is correct |
12 | Correct | 39 ms | 1096 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 33 ms | 1104 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 34 ms | 1016 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 32 ms | 1104 KB | Output is correct |
19 | Correct | 20 ms | 592 KB | Output is correct |
20 | Correct | 28 ms | 848 KB | Output is correct |
21 | Correct | 26 ms | 864 KB | Output is correct |
22 | Correct | 19 ms | 812 KB | Output is correct |
23 | Correct | 37 ms | 1104 KB | Output is correct |
24 | Correct | 19 ms | 592 KB | Output is correct |
25 | Correct | 35 ms | 1096 KB | Output is correct |
26 | Correct | 33 ms | 1096 KB | Output is correct |
27 | Correct | 32 ms | 1096 KB | Output is correct |
28 | Correct | 44 ms | 1100 KB | Output is correct |
29 | Correct | 33 ms | 1104 KB | Output is correct |
30 | Correct | 41 ms | 976 KB | Output is correct |
31 | Correct | 38 ms | 1104 KB | Output is correct |
32 | Correct | 46 ms | 1108 KB | Output is correct |
33 | Correct | 36 ms | 1104 KB | Output is correct |
34 | Correct | 36 ms | 1104 KB | Output is correct |
35 | Correct | 11 ms | 760 KB | Output is correct |
36 | Correct | 11 ms | 800 KB | Output is correct |
37 | Correct | 11 ms | 592 KB | Output is correct |
38 | Correct | 4 ms | 584 KB | Output is correct |
39 | Correct | 5 ms | 592 KB | Output is correct |
40 | Correct | 47 ms | 1220 KB | Output is correct |
41 | Correct | 4 ms | 592 KB | Output is correct |
42 | Correct | 45 ms | 1048 KB | Output is correct |
43 | Correct | 46 ms | 1156 KB | Output is correct |
44 | Correct | 622 ms | 33036 KB | Output is correct |
45 | Correct | 1 ms | 336 KB | Output is correct |
46 | Correct | 46 ms | 1240 KB | Output is correct |
47 | Correct | 89 ms | 1788 KB | Output is correct |
48 | Correct | 47 ms | 1096 KB | Output is correct |
49 | Correct | 71 ms | 1796 KB | Output is correct |
50 | Correct | 93 ms | 1676 KB | Output is correct |
51 | Correct | 161 ms | 3088 KB | Output is correct |
52 | Correct | 44 ms | 1084 KB | Output is correct |
53 | Correct | 171 ms | 3116 KB | Output is correct |
54 | Correct | 173 ms | 3660 KB | Output is correct |
55 | Correct | 36 ms | 1104 KB | Output is correct |
56 | Correct | 48 ms | 964 KB | Output is correct |
57 | Correct | 19 ms | 592 KB | Output is correct |
58 | Correct | 190 ms | 2952 KB | Output is correct |
59 | Correct | 78 ms | 2312 KB | Output is correct |
60 | Correct | 40 ms | 1104 KB | Output is correct |
61 | Correct | 97 ms | 2412 KB | Output is correct |
62 | Correct | 74 ms | 2304 KB | Output is correct |
63 | Correct | 677 ms | 33004 KB | Output is correct |
64 | Correct | 374 ms | 15560 KB | Output is correct |
65 | Correct | 44 ms | 1156 KB | Output is correct |
66 | Correct | 76 ms | 2456 KB | Output is correct |
67 | Correct | 209 ms | 8460 KB | Output is correct |
68 | Correct | 274 ms | 15604 KB | Output is correct |
69 | Correct | 42 ms | 1156 KB | Output is correct |
70 | Correct | 87 ms | 2304 KB | Output is correct |
71 | Correct | 200 ms | 8404 KB | Output is correct |
72 | Correct | 134 ms | 5116 KB | Output is correct |
73 | Correct | 32 ms | 1104 KB | Output is correct |
74 | Correct | 83 ms | 2312 KB | Output is correct |
75 | Correct | 147 ms | 5040 KB | Output is correct |
76 | Correct | 52 ms | 1656 KB | Output is correct |
77 | Correct | 99 ms | 2816 KB | Output is correct |
78 | Correct | 32 ms | 1104 KB | Output is correct |
79 | Correct | 26 ms | 1572 KB | Output is correct |
80 | Correct | 69 ms | 1680 KB | Output is correct |
81 | Correct | 133 ms | 2816 KB | Output is correct |
82 | Correct | 4 ms | 592 KB | Output is correct |
83 | Correct | 46 ms | 1668 KB | Output is correct |
84 | Correct | 102 ms | 1796 KB | Output is correct |
85 | Correct | 5 ms | 760 KB | Output is correct |
86 | Correct | 80 ms | 1936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 32 ms | 964 KB | Output is correct |
4 | Correct | 41 ms | 1100 KB | Output is correct |
5 | Correct | 39 ms | 1076 KB | Output is correct |
6 | Correct | 32 ms | 1104 KB | Output is correct |
7 | Correct | 32 ms | 1096 KB | Output is correct |
8 | Correct | 20 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 19 ms | 688 KB | Output is correct |
11 | Correct | 48 ms | 1104 KB | Output is correct |
12 | Correct | 39 ms | 1096 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 33 ms | 1104 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 34 ms | 1016 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 32 ms | 1104 KB | Output is correct |
19 | Correct | 20 ms | 592 KB | Output is correct |
20 | Correct | 28 ms | 848 KB | Output is correct |
21 | Correct | 26 ms | 864 KB | Output is correct |
22 | Correct | 19 ms | 812 KB | Output is correct |
23 | Correct | 37 ms | 1104 KB | Output is correct |
24 | Correct | 19 ms | 592 KB | Output is correct |
25 | Correct | 35 ms | 1096 KB | Output is correct |
26 | Correct | 33 ms | 1096 KB | Output is correct |
27 | Correct | 32 ms | 1096 KB | Output is correct |
28 | Correct | 44 ms | 1100 KB | Output is correct |
29 | Correct | 33 ms | 1104 KB | Output is correct |
30 | Correct | 41 ms | 976 KB | Output is correct |
31 | Correct | 38 ms | 1104 KB | Output is correct |
32 | Correct | 46 ms | 1108 KB | Output is correct |
33 | Correct | 36 ms | 1104 KB | Output is correct |
34 | Correct | 36 ms | 1104 KB | Output is correct |
35 | Correct | 11 ms | 760 KB | Output is correct |
36 | Correct | 11 ms | 800 KB | Output is correct |
37 | Correct | 11 ms | 592 KB | Output is correct |
38 | Correct | 4 ms | 584 KB | Output is correct |
39 | Correct | 5 ms | 592 KB | Output is correct |
40 | Correct | 47 ms | 1220 KB | Output is correct |
41 | Correct | 4 ms | 592 KB | Output is correct |
42 | Correct | 45 ms | 1048 KB | Output is correct |
43 | Correct | 46 ms | 1156 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Execution timed out | 3090 ms | 7336 KB | Time limit exceeded |
46 | Halted | 0 ms | 0 KB | - |