Submission #1115912

# Submission time Handle Problem Language Result Execution time Memory
1115912 2024-11-21T04:08:51 Z kustizus Political Development (BOI17_politicaldevelopment) C++17
39 / 100
3000 ms 524288 KB
#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

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:9:61: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | #define read_input(file) if (fopen(file".inp", "r")) freopen(file".inp", "r", stdin);
      |                                                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:57:5: note: in expansion of macro 'read_input'
   57 |     read_input("file");
      |     ^~~~~~~~~~
# 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 19 ms 32284 KB Output is correct
4 Correct 18 ms 32140 KB Output is correct
5 Correct 16 ms 32140 KB Output is correct
6 Correct 17 ms 32140 KB Output is correct
7 Correct 18 ms 32140 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 5 ms 5112 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 19 ms 32284 KB Output is correct
4 Correct 18 ms 32140 KB Output is correct
5 Correct 16 ms 32140 KB Output is correct
6 Correct 17 ms 32140 KB Output is correct
7 Correct 18 ms 32140 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 5 ms 5112 KB Output is correct
11 Correct 15 ms 32140 KB Output is correct
12 Correct 16 ms 32252 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 32156 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 19 ms 32140 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 18 ms 32160 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 12 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 4 ms 4944 KB Output is correct
23 Correct 19 ms 32140 KB Output is correct
24 Correct 4 ms 4944 KB Output is correct
25 Correct 18 ms 32140 KB Output is correct
26 Correct 17 ms 32140 KB Output is correct
27 Correct 20 ms 32192 KB Output is correct
28 Correct 17 ms 32140 KB Output is correct
29 Correct 16 ms 32140 KB Output is correct
30 Correct 24 ms 32140 KB Output is correct
31 Correct 19 ms 32156 KB Output is correct
32 Correct 19 ms 32520 KB Output is correct
33 Correct 18 ms 32140 KB Output is correct
34 Correct 18 ms 32144 KB Output is correct
35 Correct 9 ms 17488 KB Output is correct
36 Correct 10 ms 17488 KB Output is correct
37 Correct 10 ms 17660 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9040 KB Output is correct
40 Correct 25 ms 32908 KB Output is correct
41 Correct 7 ms 9040 KB Output is correct
42 Correct 31 ms 32908 KB Output is correct
43 Correct 26 ms 32908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1016 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 2 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 651 ms 333884 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Execution timed out 3096 ms 430144 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 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 19 ms 32284 KB Output is correct
4 Correct 18 ms 32140 KB Output is correct
5 Correct 16 ms 32140 KB Output is correct
6 Correct 17 ms 32140 KB Output is correct
7 Correct 18 ms 32140 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 5 ms 5112 KB Output is correct
11 Correct 15 ms 32140 KB Output is correct
12 Correct 16 ms 32252 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 32156 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 19 ms 32140 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 18 ms 32160 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 12 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 4 ms 4944 KB Output is correct
23 Correct 19 ms 32140 KB Output is correct
24 Correct 4 ms 4944 KB Output is correct
25 Correct 18 ms 32140 KB Output is correct
26 Correct 17 ms 32140 KB Output is correct
27 Correct 20 ms 32192 KB Output is correct
28 Correct 17 ms 32140 KB Output is correct
29 Correct 16 ms 32140 KB Output is correct
30 Correct 24 ms 32140 KB Output is correct
31 Correct 19 ms 32156 KB Output is correct
32 Correct 19 ms 32520 KB Output is correct
33 Correct 18 ms 32140 KB Output is correct
34 Correct 18 ms 32144 KB Output is correct
35 Correct 9 ms 17488 KB Output is correct
36 Correct 10 ms 17488 KB Output is correct
37 Correct 10 ms 17660 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9040 KB Output is correct
40 Correct 25 ms 32908 KB Output is correct
41 Correct 7 ms 9040 KB Output is correct
42 Correct 31 ms 32908 KB Output is correct
43 Correct 26 ms 32908 KB Output is correct
44 Runtime error 2101 ms 524288 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -
# 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 19 ms 32284 KB Output is correct
4 Correct 18 ms 32140 KB Output is correct
5 Correct 16 ms 32140 KB Output is correct
6 Correct 17 ms 32140 KB Output is correct
7 Correct 18 ms 32140 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 5 ms 5112 KB Output is correct
11 Correct 15 ms 32140 KB Output is correct
12 Correct 16 ms 32252 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 32156 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 19 ms 32140 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 18 ms 32160 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 12 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 4 ms 4944 KB Output is correct
23 Correct 19 ms 32140 KB Output is correct
24 Correct 4 ms 4944 KB Output is correct
25 Correct 18 ms 32140 KB Output is correct
26 Correct 17 ms 32140 KB Output is correct
27 Correct 20 ms 32192 KB Output is correct
28 Correct 17 ms 32140 KB Output is correct
29 Correct 16 ms 32140 KB Output is correct
30 Correct 24 ms 32140 KB Output is correct
31 Correct 19 ms 32156 KB Output is correct
32 Correct 19 ms 32520 KB Output is correct
33 Correct 18 ms 32140 KB Output is correct
34 Correct 18 ms 32144 KB Output is correct
35 Correct 9 ms 17488 KB Output is correct
36 Correct 10 ms 17488 KB Output is correct
37 Correct 10 ms 17660 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9040 KB Output is correct
40 Correct 25 ms 32908 KB Output is correct
41 Correct 7 ms 9040 KB Output is correct
42 Correct 31 ms 32908 KB Output is correct
43 Correct 26 ms 32908 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 442 ms 331692 KB Output is correct
46 Correct 301 ms 320748 KB Output is correct
47 Correct 405 ms 329716 KB Output is correct
48 Correct 400 ms 331732 KB Output is correct
49 Correct 153 ms 314584 KB Output is correct
50 Correct 410 ms 332008 KB Output is correct
51 Correct 405 ms 331768 KB Output is correct
52 Correct 172 ms 314608 KB Output is correct
53 Correct 160 ms 314620 KB Output is correct
54 Correct 29 ms 3588 KB Output is correct
55 Correct 449 ms 332012 KB Output is correct
56 Correct 141 ms 312068 KB Output is correct
57 Correct 189 ms 314664 KB Output is correct
58 Correct 1166 ms 362184 KB Output is correct
59 Correct 138 ms 312060 KB Output is correct
60 Correct 143 ms 312060 KB Output is correct
61 Correct 1171 ms 362216 KB Output is correct
62 Correct 348 ms 320500 KB Output is correct
63 Correct 320 ms 322288 KB Output is correct
64 Correct 137 ms 312060 KB Output is correct
65 Correct 568 ms 333292 KB Output is correct
66 Correct 360 ms 320504 KB Output is correct
67 Correct 313 ms 322288 KB Output is correct
68 Correct 356 ms 323312 KB Output is correct
69 Correct 520 ms 333356 KB Output is correct
70 Correct 181 ms 314776 KB Output is correct
71 Correct 340 ms 323516 KB Output is correct
72 Correct 248 ms 320252 KB Output is correct
73 Correct 358 ms 323320 KB Output is correct
74 Correct 181 ms 314876 KB Output is correct
75 Correct 141 ms 161512 KB Output is correct
76 Correct 238 ms 320504 KB Output is correct
77 Correct 363 ms 323320 KB Output is correct
78 Correct 190 ms 162808 KB Output is correct
79 Correct 151 ms 161532 KB Output is correct
80 Correct 81 ms 81924 KB Output is correct
81 Correct 179 ms 162808 KB Output is correct
82 Correct 317 ms 321484 KB Output is correct
83 Correct 70 ms 81916 KB Output is correct
84 Correct 313 ms 321524 KB Output is correct