Submission #1115838

# Submission time Handle Problem Language Result Execution time Memory
1115838 2024-11-21T02:28:59 Z adaawf Political Development (BOI17_politicaldevelopment) C++17
100 / 100
762 ms 322032 KB
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
bitset<50005> b[50005], bb;
vector<vector<int>> v[11];
vector<int> va;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, k, res = 1;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        for (int j = 0; j < x; j++) {
            int y;
            cin >> y;
            if (y > i) {
                b[i][y] = 1;
                v[2].push_back({i, y});
            }
        }
    }
    for (int i = 2; i <= k; i++) {
        if (v[i].empty()) break;
        res = i;
        if (i == k) break;
        for (auto w : v[i]) {
            bb = b[w[0]];
            for (int i = 1; i < w.size(); i++) {
                bb &= b[w[i]];
            }
            for (int j = bb._Find_first(); j <= n; j = bb._Find_next(j)) {
                va = w;
                va.push_back(j);
                v[i + 1].push_back(va);
            }
        }
    }
    cout << res;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:31:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for (int i = 1; i < w.size(); i++) {
      |                             ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 5 ms 31568 KB Output is correct
4 Correct 3 ms 11100 KB Output is correct
5 Correct 3 ms 12996 KB Output is correct
6 Correct 5 ms 31568 KB Output is correct
7 Correct 5 ms 31568 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 2556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 5 ms 31568 KB Output is correct
4 Correct 3 ms 11100 KB Output is correct
5 Correct 3 ms 12996 KB Output is correct
6 Correct 5 ms 31568 KB Output is correct
7 Correct 5 ms 31568 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 2556 KB Output is correct
11 Correct 3 ms 9040 KB Output is correct
12 Correct 7 ms 11088 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 8 ms 19280 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 10 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 10 ms 31568 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 8 ms 31360 KB Output is correct
21 Correct 7 ms 31568 KB Output is correct
22 Correct 1 ms 2384 KB Output is correct
23 Correct 11 ms 31568 KB Output is correct
24 Correct 1 ms 2384 KB Output is correct
25 Correct 15 ms 31676 KB Output is correct
26 Correct 11 ms 31560 KB Output is correct
27 Correct 10 ms 31764 KB Output is correct
28 Correct 10 ms 31568 KB Output is correct
29 Correct 10 ms 31568 KB Output is correct
30 Correct 11 ms 31824 KB Output is correct
31 Correct 11 ms 31824 KB Output is correct
32 Correct 12 ms 31716 KB Output is correct
33 Correct 11 ms 31824 KB Output is correct
34 Correct 17 ms 31824 KB Output is correct
35 Correct 6 ms 17232 KB Output is correct
36 Correct 6 ms 17068 KB Output is correct
37 Correct 6 ms 17232 KB Output is correct
38 Correct 5 ms 8784 KB Output is correct
39 Correct 4 ms 8932 KB Output is correct
40 Correct 16 ms 31884 KB Output is correct
41 Correct 5 ms 8800 KB Output is correct
42 Correct 17 ms 31884 KB Output is correct
43 Correct 17 ms 32052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 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 468 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 316 ms 322028 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 344 ms 294700 KB Output is correct
14 Correct 1 ms 504 KB Output is correct
15 Correct 345 ms 289128 KB Output is correct
16 Correct 331 ms 296428 KB Output is correct
17 Correct 326 ms 322032 KB Output is correct
18 Correct 353 ms 294124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 5 ms 31568 KB Output is correct
4 Correct 3 ms 11100 KB Output is correct
5 Correct 3 ms 12996 KB Output is correct
6 Correct 5 ms 31568 KB Output is correct
7 Correct 5 ms 31568 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 2556 KB Output is correct
11 Correct 3 ms 9040 KB Output is correct
12 Correct 7 ms 11088 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 8 ms 19280 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 10 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 10 ms 31568 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 8 ms 31360 KB Output is correct
21 Correct 7 ms 31568 KB Output is correct
22 Correct 1 ms 2384 KB Output is correct
23 Correct 11 ms 31568 KB Output is correct
24 Correct 1 ms 2384 KB Output is correct
25 Correct 15 ms 31676 KB Output is correct
26 Correct 11 ms 31560 KB Output is correct
27 Correct 10 ms 31764 KB Output is correct
28 Correct 10 ms 31568 KB Output is correct
29 Correct 10 ms 31568 KB Output is correct
30 Correct 11 ms 31824 KB Output is correct
31 Correct 11 ms 31824 KB Output is correct
32 Correct 12 ms 31716 KB Output is correct
33 Correct 11 ms 31824 KB Output is correct
34 Correct 17 ms 31824 KB Output is correct
35 Correct 6 ms 17232 KB Output is correct
36 Correct 6 ms 17068 KB Output is correct
37 Correct 6 ms 17232 KB Output is correct
38 Correct 5 ms 8784 KB Output is correct
39 Correct 4 ms 8932 KB Output is correct
40 Correct 16 ms 31884 KB Output is correct
41 Correct 5 ms 8800 KB Output is correct
42 Correct 17 ms 31884 KB Output is correct
43 Correct 17 ms 32052 KB Output is correct
44 Correct 762 ms 48120 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 18 ms 31896 KB Output is correct
47 Correct 30 ms 32520 KB Output is correct
48 Correct 16 ms 31884 KB Output is correct
49 Correct 29 ms 32520 KB Output is correct
50 Correct 28 ms 32520 KB Output is correct
51 Correct 66 ms 34052 KB Output is correct
52 Correct 2 ms 2896 KB Output is correct
53 Correct 59 ms 34132 KB Output is correct
54 Correct 75 ms 34556 KB Output is correct
55 Correct 10 ms 31568 KB Output is correct
56 Correct 2 ms 2896 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 61 ms 30212 KB Output is correct
59 Correct 48 ms 32720 KB Output is correct
60 Correct 11 ms 31736 KB Output is correct
61 Correct 51 ms 32716 KB Output is correct
62 Correct 60 ms 32900 KB Output is correct
63 Correct 743 ms 47968 KB Output is correct
64 Correct 385 ms 40188 KB Output is correct
65 Correct 16 ms 31968 KB Output is correct
66 Correct 51 ms 32900 KB Output is correct
67 Correct 214 ms 36608 KB Output is correct
68 Correct 393 ms 40108 KB Output is correct
69 Correct 16 ms 31884 KB Output is correct
70 Correct 45 ms 33036 KB Output is correct
71 Correct 205 ms 36608 KB Output is correct
72 Correct 151 ms 34816 KB Output is correct
73 Correct 9 ms 31568 KB Output is correct
74 Correct 42 ms 32844 KB Output is correct
75 Correct 116 ms 34748 KB Output is correct
76 Correct 19 ms 32308 KB Output is correct
77 Correct 35 ms 33096 KB Output is correct
78 Correct 10 ms 31568 KB Output is correct
79 Correct 18 ms 18092 KB Output is correct
80 Correct 20 ms 32140 KB Output is correct
81 Correct 36 ms 33032 KB Output is correct
82 Correct 4 ms 8784 KB Output is correct
83 Correct 19 ms 17904 KB Output is correct
84 Correct 29 ms 32776 KB Output is correct
85 Correct 5 ms 8796 KB Output is correct
86 Correct 29 ms 32844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 5 ms 31568 KB Output is correct
4 Correct 3 ms 11100 KB Output is correct
5 Correct 3 ms 12996 KB Output is correct
6 Correct 5 ms 31568 KB Output is correct
7 Correct 5 ms 31568 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 2556 KB Output is correct
11 Correct 3 ms 9040 KB Output is correct
12 Correct 7 ms 11088 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 8 ms 19280 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 10 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 10 ms 31568 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 8 ms 31360 KB Output is correct
21 Correct 7 ms 31568 KB Output is correct
22 Correct 1 ms 2384 KB Output is correct
23 Correct 11 ms 31568 KB Output is correct
24 Correct 1 ms 2384 KB Output is correct
25 Correct 15 ms 31676 KB Output is correct
26 Correct 11 ms 31560 KB Output is correct
27 Correct 10 ms 31764 KB Output is correct
28 Correct 10 ms 31568 KB Output is correct
29 Correct 10 ms 31568 KB Output is correct
30 Correct 11 ms 31824 KB Output is correct
31 Correct 11 ms 31824 KB Output is correct
32 Correct 12 ms 31716 KB Output is correct
33 Correct 11 ms 31824 KB Output is correct
34 Correct 17 ms 31824 KB Output is correct
35 Correct 6 ms 17232 KB Output is correct
36 Correct 6 ms 17068 KB Output is correct
37 Correct 6 ms 17232 KB Output is correct
38 Correct 5 ms 8784 KB Output is correct
39 Correct 4 ms 8932 KB Output is correct
40 Correct 16 ms 31884 KB Output is correct
41 Correct 5 ms 8800 KB Output is correct
42 Correct 17 ms 31884 KB Output is correct
43 Correct 17 ms 32052 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 222 ms 295796 KB Output is correct
46 Correct 154 ms 312192 KB Output is correct
47 Correct 221 ms 305500 KB Output is correct
48 Correct 225 ms 292592 KB Output is correct
49 Correct 28 ms 196860 KB Output is correct
50 Correct 291 ms 293272 KB Output is correct
51 Correct 234 ms 273392 KB Output is correct
52 Correct 105 ms 269052 KB Output is correct
53 Correct 33 ms 213244 KB Output is correct
54 Correct 3 ms 336 KB Output is correct
55 Correct 309 ms 304764 KB Output is correct
56 Correct 73 ms 268812 KB Output is correct
57 Correct 97 ms 301564 KB Output is correct
58 Correct 261 ms 294132 KB Output is correct
59 Correct 70 ms 295944 KB Output is correct
60 Correct 69 ms 291840 KB Output is correct
61 Correct 268 ms 303348 KB Output is correct
62 Correct 139 ms 302844 KB Output is correct
63 Correct 163 ms 308472 KB Output is correct
64 Correct 70 ms 299776 KB Output is correct
65 Correct 217 ms 301304 KB Output is correct
66 Correct 141 ms 276992 KB Output is correct
67 Correct 181 ms 278516 KB Output is correct
68 Correct 231 ms 261776 KB Output is correct
69 Correct 237 ms 272372 KB Output is correct
70 Correct 115 ms 267012 KB Output is correct
71 Correct 196 ms 277748 KB Output is correct
72 Correct 155 ms 286712 KB Output is correct
73 Correct 212 ms 308984 KB Output is correct
74 Correct 114 ms 290044 KB Output is correct
75 Correct 84 ms 157692 KB Output is correct
76 Correct 145 ms 298604 KB Output is correct
77 Correct 211 ms 301656 KB Output is correct
78 Correct 114 ms 158720 KB Output is correct
79 Correct 81 ms 155652 KB Output is correct
80 Correct 43 ms 78088 KB Output is correct
81 Correct 103 ms 158716 KB Output is correct
82 Correct 172 ms 297720 KB Output is correct
83 Correct 42 ms 80136 KB Output is correct
84 Correct 191 ms 272972 KB Output is correct