# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115914 | 2024-11-21T04:09:22 Z | kustizus | Political Development (BOI17_politicaldevelopment) | C++17 | 2451 ms | 524288 KB |
#pragma GCC optimize("Ofast" , "unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define all(v) v.begin(), v.end() #define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define read_input(file) if (fopen(file".inp", "r")) freopen(file".inp", "r", stdin); #define file(file) freopen (file".inp", "r", stdin); freopen (file".out", "w", stdout); const int N = 5e4; int n, k; bitset <N + 5> g[N + 5]; vector <vector<int>> c[11]; void solve(){ cin >> n >> k; for (int i = 0; i < n; ++i){ int d; cin >> d; while (d--){ int x; cin >> x; g[i][x] = 1; } c[1].push_back({i}); } bitset <N + 5> b; int pos = 1; while (true){ for (vector <int> v : c[pos]){ bool ok = false; for (int x : v){ if (!ok){ ok = true; b = g[x]; } else b &= g[x]; } for (int j = b._Find_first(); j < n; j = b._Find_next(j)){ vector <int> nxt = v; nxt.push_back(j); c[pos + 1].push_back(nxt); } } ++pos; if (c[pos].empty()) break; } --pos; cout << pos; } signed main(){ faster; // file("file"); read_input("file"); int tt = 1; // cin >> tt; while (tt--){ 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 | 17 ms | 32148 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 16 ms | 32200 KB | Output is correct |
6 | Correct | 14 ms | 32140 KB | Output is correct |
7 | Correct | 16 ms | 32140 KB | Output is correct |
8 | Correct | 3 ms | 848 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 3 ms | 4944 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 | 17 ms | 32148 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 16 ms | 32200 KB | Output is correct |
6 | Correct | 14 ms | 32140 KB | Output is correct |
7 | Correct | 16 ms | 32140 KB | Output is correct |
8 | Correct | 3 ms | 848 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 3 ms | 4944 KB | Output is correct |
11 | Correct | 14 ms | 32284 KB | Output is correct |
12 | Correct | 14 ms | 32208 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 21 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 17 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 14 ms | 32140 KB | Output is correct |
19 | Correct | 5 ms | 848 KB | Output is correct |
20 | Correct | 12 ms | 31824 KB | Output is correct |
21 | Correct | 12 ms | 31828 KB | Output is correct |
22 | Correct | 4 ms | 4952 KB | Output is correct |
23 | Correct | 19 ms | 32140 KB | Output is correct |
24 | Correct | 4 ms | 4944 KB | Output is correct |
25 | Correct | 18 ms | 32140 KB | Output is correct |
26 | Correct | 25 ms | 32144 KB | Output is correct |
27 | Correct | 17 ms | 32308 KB | Output is correct |
28 | Correct | 17 ms | 32140 KB | Output is correct |
29 | Correct | 16 ms | 32140 KB | Output is correct |
30 | Correct | 19 ms | 32140 KB | Output is correct |
31 | Correct | 17 ms | 32308 KB | Output is correct |
32 | Correct | 17 ms | 32140 KB | Output is correct |
33 | Correct | 17 ms | 32140 KB | Output is correct |
34 | Correct | 20 ms | 32140 KB | Output is correct |
35 | Correct | 8 ms | 17364 KB | Output is correct |
36 | Correct | 10 ms | 17488 KB | Output is correct |
37 | Correct | 8 ms | 17488 KB | Output is correct |
38 | Correct | 5 ms | 9040 KB | Output is correct |
39 | Correct | 8 ms | 9040 KB | Output is correct |
40 | Correct | 26 ms | 32908 KB | Output is correct |
41 | Correct | 5 ms | 9084 KB | Output is correct |
42 | Correct | 25 ms | 32908 KB | Output is correct |
43 | Correct | 24 ms | 32908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 848 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 | 2 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 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 | Correct | 487 ms | 333796 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 2409 ms | 431604 KB | Output is correct |
14 | Correct | 2 ms | 336 KB | Output is correct |
15 | Correct | 526 ms | 333948 KB | Output is correct |
16 | Correct | 815 ms | 344024 KB | Output is correct |
17 | Correct | 2451 ms | 431428 KB | Output is correct |
18 | Correct | 754 ms | 344024 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 | 17 ms | 32148 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 16 ms | 32200 KB | Output is correct |
6 | Correct | 14 ms | 32140 KB | Output is correct |
7 | Correct | 16 ms | 32140 KB | Output is correct |
8 | Correct | 3 ms | 848 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 3 ms | 4944 KB | Output is correct |
11 | Correct | 14 ms | 32284 KB | Output is correct |
12 | Correct | 14 ms | 32208 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 21 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 17 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 14 ms | 32140 KB | Output is correct |
19 | Correct | 5 ms | 848 KB | Output is correct |
20 | Correct | 12 ms | 31824 KB | Output is correct |
21 | Correct | 12 ms | 31828 KB | Output is correct |
22 | Correct | 4 ms | 4952 KB | Output is correct |
23 | Correct | 19 ms | 32140 KB | Output is correct |
24 | Correct | 4 ms | 4944 KB | Output is correct |
25 | Correct | 18 ms | 32140 KB | Output is correct |
26 | Correct | 25 ms | 32144 KB | Output is correct |
27 | Correct | 17 ms | 32308 KB | Output is correct |
28 | Correct | 17 ms | 32140 KB | Output is correct |
29 | Correct | 16 ms | 32140 KB | Output is correct |
30 | Correct | 19 ms | 32140 KB | Output is correct |
31 | Correct | 17 ms | 32308 KB | Output is correct |
32 | Correct | 17 ms | 32140 KB | Output is correct |
33 | Correct | 17 ms | 32140 KB | Output is correct |
34 | Correct | 20 ms | 32140 KB | Output is correct |
35 | Correct | 8 ms | 17364 KB | Output is correct |
36 | Correct | 10 ms | 17488 KB | Output is correct |
37 | Correct | 8 ms | 17488 KB | Output is correct |
38 | Correct | 5 ms | 9040 KB | Output is correct |
39 | Correct | 8 ms | 9040 KB | Output is correct |
40 | Correct | 26 ms | 32908 KB | Output is correct |
41 | Correct | 5 ms | 9084 KB | Output is correct |
42 | Correct | 25 ms | 32908 KB | Output is correct |
43 | Correct | 24 ms | 32908 KB | Output is correct |
44 | Runtime error | 1607 ms | 524288 KB | Execution killed with signal 9 |
45 | 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 | 17 ms | 32148 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 16 ms | 32200 KB | Output is correct |
6 | Correct | 14 ms | 32140 KB | Output is correct |
7 | Correct | 16 ms | 32140 KB | Output is correct |
8 | Correct | 3 ms | 848 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 3 ms | 4944 KB | Output is correct |
11 | Correct | 14 ms | 32284 KB | Output is correct |
12 | Correct | 14 ms | 32208 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 21 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 17 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 14 ms | 32140 KB | Output is correct |
19 | Correct | 5 ms | 848 KB | Output is correct |
20 | Correct | 12 ms | 31824 KB | Output is correct |
21 | Correct | 12 ms | 31828 KB | Output is correct |
22 | Correct | 4 ms | 4952 KB | Output is correct |
23 | Correct | 19 ms | 32140 KB | Output is correct |
24 | Correct | 4 ms | 4944 KB | Output is correct |
25 | Correct | 18 ms | 32140 KB | Output is correct |
26 | Correct | 25 ms | 32144 KB | Output is correct |
27 | Correct | 17 ms | 32308 KB | Output is correct |
28 | Correct | 17 ms | 32140 KB | Output is correct |
29 | Correct | 16 ms | 32140 KB | Output is correct |
30 | Correct | 19 ms | 32140 KB | Output is correct |
31 | Correct | 17 ms | 32308 KB | Output is correct |
32 | Correct | 17 ms | 32140 KB | Output is correct |
33 | Correct | 17 ms | 32140 KB | Output is correct |
34 | Correct | 20 ms | 32140 KB | Output is correct |
35 | Correct | 8 ms | 17364 KB | Output is correct |
36 | Correct | 10 ms | 17488 KB | Output is correct |
37 | Correct | 8 ms | 17488 KB | Output is correct |
38 | Correct | 5 ms | 9040 KB | Output is correct |
39 | Correct | 8 ms | 9040 KB | Output is correct |
40 | Correct | 26 ms | 32908 KB | Output is correct |
41 | Correct | 5 ms | 9084 KB | Output is correct |
42 | Correct | 25 ms | 32908 KB | Output is correct |
43 | Correct | 24 ms | 32908 KB | Output is correct |
44 | Correct | 1 ms | 336 KB | Output is correct |
45 | Correct | 359 ms | 329316 KB | Output is correct |
46 | Correct | 264 ms | 319148 KB | Output is correct |
47 | Correct | 542 ms | 324332 KB | Output is correct |
48 | Correct | 506 ms | 327804 KB | Output is correct |
49 | Correct | 286 ms | 212708 KB | Output is correct |
50 | Correct | 480 ms | 331088 KB | Output is correct |
51 | Correct | 420 ms | 327836 KB | Output is correct |
52 | Correct | 199 ms | 273912 KB | Output is correct |
53 | Correct | 197 ms | 279100 KB | Output is correct |
54 | Correct | 23 ms | 3588 KB | Output is correct |
55 | Correct | 358 ms | 330984 KB | Output is correct |
56 | Correct | 173 ms | 264700 KB | Output is correct |
57 | Correct | 207 ms | 264704 KB | Output is correct |
58 | Correct | 995 ms | 352068 KB | Output is correct |
59 | Correct | 219 ms | 213712 KB | Output is correct |
60 | Correct | 206 ms | 210448 KB | Output is correct |
61 | Correct | 1012 ms | 345672 KB | Output is correct |
62 | Correct | 257 ms | 320500 KB | Output is correct |
63 | Correct | 250 ms | 319724 KB | Output is correct |
64 | Correct | 139 ms | 281584 KB | Output is correct |
65 | Correct | 469 ms | 328012 KB | Output is correct |
66 | Correct | 265 ms | 320504 KB | Output is correct |
67 | Correct | 275 ms | 317164 KB | Output is correct |
68 | Correct | 480 ms | 307948 KB | Output is correct |
69 | Correct | 446 ms | 331584 KB | Output is correct |
70 | Correct | 168 ms | 314344 KB | Output is correct |
71 | Correct | 423 ms | 311536 KB | Output is correct |
72 | Correct | 253 ms | 313880 KB | Output is correct |
73 | Correct | 368 ms | 322596 KB | Output is correct |
74 | Correct | 259 ms | 290808 KB | Output is correct |
75 | Correct | 169 ms | 154908 KB | Output is correct |
76 | Correct | 212 ms | 320440 KB | Output is correct |
77 | Correct | 320 ms | 323052 KB | Output is correct |
78 | Correct | 175 ms | 162864 KB | Output is correct |
79 | Correct | 147 ms | 158260 KB | Output is correct |
80 | Correct | 64 ms | 81864 KB | Output is correct |
81 | Correct | 207 ms | 157520 KB | Output is correct |
82 | Correct | 278 ms | 321028 KB | Output is correct |
83 | Correct | 59 ms | 81756 KB | Output is correct |
84 | Correct | 260 ms | 321520 KB | Output is correct |