# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1115916 | 2024-11-21T04:11:30 Z | kustizus | Political Development (BOI17_politicaldevelopment) | C++17 | 332 ms | 322336 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[min(i, x)][max(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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 12 ms | 31996 KB | Output is correct |
4 | Correct | 7 ms | 11344 KB | Output is correct |
5 | Correct | 7 ms | 13392 KB | Output is correct |
6 | Correct | 10 ms | 31824 KB | Output is correct |
7 | Correct | 10 ms | 31824 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 | 2896 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 12 ms | 31996 KB | Output is correct |
4 | Correct | 7 ms | 11344 KB | Output is correct |
5 | Correct | 7 ms | 13392 KB | Output is correct |
6 | Correct | 10 ms | 31824 KB | Output is correct |
7 | Correct | 10 ms | 31824 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 | 2896 KB | Output is correct |
11 | Correct | 8 ms | 9296 KB | Output is correct |
12 | Correct | 8 ms | 11356 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 9 ms | 19536 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 10 ms | 31824 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 13 ms | 31824 KB | Output is correct |
19 | Correct | 4 ms | 848 KB | Output is correct |
20 | Correct | 8 ms | 31812 KB | Output is correct |
21 | Correct | 9 ms | 31568 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 12 ms | 32188 KB | Output is correct |
24 | Correct | 3 ms | 2896 KB | Output is correct |
25 | Correct | 12 ms | 31824 KB | Output is correct |
26 | Correct | 12 ms | 31824 KB | Output is correct |
27 | Correct | 12 ms | 31824 KB | Output is correct |
28 | Correct | 12 ms | 31824 KB | Output is correct |
29 | Correct | 11 ms | 31824 KB | Output is correct |
30 | Correct | 14 ms | 31824 KB | Output is correct |
31 | Correct | 12 ms | 31824 KB | Output is correct |
32 | Correct | 13 ms | 31824 KB | Output is correct |
33 | Correct | 12 ms | 31824 KB | Output is correct |
34 | Correct | 11 ms | 31824 KB | Output is correct |
35 | Correct | 6 ms | 17232 KB | Output is correct |
36 | Correct | 6 ms | 17400 KB | Output is correct |
37 | Correct | 6 ms | 17400 KB | Output is correct |
38 | Correct | 4 ms | 9036 KB | Output is correct |
39 | Correct | 4 ms | 8784 KB | Output is correct |
40 | Correct | 15 ms | 32140 KB | Output is correct |
41 | Correct | 4 ms | 8784 KB | Output is correct |
42 | Correct | 14 ms | 32140 KB | Output is correct |
43 | Correct | 16 ms | 32280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1016 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 592 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 | 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 | 275 ms | 322212 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 280 ms | 322336 KB | Output is correct |
14 | Correct | 1 ms | 504 KB | Output is correct |
15 | Correct | 306 ms | 322148 KB | Output is correct |
16 | Correct | 275 ms | 322176 KB | Output is correct |
17 | Correct | 275 ms | 322200 KB | Output is correct |
18 | Correct | 277 ms | 322228 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 12 ms | 31996 KB | Output is correct |
4 | Correct | 7 ms | 11344 KB | Output is correct |
5 | Correct | 7 ms | 13392 KB | Output is correct |
6 | Correct | 10 ms | 31824 KB | Output is correct |
7 | Correct | 10 ms | 31824 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 | 2896 KB | Output is correct |
11 | Correct | 8 ms | 9296 KB | Output is correct |
12 | Correct | 8 ms | 11356 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 9 ms | 19536 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 10 ms | 31824 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 13 ms | 31824 KB | Output is correct |
19 | Correct | 4 ms | 848 KB | Output is correct |
20 | Correct | 8 ms | 31812 KB | Output is correct |
21 | Correct | 9 ms | 31568 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 12 ms | 32188 KB | Output is correct |
24 | Correct | 3 ms | 2896 KB | Output is correct |
25 | Correct | 12 ms | 31824 KB | Output is correct |
26 | Correct | 12 ms | 31824 KB | Output is correct |
27 | Correct | 12 ms | 31824 KB | Output is correct |
28 | Correct | 12 ms | 31824 KB | Output is correct |
29 | Correct | 11 ms | 31824 KB | Output is correct |
30 | Correct | 14 ms | 31824 KB | Output is correct |
31 | Correct | 12 ms | 31824 KB | Output is correct |
32 | Correct | 13 ms | 31824 KB | Output is correct |
33 | Correct | 12 ms | 31824 KB | Output is correct |
34 | Correct | 11 ms | 31824 KB | Output is correct |
35 | Correct | 6 ms | 17232 KB | Output is correct |
36 | Correct | 6 ms | 17400 KB | Output is correct |
37 | Correct | 6 ms | 17400 KB | Output is correct |
38 | Correct | 4 ms | 9036 KB | Output is correct |
39 | Correct | 4 ms | 8784 KB | Output is correct |
40 | Correct | 15 ms | 32140 KB | Output is correct |
41 | Correct | 4 ms | 8784 KB | Output is correct |
42 | Correct | 14 ms | 32140 KB | Output is correct |
43 | Correct | 16 ms | 32280 KB | Output is correct |
44 | Correct | 315 ms | 48120 KB | Output is correct |
45 | Correct | 1 ms | 336 KB | Output is correct |
46 | Correct | 15 ms | 32140 KB | Output is correct |
47 | Correct | 24 ms | 32908 KB | Output is correct |
48 | Correct | 14 ms | 32284 KB | Output is correct |
49 | Correct | 23 ms | 32892 KB | Output is correct |
50 | Correct | 23 ms | 32868 KB | Output is correct |
51 | Correct | 41 ms | 34164 KB | Output is correct |
52 | Correct | 9 ms | 3152 KB | Output is correct |
53 | Correct | 35 ms | 34164 KB | Output is correct |
54 | Correct | 50 ms | 34572 KB | Output is correct |
55 | Correct | 11 ms | 31996 KB | Output is correct |
56 | Correct | 6 ms | 3152 KB | Output is correct |
57 | Correct | 3 ms | 848 KB | Output is correct |
58 | Correct | 38 ms | 29960 KB | Output is correct |
59 | Correct | 30 ms | 32908 KB | Output is correct |
60 | Correct | 11 ms | 31844 KB | Output is correct |
61 | Correct | 36 ms | 32900 KB | Output is correct |
62 | Correct | 36 ms | 32908 KB | Output is correct |
63 | Correct | 332 ms | 48120 KB | Output is correct |
64 | Correct | 194 ms | 40232 KB | Output is correct |
65 | Correct | 15 ms | 32140 KB | Output is correct |
66 | Correct | 40 ms | 32908 KB | Output is correct |
67 | Correct | 110 ms | 36608 KB | Output is correct |
68 | Correct | 184 ms | 40304 KB | Output is correct |
69 | Correct | 15 ms | 32308 KB | Output is correct |
70 | Correct | 30 ms | 33032 KB | Output is correct |
71 | Correct | 134 ms | 36468 KB | Output is correct |
72 | Correct | 69 ms | 34816 KB | Output is correct |
73 | Correct | 12 ms | 31996 KB | Output is correct |
74 | Correct | 30 ms | 33032 KB | Output is correct |
75 | Correct | 68 ms | 34856 KB | Output is correct |
76 | Correct | 18 ms | 32140 KB | Output is correct |
77 | Correct | 30 ms | 33032 KB | Output is correct |
78 | Correct | 11 ms | 31824 KB | Output is correct |
79 | Correct | 14 ms | 17804 KB | Output is correct |
80 | Correct | 18 ms | 32140 KB | Output is correct |
81 | Correct | 27 ms | 33032 KB | Output is correct |
82 | Correct | 4 ms | 8784 KB | Output is correct |
83 | Correct | 14 ms | 17884 KB | Output is correct |
84 | Correct | 25 ms | 32908 KB | Output is correct |
85 | Correct | 4 ms | 8784 KB | Output is correct |
86 | Correct | 26 ms | 32916 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 12 ms | 31996 KB | Output is correct |
4 | Correct | 7 ms | 11344 KB | Output is correct |
5 | Correct | 7 ms | 13392 KB | Output is correct |
6 | Correct | 10 ms | 31824 KB | Output is correct |
7 | Correct | 10 ms | 31824 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 | 2896 KB | Output is correct |
11 | Correct | 8 ms | 9296 KB | Output is correct |
12 | Correct | 8 ms | 11356 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 9 ms | 19536 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 10 ms | 31824 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 13 ms | 31824 KB | Output is correct |
19 | Correct | 4 ms | 848 KB | Output is correct |
20 | Correct | 8 ms | 31812 KB | Output is correct |
21 | Correct | 9 ms | 31568 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 12 ms | 32188 KB | Output is correct |
24 | Correct | 3 ms | 2896 KB | Output is correct |
25 | Correct | 12 ms | 31824 KB | Output is correct |
26 | Correct | 12 ms | 31824 KB | Output is correct |
27 | Correct | 12 ms | 31824 KB | Output is correct |
28 | Correct | 12 ms | 31824 KB | Output is correct |
29 | Correct | 11 ms | 31824 KB | Output is correct |
30 | Correct | 14 ms | 31824 KB | Output is correct |
31 | Correct | 12 ms | 31824 KB | Output is correct |
32 | Correct | 13 ms | 31824 KB | Output is correct |
33 | Correct | 12 ms | 31824 KB | Output is correct |
34 | Correct | 11 ms | 31824 KB | Output is correct |
35 | Correct | 6 ms | 17232 KB | Output is correct |
36 | Correct | 6 ms | 17400 KB | Output is correct |
37 | Correct | 6 ms | 17400 KB | Output is correct |
38 | Correct | 4 ms | 9036 KB | Output is correct |
39 | Correct | 4 ms | 8784 KB | Output is correct |
40 | Correct | 15 ms | 32140 KB | Output is correct |
41 | Correct | 4 ms | 8784 KB | Output is correct |
42 | Correct | 14 ms | 32140 KB | Output is correct |
43 | Correct | 16 ms | 32280 KB | Output is correct |
44 | Correct | 1 ms | 504 KB | Output is correct |
45 | Correct | 232 ms | 301244 KB | Output is correct |
46 | Correct | 160 ms | 314620 KB | Output is correct |
47 | Correct | 217 ms | 320224 KB | Output is correct |
48 | Correct | 227 ms | 320248 KB | Output is correct |
49 | Correct | 90 ms | 199376 KB | Output is correct |
50 | Correct | 223 ms | 305024 KB | Output is correct |
51 | Correct | 208 ms | 320248 KB | Output is correct |
52 | Correct | 103 ms | 311804 KB | Output is correct |
53 | Correct | 83 ms | 215548 KB | Output is correct |
54 | Correct | 20 ms | 3588 KB | Output is correct |
55 | Correct | 214 ms | 318392 KB | Output is correct |
56 | Correct | 85 ms | 306428 KB | Output is correct |
57 | Correct | 107 ms | 299776 KB | Output is correct |
58 | Correct | 218 ms | 316792 KB | Output is correct |
59 | Correct | 85 ms | 308476 KB | Output is correct |
60 | Correct | 84 ms | 308312 KB | Output is correct |
61 | Correct | 215 ms | 316920 KB | Output is correct |
62 | Correct | 132 ms | 313084 KB | Output is correct |
63 | Correct | 154 ms | 314620 KB | Output is correct |
64 | Correct | 94 ms | 310524 KB | Output is correct |
65 | Correct | 207 ms | 316028 KB | Output is correct |
66 | Correct | 141 ms | 312968 KB | Output is correct |
67 | Correct | 172 ms | 314620 KB | Output is correct |
68 | Correct | 183 ms | 315128 KB | Output is correct |
69 | Correct | 205 ms | 316148 KB | Output is correct |
70 | Correct | 122 ms | 312068 KB | Output is correct |
71 | Correct | 196 ms | 315128 KB | Output is correct |
72 | Correct | 149 ms | 314620 KB | Output is correct |
73 | Correct | 202 ms | 316152 KB | Output is correct |
74 | Correct | 120 ms | 309756 KB | Output is correct |
75 | Correct | 85 ms | 158472 KB | Output is correct |
76 | Correct | 148 ms | 314620 KB | Output is correct |
77 | Correct | 204 ms | 315920 KB | Output is correct |
78 | Correct | 96 ms | 159228 KB | Output is correct |
79 | Correct | 81 ms | 156424 KB | Output is correct |
80 | Correct | 43 ms | 78476 KB | Output is correct |
81 | Correct | 96 ms | 159228 KB | Output is correct |
82 | Correct | 180 ms | 299320 KB | Output is correct |
83 | Correct | 39 ms | 80512 KB | Output is correct |
84 | Correct | 171 ms | 306692 KB | Output is correct |