Submission #1116087

# Submission time Handle Problem Language Result Execution time Memory
1116087 2024-11-21T08:54:07 Z vjudge1 Political Development (BOI17_politicaldevelopment) C++17
100 / 100
664 ms 319048 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define el cout << '\n'
#define f1(i,n) for(int i=1;i<=n;i++)
#define __file_name ""
using namespace std;
const ll maxn = 1e6+5, inf=1e18;

int n, k, ans;
bitset<50000> bit[50000], xx;
queue<vector<int>> qu;
vector<int> cur;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    if(fopen(__file_name ".inp", "r")){
        freopen(__file_name ".inp","r",stdin);
        freopen(__file_name ".out","w",stdout);
    }
    // code here
    cin >> n >> k;
    for(int i=0;i<n;i++){
        int d, v; cin >> d;
        f1(_, d) {
            cin >> v;
            if(i < v) bit[i][v] = 1;
        }
    }
    for(int i=0;i<n;i++) qu.push({i});
    while(!qu.empty()){
        ans = max(ans, (int)qu.front().size());
        cur = qu.front();
        qu.pop();
        xx = bit[cur.back()];
        for(int item: cur){
            xx &= bit[item];
        }
        int ii = xx._Find_first();
        while(ii < 50000){
            cur.push_back(ii);
            qu.push(cur);
            cur.pop_back();
            ii = xx._Find_next(ii);
        }
    }
    cout << ans;
    return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen(__file_name ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen(__file_name ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 18 ms 31756 KB Output is correct
4 Correct 14 ms 11512 KB Output is correct
5 Correct 17 ms 13396 KB Output is correct
6 Correct 17 ms 31568 KB Output is correct
7 Correct 16 ms 31568 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 1 ms 564 KB Output is correct
10 Correct 6 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 18 ms 31756 KB Output is correct
4 Correct 14 ms 11512 KB Output is correct
5 Correct 17 ms 13396 KB Output is correct
6 Correct 17 ms 31568 KB Output is correct
7 Correct 16 ms 31568 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 1 ms 564 KB Output is correct
10 Correct 6 ms 2808 KB Output is correct
11 Correct 12 ms 9296 KB Output is correct
12 Correct 13 ms 11428 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 16 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31568 KB Output is correct
19 Correct 6 ms 592 KB Output is correct
20 Correct 11 ms 31644 KB Output is correct
21 Correct 12 ms 31568 KB Output is correct
22 Correct 5 ms 2640 KB Output is correct
23 Correct 17 ms 31568 KB Output is correct
24 Correct 5 ms 2640 KB Output is correct
25 Correct 17 ms 31596 KB Output is correct
26 Correct 16 ms 31568 KB Output is correct
27 Correct 15 ms 31568 KB Output is correct
28 Correct 16 ms 31568 KB Output is correct
29 Correct 15 ms 31568 KB Output is correct
30 Correct 17 ms 31824 KB Output is correct
31 Correct 17 ms 31824 KB Output is correct
32 Correct 17 ms 31824 KB Output is correct
33 Correct 17 ms 31568 KB Output is correct
34 Correct 18 ms 31824 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 16976 KB Output is correct
37 Correct 13 ms 16976 KB Output is correct
38 Correct 6 ms 8796 KB Output is correct
39 Correct 8 ms 8784 KB Output is correct
40 Correct 22 ms 31964 KB Output is correct
41 Correct 5 ms 8784 KB Output is correct
42 Correct 22 ms 31824 KB Output is correct
43 Correct 22 ms 31824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 784 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 508 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 436 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 466 ms 318876 KB Output is correct
12 Correct 1 ms 504 KB Output is correct
13 Correct 484 ms 318964 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 457 ms 313272 KB Output is correct
16 Correct 459 ms 319048 KB Output is correct
17 Correct 457 ms 289608 KB Output is correct
18 Correct 468 ms 294472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 18 ms 31756 KB Output is correct
4 Correct 14 ms 11512 KB Output is correct
5 Correct 17 ms 13396 KB Output is correct
6 Correct 17 ms 31568 KB Output is correct
7 Correct 16 ms 31568 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 1 ms 564 KB Output is correct
10 Correct 6 ms 2808 KB Output is correct
11 Correct 12 ms 9296 KB Output is correct
12 Correct 13 ms 11428 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 16 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31568 KB Output is correct
19 Correct 6 ms 592 KB Output is correct
20 Correct 11 ms 31644 KB Output is correct
21 Correct 12 ms 31568 KB Output is correct
22 Correct 5 ms 2640 KB Output is correct
23 Correct 17 ms 31568 KB Output is correct
24 Correct 5 ms 2640 KB Output is correct
25 Correct 17 ms 31596 KB Output is correct
26 Correct 16 ms 31568 KB Output is correct
27 Correct 15 ms 31568 KB Output is correct
28 Correct 16 ms 31568 KB Output is correct
29 Correct 15 ms 31568 KB Output is correct
30 Correct 17 ms 31824 KB Output is correct
31 Correct 17 ms 31824 KB Output is correct
32 Correct 17 ms 31824 KB Output is correct
33 Correct 17 ms 31568 KB Output is correct
34 Correct 18 ms 31824 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 16976 KB Output is correct
37 Correct 13 ms 16976 KB Output is correct
38 Correct 6 ms 8796 KB Output is correct
39 Correct 8 ms 8784 KB Output is correct
40 Correct 22 ms 31964 KB Output is correct
41 Correct 5 ms 8784 KB Output is correct
42 Correct 22 ms 31824 KB Output is correct
43 Correct 22 ms 31824 KB Output is correct
44 Correct 640 ms 35596 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 25 ms 31824 KB Output is correct
47 Correct 38 ms 32476 KB Output is correct
48 Correct 24 ms 31824 KB Output is correct
49 Correct 43 ms 32336 KB Output is correct
50 Correct 38 ms 32592 KB Output is correct
51 Correct 74 ms 33780 KB Output is correct
52 Correct 12 ms 3320 KB Output is correct
53 Correct 71 ms 34400 KB Output is correct
54 Correct 87 ms 33872 KB Output is correct
55 Correct 16 ms 31568 KB Output is correct
56 Correct 12 ms 3152 KB Output is correct
57 Correct 5 ms 592 KB Output is correct
58 Correct 76 ms 29824 KB Output is correct
59 Correct 54 ms 31824 KB Output is correct
60 Correct 20 ms 31568 KB Output is correct
61 Correct 59 ms 31824 KB Output is correct
62 Correct 54 ms 32080 KB Output is correct
63 Correct 664 ms 35400 KB Output is correct
64 Correct 349 ms 33912 KB Output is correct
65 Correct 25 ms 31824 KB Output is correct
66 Correct 64 ms 32080 KB Output is correct
67 Correct 193 ms 32848 KB Output is correct
68 Correct 337 ms 33864 KB Output is correct
69 Correct 21 ms 31824 KB Output is correct
70 Correct 52 ms 32336 KB Output is correct
71 Correct 189 ms 32936 KB Output is correct
72 Correct 121 ms 32684 KB Output is correct
73 Correct 16 ms 31568 KB Output is correct
74 Correct 54 ms 32268 KB Output is correct
75 Correct 122 ms 32592 KB Output is correct
76 Correct 29 ms 32080 KB Output is correct
77 Correct 47 ms 32848 KB Output is correct
78 Correct 16 ms 31568 KB Output is correct
79 Correct 24 ms 17744 KB Output is correct
80 Correct 28 ms 32080 KB Output is correct
81 Correct 49 ms 33104 KB Output is correct
82 Correct 6 ms 8784 KB Output is correct
83 Correct 24 ms 17812 KB Output is correct
84 Correct 39 ms 32592 KB Output is correct
85 Correct 6 ms 8784 KB Output is correct
86 Correct 52 ms 32432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 18 ms 31756 KB Output is correct
4 Correct 14 ms 11512 KB Output is correct
5 Correct 17 ms 13396 KB Output is correct
6 Correct 17 ms 31568 KB Output is correct
7 Correct 16 ms 31568 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 1 ms 564 KB Output is correct
10 Correct 6 ms 2808 KB Output is correct
11 Correct 12 ms 9296 KB Output is correct
12 Correct 13 ms 11428 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 16 ms 31568 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31568 KB Output is correct
19 Correct 6 ms 592 KB Output is correct
20 Correct 11 ms 31644 KB Output is correct
21 Correct 12 ms 31568 KB Output is correct
22 Correct 5 ms 2640 KB Output is correct
23 Correct 17 ms 31568 KB Output is correct
24 Correct 5 ms 2640 KB Output is correct
25 Correct 17 ms 31596 KB Output is correct
26 Correct 16 ms 31568 KB Output is correct
27 Correct 15 ms 31568 KB Output is correct
28 Correct 16 ms 31568 KB Output is correct
29 Correct 15 ms 31568 KB Output is correct
30 Correct 17 ms 31824 KB Output is correct
31 Correct 17 ms 31824 KB Output is correct
32 Correct 17 ms 31824 KB Output is correct
33 Correct 17 ms 31568 KB Output is correct
34 Correct 18 ms 31824 KB Output is correct
35 Correct 9 ms 16976 KB Output is correct
36 Correct 9 ms 16976 KB Output is correct
37 Correct 13 ms 16976 KB Output is correct
38 Correct 6 ms 8796 KB Output is correct
39 Correct 8 ms 8784 KB Output is correct
40 Correct 22 ms 31964 KB Output is correct
41 Correct 5 ms 8784 KB Output is correct
42 Correct 22 ms 31824 KB Output is correct
43 Correct 22 ms 31824 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 331 ms 315248 KB Output is correct
46 Correct 218 ms 310088 KB Output is correct
47 Correct 320 ms 314952 KB Output is correct
48 Correct 334 ms 307020 KB Output is correct
49 Correct 136 ms 197448 KB Output is correct
50 Correct 378 ms 301392 KB Output is correct
51 Correct 328 ms 314696 KB Output is correct
52 Correct 168 ms 309584 KB Output is correct
53 Correct 137 ms 213576 KB Output is correct
54 Correct 47 ms 3912 KB Output is correct
55 Correct 374 ms 310344 KB Output is correct
56 Correct 123 ms 309104 KB Output is correct
57 Correct 162 ms 310464 KB Output is correct
58 Correct 328 ms 304968 KB Output is correct
59 Correct 130 ms 296776 KB Output is correct
60 Correct 124 ms 307280 KB Output is correct
61 Correct 322 ms 311112 KB Output is correct
62 Correct 238 ms 284744 KB Output is correct
63 Correct 235 ms 277836 KB Output is correct
64 Correct 129 ms 269992 KB Output is correct
65 Correct 295 ms 299600 KB Output is correct
66 Correct 198 ms 293960 KB Output is correct
67 Correct 222 ms 292688 KB Output is correct
68 Correct 252 ms 295752 KB Output is correct
69 Correct 297 ms 277256 KB Output is correct
70 Correct 160 ms 299984 KB Output is correct
71 Correct 261 ms 290388 KB Output is correct
72 Correct 228 ms 280392 KB Output is correct
73 Correct 295 ms 290740 KB Output is correct
74 Correct 170 ms 257352 KB Output is correct
75 Correct 119 ms 157428 KB Output is correct
76 Correct 225 ms 270256 KB Output is correct
77 Correct 313 ms 273124 KB Output is correct
78 Correct 139 ms 158892 KB Output is correct
79 Correct 124 ms 155208 KB Output is correct
80 Correct 61 ms 77904 KB Output is correct
81 Correct 140 ms 158040 KB Output is correct
82 Correct 248 ms 283976 KB Output is correct
83 Correct 59 ms 80208 KB Output is correct
84 Correct 236 ms 268056 KB Output is correct