답안 #1115867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115867 2024-11-21T02:56:57 Z Thanhs Political Development (BOI17_politicaldevelopment) C++17
62 / 100
3000 ms 306616 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, const 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

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:51:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |         freopen("in.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:52:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |         freopen("out.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:56:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:57:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   57 |         freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 15 ms 31376 KB Output is correct
4 Correct 15 ms 31312 KB Output is correct
5 Correct 15 ms 31312 KB Output is correct
6 Correct 24 ms 31312 KB Output is correct
7 Correct 15 ms 31312 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 1 ms 436 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 1 ms 336 KB Output is correct
3 Correct 15 ms 31376 KB Output is correct
4 Correct 15 ms 31312 KB Output is correct
5 Correct 15 ms 31312 KB Output is correct
6 Correct 24 ms 31312 KB Output is correct
7 Correct 15 ms 31312 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 1 ms 436 KB Output is correct
10 Correct 4 ms 4432 KB Output is correct
11 Correct 14 ms 31312 KB Output is correct
12 Correct 15 ms 31376 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 15 ms 31312 KB Output is correct
19 Correct 3 ms 528 KB Output is correct
20 Correct 12 ms 31312 KB Output is correct
21 Correct 12 ms 31312 KB Output is correct
22 Correct 3 ms 4580 KB Output is correct
23 Correct 20 ms 31312 KB Output is correct
24 Correct 4 ms 4432 KB Output is correct
25 Correct 20 ms 31312 KB Output is correct
26 Correct 18 ms 31312 KB Output is correct
27 Correct 17 ms 31312 KB Output is correct
28 Correct 26 ms 31560 KB Output is correct
29 Correct 16 ms 31312 KB Output is correct
30 Correct 20 ms 31312 KB Output is correct
31 Correct 19 ms 31312 KB Output is correct
32 Correct 18 ms 31312 KB Output is correct
33 Correct 19 ms 31524 KB Output is correct
34 Correct 18 ms 31312 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 17188 KB Output is correct
37 Correct 9 ms 16976 KB Output is correct
38 Correct 6 ms 8784 KB Output is correct
39 Correct 6 ms 8784 KB Output is correct
40 Correct 23 ms 31480 KB Output is correct
41 Correct 6 ms 8784 KB Output is correct
42 Correct 23 ms 31484 KB Output is correct
43 Correct 23 ms 31388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 1 ms 504 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 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 2 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 507 ms 306504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1323 ms 306568 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 535 ms 306524 KB Output is correct
16 Correct 658 ms 306616 KB Output is correct
17 Correct 1253 ms 306504 KB Output is correct
18 Correct 600 ms 306396 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 31376 KB Output is correct
4 Correct 15 ms 31312 KB Output is correct
5 Correct 15 ms 31312 KB Output is correct
6 Correct 24 ms 31312 KB Output is correct
7 Correct 15 ms 31312 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 1 ms 436 KB Output is correct
10 Correct 4 ms 4432 KB Output is correct
11 Correct 14 ms 31312 KB Output is correct
12 Correct 15 ms 31376 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 15 ms 31312 KB Output is correct
19 Correct 3 ms 528 KB Output is correct
20 Correct 12 ms 31312 KB Output is correct
21 Correct 12 ms 31312 KB Output is correct
22 Correct 3 ms 4580 KB Output is correct
23 Correct 20 ms 31312 KB Output is correct
24 Correct 4 ms 4432 KB Output is correct
25 Correct 20 ms 31312 KB Output is correct
26 Correct 18 ms 31312 KB Output is correct
27 Correct 17 ms 31312 KB Output is correct
28 Correct 26 ms 31560 KB Output is correct
29 Correct 16 ms 31312 KB Output is correct
30 Correct 20 ms 31312 KB Output is correct
31 Correct 19 ms 31312 KB Output is correct
32 Correct 18 ms 31312 KB Output is correct
33 Correct 19 ms 31524 KB Output is correct
34 Correct 18 ms 31312 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 17188 KB Output is correct
37 Correct 9 ms 16976 KB Output is correct
38 Correct 6 ms 8784 KB Output is correct
39 Correct 6 ms 8784 KB Output is correct
40 Correct 23 ms 31480 KB Output is correct
41 Correct 6 ms 8784 KB Output is correct
42 Correct 23 ms 31484 KB Output is correct
43 Correct 23 ms 31388 KB Output is correct
44 Execution timed out 3057 ms 31420 KB Time limit exceeded
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 31376 KB Output is correct
4 Correct 15 ms 31312 KB Output is correct
5 Correct 15 ms 31312 KB Output is correct
6 Correct 24 ms 31312 KB Output is correct
7 Correct 15 ms 31312 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 1 ms 436 KB Output is correct
10 Correct 4 ms 4432 KB Output is correct
11 Correct 14 ms 31312 KB Output is correct
12 Correct 15 ms 31376 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 15 ms 31312 KB Output is correct
19 Correct 3 ms 528 KB Output is correct
20 Correct 12 ms 31312 KB Output is correct
21 Correct 12 ms 31312 KB Output is correct
22 Correct 3 ms 4580 KB Output is correct
23 Correct 20 ms 31312 KB Output is correct
24 Correct 4 ms 4432 KB Output is correct
25 Correct 20 ms 31312 KB Output is correct
26 Correct 18 ms 31312 KB Output is correct
27 Correct 17 ms 31312 KB Output is correct
28 Correct 26 ms 31560 KB Output is correct
29 Correct 16 ms 31312 KB Output is correct
30 Correct 20 ms 31312 KB Output is correct
31 Correct 19 ms 31312 KB Output is correct
32 Correct 18 ms 31312 KB Output is correct
33 Correct 19 ms 31524 KB Output is correct
34 Correct 18 ms 31312 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 17188 KB Output is correct
37 Correct 9 ms 16976 KB Output is correct
38 Correct 6 ms 8784 KB Output is correct
39 Correct 6 ms 8784 KB Output is correct
40 Correct 23 ms 31480 KB Output is correct
41 Correct 6 ms 8784 KB Output is correct
42 Correct 23 ms 31484 KB Output is correct
43 Correct 23 ms 31388 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 390 ms 306444 KB Output is correct
46 Correct 253 ms 306248 KB Output is correct
47 Correct 379 ms 306540 KB Output is correct
48 Correct 361 ms 306504 KB Output is correct
49 Correct 129 ms 302892 KB Output is correct
50 Correct 392 ms 306352 KB Output is correct
51 Correct 374 ms 306248 KB Output is correct
52 Correct 159 ms 296008 KB Output is correct
53 Correct 144 ms 293716 KB Output is correct
54 Correct 17 ms 848 KB Output is correct
55 Correct 399 ms 306460 KB Output is correct
56 Correct 130 ms 294472 KB Output is correct
57 Correct 161 ms 299848 KB Output is correct
58 Correct 802 ms 304440 KB Output is correct
59 Correct 132 ms 289608 KB Output is correct
60 Correct 119 ms 296008 KB Output is correct
61 Correct 747 ms 304456 KB Output is correct
62 Correct 268 ms 302152 KB Output is correct
63 Correct 307 ms 303708 KB Output is correct
64 Correct 125 ms 290888 KB Output is correct
65 Correct 400 ms 305528 KB Output is correct
66 Correct 264 ms 297288 KB Output is correct
67 Correct 244 ms 306520 KB Output is correct
68 Correct 284 ms 306504 KB Output is correct
69 Correct 406 ms 304284 KB Output is correct
70 Correct 193 ms 299336 KB Output is correct
71 Correct 334 ms 304200 KB Output is correct
72 Correct 249 ms 303728 KB Output is correct
73 Correct 377 ms 305744 KB Output is correct
74 Correct 205 ms 296776 KB Output is correct
75 Correct 130 ms 154440 KB Output is correct
76 Correct 263 ms 296520 KB Output is correct
77 Correct 397 ms 305224 KB Output is correct
78 Correct 164 ms 154400 KB Output is correct
79 Correct 126 ms 154448 KB Output is correct
80 Correct 60 ms 78416 KB Output is correct
81 Correct 165 ms 154448 KB Output is correct
82 Correct 349 ms 303880 KB Output is correct
83 Correct 64 ms 78416 KB Output is correct
84 Correct 351 ms 304204 KB Output is correct