# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1115862 | 2024-11-21T02:55:02 Z | Thanhs | Political Development (BOI17_politicaldevelopment) | C++17 | 3000 ms | 306564 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[NM]; void dfs(int sz, bitset<NM> bs) { setmax(ans, sz); for (int i = bs._Find_first(); i < n; i = bs._Find_next(i)) dfs(sz + 1, bs & g[i]); } void solve() { cin >> n >> k; for (int i = 0; i < n; i++) { int t; cin >> t; while (t--) { int x; cin >> x; g[i][x] = 1; } } for (int i = 0; i < n; i++) dfs(1, g[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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 2 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 31312 KB | Output is correct |
4 | Correct | 16 ms | 31388 KB | Output is correct |
5 | Correct | 16 ms | 31312 KB | Output is correct |
6 | Correct | 17 ms | 31312 KB | Output is correct |
7 | Correct | 16 ms | 31312 KB | Output is correct |
8 | Correct | 3 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 2 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 31312 KB | Output is correct |
4 | Correct | 16 ms | 31388 KB | Output is correct |
5 | Correct | 16 ms | 31312 KB | Output is correct |
6 | Correct | 17 ms | 31312 KB | Output is correct |
7 | Correct | 16 ms | 31312 KB | Output is correct |
8 | Correct | 3 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 16 ms | 31324 KB | Output is correct |
12 | Correct | 16 ms | 31196 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 15 ms | 31312 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 16 ms | 31312 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 18 ms | 31392 KB | Output is correct |
19 | Correct | 4 ms | 336 KB | Output is correct |
20 | Correct | 11 ms | 31312 KB | Output is correct |
21 | Correct | 13 ms | 31312 KB | Output is correct |
22 | Correct | 4 ms | 4684 KB | Output is correct |
23 | Correct | 20 ms | 31404 KB | Output is correct |
24 | Correct | 4 ms | 4432 KB | Output is correct |
25 | Correct | 20 ms | 31312 KB | Output is correct |
26 | Correct | 22 ms | 31312 KB | Output is correct |
27 | Correct | 17 ms | 31312 KB | Output is correct |
28 | Correct | 18 ms | 31312 KB | Output is correct |
29 | Correct | 17 ms | 31312 KB | Output is correct |
30 | Correct | 22 ms | 31312 KB | Output is correct |
31 | Correct | 21 ms | 31312 KB | Output is correct |
32 | Correct | 19 ms | 31312 KB | Output is correct |
33 | Correct | 22 ms | 31312 KB | Output is correct |
34 | Correct | 34 ms | 31312 KB | Output is correct |
35 | Correct | 10 ms | 16976 KB | Output is correct |
36 | Correct | 11 ms | 16976 KB | Output is correct |
37 | Correct | 10 ms | 16976 KB | Output is correct |
38 | Correct | 7 ms | 8784 KB | Output is correct |
39 | Correct | 7 ms | 8952 KB | Output is correct |
40 | Correct | 26 ms | 31312 KB | Output is correct |
41 | Correct | 7 ms | 8784 KB | Output is correct |
42 | Correct | 34 ms | 31312 KB | Output is correct |
43 | Correct | 29 ms | 31312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 2 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 592 KB | Output is correct |
7 | Correct | 1 ms | 592 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 592 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 681 ms | 306536 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1545 ms | 306520 KB | Output is correct |
14 | Correct | 1 ms | 336 KB | Output is correct |
15 | Correct | 728 ms | 306496 KB | Output is correct |
16 | Correct | 800 ms | 306564 KB | Output is correct |
17 | Correct | 1461 ms | 306504 KB | Output is correct |
18 | Correct | 948 ms | 306384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 2 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 31312 KB | Output is correct |
4 | Correct | 16 ms | 31388 KB | Output is correct |
5 | Correct | 16 ms | 31312 KB | Output is correct |
6 | Correct | 17 ms | 31312 KB | Output is correct |
7 | Correct | 16 ms | 31312 KB | Output is correct |
8 | Correct | 3 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 16 ms | 31324 KB | Output is correct |
12 | Correct | 16 ms | 31196 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 15 ms | 31312 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 16 ms | 31312 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 18 ms | 31392 KB | Output is correct |
19 | Correct | 4 ms | 336 KB | Output is correct |
20 | Correct | 11 ms | 31312 KB | Output is correct |
21 | Correct | 13 ms | 31312 KB | Output is correct |
22 | Correct | 4 ms | 4684 KB | Output is correct |
23 | Correct | 20 ms | 31404 KB | Output is correct |
24 | Correct | 4 ms | 4432 KB | Output is correct |
25 | Correct | 20 ms | 31312 KB | Output is correct |
26 | Correct | 22 ms | 31312 KB | Output is correct |
27 | Correct | 17 ms | 31312 KB | Output is correct |
28 | Correct | 18 ms | 31312 KB | Output is correct |
29 | Correct | 17 ms | 31312 KB | Output is correct |
30 | Correct | 22 ms | 31312 KB | Output is correct |
31 | Correct | 21 ms | 31312 KB | Output is correct |
32 | Correct | 19 ms | 31312 KB | Output is correct |
33 | Correct | 22 ms | 31312 KB | Output is correct |
34 | Correct | 34 ms | 31312 KB | Output is correct |
35 | Correct | 10 ms | 16976 KB | Output is correct |
36 | Correct | 11 ms | 16976 KB | Output is correct |
37 | Correct | 10 ms | 16976 KB | Output is correct |
38 | Correct | 7 ms | 8784 KB | Output is correct |
39 | Correct | 7 ms | 8952 KB | Output is correct |
40 | Correct | 26 ms | 31312 KB | Output is correct |
41 | Correct | 7 ms | 8784 KB | Output is correct |
42 | Correct | 34 ms | 31312 KB | Output is correct |
43 | Correct | 29 ms | 31312 KB | Output is correct |
44 | Execution timed out | 3055 ms | 31476 KB | Time limit exceeded |
45 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 2 ms | 336 KB | Output is correct |
3 | Correct | 15 ms | 31312 KB | Output is correct |
4 | Correct | 16 ms | 31388 KB | Output is correct |
5 | Correct | 16 ms | 31312 KB | Output is correct |
6 | Correct | 17 ms | 31312 KB | Output is correct |
7 | Correct | 16 ms | 31312 KB | Output is correct |
8 | Correct | 3 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 16 ms | 31324 KB | Output is correct |
12 | Correct | 16 ms | 31196 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 15 ms | 31312 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 16 ms | 31312 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 18 ms | 31392 KB | Output is correct |
19 | Correct | 4 ms | 336 KB | Output is correct |
20 | Correct | 11 ms | 31312 KB | Output is correct |
21 | Correct | 13 ms | 31312 KB | Output is correct |
22 | Correct | 4 ms | 4684 KB | Output is correct |
23 | Correct | 20 ms | 31404 KB | Output is correct |
24 | Correct | 4 ms | 4432 KB | Output is correct |
25 | Correct | 20 ms | 31312 KB | Output is correct |
26 | Correct | 22 ms | 31312 KB | Output is correct |
27 | Correct | 17 ms | 31312 KB | Output is correct |
28 | Correct | 18 ms | 31312 KB | Output is correct |
29 | Correct | 17 ms | 31312 KB | Output is correct |
30 | Correct | 22 ms | 31312 KB | Output is correct |
31 | Correct | 21 ms | 31312 KB | Output is correct |
32 | Correct | 19 ms | 31312 KB | Output is correct |
33 | Correct | 22 ms | 31312 KB | Output is correct |
34 | Correct | 34 ms | 31312 KB | Output is correct |
35 | Correct | 10 ms | 16976 KB | Output is correct |
36 | Correct | 11 ms | 16976 KB | Output is correct |
37 | Correct | 10 ms | 16976 KB | Output is correct |
38 | Correct | 7 ms | 8784 KB | Output is correct |
39 | Correct | 7 ms | 8952 KB | Output is correct |
40 | Correct | 26 ms | 31312 KB | Output is correct |
41 | Correct | 7 ms | 8784 KB | Output is correct |
42 | Correct | 34 ms | 31312 KB | Output is correct |
43 | Correct | 29 ms | 31312 KB | Output is correct |
44 | Correct | 1 ms | 336 KB | Output is correct |
45 | Correct | 508 ms | 304612 KB | Output is correct |
46 | Correct | 407 ms | 290376 KB | Output is correct |
47 | Correct | 576 ms | 302920 KB | Output is correct |
48 | Correct | 553 ms | 305284 KB | Output is correct |
49 | Correct | 200 ms | 288720 KB | Output is correct |
50 | Correct | 582 ms | 306536 KB | Output is correct |
51 | Correct | 487 ms | 305204 KB | Output is correct |
52 | Correct | 330 ms | 194888 KB | Output is correct |
53 | Correct | 172 ms | 287308 KB | Output is correct |
54 | Correct | 22 ms | 848 KB | Output is correct |
55 | Correct | 450 ms | 306312 KB | Output is correct |
56 | Correct | 176 ms | 276724 KB | Output is correct |
57 | Correct | 215 ms | 267604 KB | Output is correct |
58 | Correct | 874 ms | 297480 KB | Output is correct |
59 | Correct | 131 ms | 300616 KB | Output is correct |
60 | Correct | 174 ms | 260600 KB | Output is correct |
61 | Correct | 824 ms | 302920 KB | Output is correct |
62 | Correct | 301 ms | 298224 KB | Output is correct |
63 | Correct | 358 ms | 302152 KB | Output is correct |
64 | Correct | 154 ms | 306428 KB | Output is correct |
65 | Correct | 590 ms | 300916 KB | Output is correct |
66 | Correct | 280 ms | 304968 KB | Output is correct |
67 | Correct | 331 ms | 304208 KB | Output is correct |
68 | Correct | 362 ms | 303940 KB | Output is correct |
69 | Correct | 561 ms | 297544 KB | Output is correct |
70 | Correct | 261 ms | 284068 KB | Output is correct |
71 | Correct | 472 ms | 298044 KB | Output is correct |
72 | Correct | 388 ms | 281252 KB | Output is correct |
73 | Correct | 531 ms | 304528 KB | Output is correct |
74 | Correct | 315 ms | 270664 KB | Output is correct |
75 | Correct | 175 ms | 150492 KB | Output is correct |
76 | Correct | 366 ms | 286100 KB | Output is correct |
77 | Correct | 546 ms | 304456 KB | Output is correct |
78 | Correct | 190 ms | 154448 KB | Output is correct |
79 | Correct | 210 ms | 154440 KB | Output is correct |
80 | Correct | 98 ms | 78416 KB | Output is correct |
81 | Correct | 191 ms | 154460 KB | Output is correct |
82 | Correct | 376 ms | 304208 KB | Output is correct |
83 | Correct | 70 ms | 78416 KB | Output is correct |
84 | Correct | 398 ms | 303688 KB | Output is correct |