# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1115913 | 2024-11-21T04:09:22 Z | kustizus | Political Development (BOI17_politicaldevelopment) | C++17 | 2612 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 32136 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 15 ms | 32140 KB | Output is correct |
6 | Correct | 15 ms | 32140 KB | Output is correct |
7 | Correct | 17 ms | 32140 KB | Output is correct |
8 | Correct | 5 ms | 856 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 5116 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 | 15 ms | 32136 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 15 ms | 32140 KB | Output is correct |
6 | Correct | 15 ms | 32140 KB | Output is correct |
7 | Correct | 17 ms | 32140 KB | Output is correct |
8 | Correct | 5 ms | 856 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 5116 KB | Output is correct |
11 | Correct | 15 ms | 32188 KB | Output is correct |
12 | Correct | 13 ms | 32140 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 14 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 508 KB | Output is correct |
16 | Correct | 15 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 15 ms | 32308 KB | Output is correct |
19 | Correct | 3 ms | 848 KB | Output is correct |
20 | Correct | 17 ms | 31824 KB | Output is correct |
21 | Correct | 11 ms | 31824 KB | Output is correct |
22 | Correct | 3 ms | 4944 KB | Output is correct |
23 | Correct | 16 ms | 32172 KB | Output is correct |
24 | Correct | 3 ms | 4944 KB | Output is correct |
25 | Correct | 20 ms | 32296 KB | Output is correct |
26 | Correct | 17 ms | 32280 KB | Output is correct |
27 | Correct | 16 ms | 32308 KB | Output is correct |
28 | Correct | 18 ms | 32140 KB | Output is correct |
29 | Correct | 17 ms | 32140 KB | Output is correct |
30 | Correct | 16 ms | 32140 KB | Output is correct |
31 | Correct | 18 ms | 32140 KB | Output is correct |
32 | Correct | 26 ms | 32140 KB | Output is correct |
33 | Correct | 20 ms | 32248 KB | Output is correct |
34 | Correct | 19 ms | 32140 KB | Output is correct |
35 | Correct | 9 ms | 17488 KB | Output is correct |
36 | Correct | 12 ms | 17488 KB | Output is correct |
37 | Correct | 9 ms | 17488 KB | Output is correct |
38 | Correct | 6 ms | 9040 KB | Output is correct |
39 | Correct | 5 ms | 9040 KB | Output is correct |
40 | Correct | 25 ms | 32908 KB | Output is correct |
41 | Correct | 6 ms | 9040 KB | Output is correct |
42 | Correct | 22 ms | 32784 KB | Output is correct |
43 | Correct | 21 ms | 32920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1016 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 | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 493 ms | 335616 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 2612 ms | 431572 KB | Output is correct |
14 | Correct | 1 ms | 336 KB | Output is correct |
15 | Correct | 695 ms | 335644 KB | Output is correct |
16 | Correct | 794 ms | 345784 KB | Output is correct |
17 | Correct | 2422 ms | 433356 KB | Output is correct |
18 | Correct | 704 ms | 345572 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 | 15 ms | 32136 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 15 ms | 32140 KB | Output is correct |
6 | Correct | 15 ms | 32140 KB | Output is correct |
7 | Correct | 17 ms | 32140 KB | Output is correct |
8 | Correct | 5 ms | 856 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 5116 KB | Output is correct |
11 | Correct | 15 ms | 32188 KB | Output is correct |
12 | Correct | 13 ms | 32140 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 14 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 508 KB | Output is correct |
16 | Correct | 15 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 15 ms | 32308 KB | Output is correct |
19 | Correct | 3 ms | 848 KB | Output is correct |
20 | Correct | 17 ms | 31824 KB | Output is correct |
21 | Correct | 11 ms | 31824 KB | Output is correct |
22 | Correct | 3 ms | 4944 KB | Output is correct |
23 | Correct | 16 ms | 32172 KB | Output is correct |
24 | Correct | 3 ms | 4944 KB | Output is correct |
25 | Correct | 20 ms | 32296 KB | Output is correct |
26 | Correct | 17 ms | 32280 KB | Output is correct |
27 | Correct | 16 ms | 32308 KB | Output is correct |
28 | Correct | 18 ms | 32140 KB | Output is correct |
29 | Correct | 17 ms | 32140 KB | Output is correct |
30 | Correct | 16 ms | 32140 KB | Output is correct |
31 | Correct | 18 ms | 32140 KB | Output is correct |
32 | Correct | 26 ms | 32140 KB | Output is correct |
33 | Correct | 20 ms | 32248 KB | Output is correct |
34 | Correct | 19 ms | 32140 KB | Output is correct |
35 | Correct | 9 ms | 17488 KB | Output is correct |
36 | Correct | 12 ms | 17488 KB | Output is correct |
37 | Correct | 9 ms | 17488 KB | Output is correct |
38 | Correct | 6 ms | 9040 KB | Output is correct |
39 | Correct | 5 ms | 9040 KB | Output is correct |
40 | Correct | 25 ms | 32908 KB | Output is correct |
41 | Correct | 6 ms | 9040 KB | Output is correct |
42 | Correct | 22 ms | 32784 KB | Output is correct |
43 | Correct | 21 ms | 32920 KB | Output is correct |
44 | Runtime error | 1519 ms | 524288 KB | Execution killed with signal 9 |
45 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 32136 KB | Output is correct |
4 | Correct | 14 ms | 32140 KB | Output is correct |
5 | Correct | 15 ms | 32140 KB | Output is correct |
6 | Correct | 15 ms | 32140 KB | Output is correct |
7 | Correct | 17 ms | 32140 KB | Output is correct |
8 | Correct | 5 ms | 856 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 5116 KB | Output is correct |
11 | Correct | 15 ms | 32188 KB | Output is correct |
12 | Correct | 13 ms | 32140 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 14 ms | 32140 KB | Output is correct |
15 | Correct | 1 ms | 508 KB | Output is correct |
16 | Correct | 15 ms | 32140 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 15 ms | 32308 KB | Output is correct |
19 | Correct | 3 ms | 848 KB | Output is correct |
20 | Correct | 17 ms | 31824 KB | Output is correct |
21 | Correct | 11 ms | 31824 KB | Output is correct |
22 | Correct | 3 ms | 4944 KB | Output is correct |
23 | Correct | 16 ms | 32172 KB | Output is correct |
24 | Correct | 3 ms | 4944 KB | Output is correct |
25 | Correct | 20 ms | 32296 KB | Output is correct |
26 | Correct | 17 ms | 32280 KB | Output is correct |
27 | Correct | 16 ms | 32308 KB | Output is correct |
28 | Correct | 18 ms | 32140 KB | Output is correct |
29 | Correct | 17 ms | 32140 KB | Output is correct |
30 | Correct | 16 ms | 32140 KB | Output is correct |
31 | Correct | 18 ms | 32140 KB | Output is correct |
32 | Correct | 26 ms | 32140 KB | Output is correct |
33 | Correct | 20 ms | 32248 KB | Output is correct |
34 | Correct | 19 ms | 32140 KB | Output is correct |
35 | Correct | 9 ms | 17488 KB | Output is correct |
36 | Correct | 12 ms | 17488 KB | Output is correct |
37 | Correct | 9 ms | 17488 KB | Output is correct |
38 | Correct | 6 ms | 9040 KB | Output is correct |
39 | Correct | 5 ms | 9040 KB | Output is correct |
40 | Correct | 25 ms | 32908 KB | Output is correct |
41 | Correct | 6 ms | 9040 KB | Output is correct |
42 | Correct | 22 ms | 32784 KB | Output is correct |
43 | Correct | 21 ms | 32920 KB | Output is correct |
44 | Correct | 1 ms | 336 KB | Output is correct |
45 | Correct | 427 ms | 327672 KB | Output is correct |
46 | Correct | 461 ms | 287976 KB | Output is correct |
47 | Correct | 406 ms | 330408 KB | Output is correct |
48 | Correct | 383 ms | 330692 KB | Output is correct |
49 | Correct | 178 ms | 284148 KB | Output is correct |
50 | Correct | 381 ms | 330976 KB | Output is correct |
51 | Correct | 410 ms | 328180 KB | Output is correct |
52 | Correct | 158 ms | 314652 KB | Output is correct |
53 | Correct | 215 ms | 251000 KB | Output is correct |
54 | Correct | 21 ms | 3796 KB | Output is correct |
55 | Correct | 447 ms | 332012 KB | Output is correct |
56 | Correct | 116 ms | 312040 KB | Output is correct |
57 | Correct | 264 ms | 211624 KB | Output is correct |
58 | Correct | 986 ms | 352996 KB | Output is correct |
59 | Correct | 166 ms | 264700 KB | Output is correct |
60 | Correct | 172 ms | 263932 KB | Output is correct |
61 | Correct | 822 ms | 359384 KB | Output is correct |
62 | Correct | 276 ms | 317684 KB | Output is correct |
63 | Correct | 261 ms | 318700 KB | Output is correct |
64 | Correct | 115 ms | 312060 KB | Output is correct |
65 | Correct | 590 ms | 319544 KB | Output is correct |
66 | Correct | 359 ms | 292976 KB | Output is correct |
67 | Correct | 360 ms | 305388 KB | Output is correct |
68 | Correct | 437 ms | 311288 KB | Output is correct |
69 | Correct | 440 ms | 332800 KB | Output is correct |
70 | Correct | 181 ms | 314620 KB | Output is correct |
71 | Correct | 468 ms | 307036 KB | Output is correct |
72 | Correct | 271 ms | 309240 KB | Output is correct |
73 | Correct | 370 ms | 321824 KB | Output is correct |
74 | Correct | 241 ms | 292380 KB | Output is correct |
75 | Correct | 154 ms | 155128 KB | Output is correct |
76 | Correct | 220 ms | 320504 KB | Output is correct |
77 | Correct | 340 ms | 322796 KB | Output is correct |
78 | Correct | 226 ms | 156912 KB | Output is correct |
79 | Correct | 242 ms | 147704 KB | Output is correct |
80 | Correct | 86 ms | 81932 KB | Output is correct |
81 | Correct | 153 ms | 162932 KB | Output is correct |
82 | Correct | 276 ms | 320732 KB | Output is correct |
83 | Correct | 61 ms | 81776 KB | Output is correct |
84 | Correct | 398 ms | 316156 KB | Output is correct |