답안 #1115899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115899 2024-11-21T03:41:00 Z vjudge1 Political Development (BOI17_politicaldevelopment) C++17
100 / 100
551 ms 304300 KB
#pragma GCC optimize("Ofast" , "unroll-loops")
#include<bits/stdc++.h>

#define bit(i , j) ((j >> i) & 1)
#define fi first
#define se second
#define all(x) (x).begin() , (x).end()
using namespace std;

const int MAXN = 2e5+100;
const long long inf = 1e9+7;

#define int long long
#define pll pair<int , int>
#define MP make_pair

bitset<50010> g[MAXN];
vector<vector<int>> C[11];
int32_t main(){
	//freopen("seq.inp", "r", stdin);
   //freopen("seq.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n , k; cin >> n >> k;
	for(int i = 0 ; i < n ; i++){
		int D; cin >> D;
		while(D--){
			int x; cin >> x; g[min(i , x)][max(i , x)] = 1;
		}
		C[1].push_back({i});
	}

	bitset<50010> B;
	int jj = 1;
	while(C[jj].size() > 0){
		for(auto x : C[jj]){
			int lst = -1;
			for(auto y : x){
				if(lst == -1) B = g[y];
				else B = B & g[y];
				lst = y;
			}
			for(int j = B._Find_first() ; j < n ; j = B._Find_next(j)){
				vector<int> tmp = x;
				tmp.push_back(j);
				C[jj+1].push_back(tmp);
			}
		}
		jj++;
	}

	cout << jj-1 << "\n";


	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 14 ms 32120 KB Output is correct
4 Correct 9 ms 11344 KB Output is correct
5 Correct 9 ms 13392 KB Output is correct
6 Correct 12 ms 31824 KB Output is correct
7 Correct 12 ms 31824 KB Output is correct
8 Correct 3 ms 848 KB Output is correct
9 Correct 1 ms 388 KB Output is correct
10 Correct 4 ms 3064 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 14 ms 32120 KB Output is correct
4 Correct 9 ms 11344 KB Output is correct
5 Correct 9 ms 13392 KB Output is correct
6 Correct 12 ms 31824 KB Output is correct
7 Correct 12 ms 31824 KB Output is correct
8 Correct 3 ms 848 KB Output is correct
9 Correct 1 ms 388 KB Output is correct
10 Correct 4 ms 3064 KB Output is correct
11 Correct 9 ms 9464 KB Output is correct
12 Correct 8 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 9 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 12 ms 31972 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 11 ms 31824 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 11 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 13 ms 32032 KB Output is correct
24 Correct 3 ms 2896 KB Output is correct
25 Correct 12 ms 31844 KB Output is correct
26 Correct 12 ms 31824 KB Output is correct
27 Correct 11 ms 31824 KB Output is correct
28 Correct 12 ms 31824 KB Output is correct
29 Correct 11 ms 31824 KB Output is correct
30 Correct 13 ms 31824 KB Output is correct
31 Correct 13 ms 31824 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 14 ms 31824 KB Output is correct
34 Correct 13 ms 31824 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 7 ms 17400 KB Output is correct
37 Correct 6 ms 17292 KB Output is correct
38 Correct 5 ms 9040 KB Output is correct
39 Correct 4 ms 9040 KB Output is correct
40 Correct 16 ms 32140 KB Output is correct
41 Correct 4 ms 9040 KB Output is correct
42 Correct 16 ms 32144 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 848 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 388 ms 289372 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 371 ms 287352 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 376 ms 284752 KB Output is correct
16 Correct 365 ms 284904 KB Output is correct
17 Correct 387 ms 287468 KB Output is correct
18 Correct 360 ms 293364 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 14 ms 32120 KB Output is correct
4 Correct 9 ms 11344 KB Output is correct
5 Correct 9 ms 13392 KB Output is correct
6 Correct 12 ms 31824 KB Output is correct
7 Correct 12 ms 31824 KB Output is correct
8 Correct 3 ms 848 KB Output is correct
9 Correct 1 ms 388 KB Output is correct
10 Correct 4 ms 3064 KB Output is correct
11 Correct 9 ms 9464 KB Output is correct
12 Correct 8 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 9 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 12 ms 31972 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 11 ms 31824 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 11 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 13 ms 32032 KB Output is correct
24 Correct 3 ms 2896 KB Output is correct
25 Correct 12 ms 31844 KB Output is correct
26 Correct 12 ms 31824 KB Output is correct
27 Correct 11 ms 31824 KB Output is correct
28 Correct 12 ms 31824 KB Output is correct
29 Correct 11 ms 31824 KB Output is correct
30 Correct 13 ms 31824 KB Output is correct
31 Correct 13 ms 31824 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 14 ms 31824 KB Output is correct
34 Correct 13 ms 31824 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 7 ms 17400 KB Output is correct
37 Correct 6 ms 17292 KB Output is correct
38 Correct 5 ms 9040 KB Output is correct
39 Correct 4 ms 9040 KB Output is correct
40 Correct 16 ms 32140 KB Output is correct
41 Correct 4 ms 9040 KB Output is correct
42 Correct 16 ms 32144 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
44 Correct 551 ms 52112 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 17 ms 32140 KB Output is correct
47 Correct 27 ms 32908 KB Output is correct
48 Correct 18 ms 32140 KB Output is correct
49 Correct 28 ms 33076 KB Output is correct
50 Correct 33 ms 32908 KB Output is correct
51 Correct 61 ms 34224 KB Output is correct
52 Correct 10 ms 3152 KB Output is correct
53 Correct 48 ms 34056 KB Output is correct
54 Correct 64 ms 34556 KB Output is correct
55 Correct 13 ms 31824 KB Output is correct
56 Correct 8 ms 3320 KB Output is correct
57 Correct 3 ms 848 KB Output is correct
58 Correct 48 ms 30092 KB Output is correct
59 Correct 42 ms 33168 KB Output is correct
60 Correct 13 ms 31992 KB Output is correct
61 Correct 51 ms 33076 KB Output is correct
62 Correct 44 ms 33164 KB Output is correct
63 Correct 542 ms 52216 KB Output is correct
64 Correct 292 ms 41980 KB Output is correct
65 Correct 18 ms 32140 KB Output is correct
66 Correct 47 ms 33168 KB Output is correct
67 Correct 163 ms 37632 KB Output is correct
68 Correct 275 ms 42072 KB Output is correct
69 Correct 18 ms 32140 KB Output is correct
70 Correct 41 ms 33024 KB Output is correct
71 Correct 163 ms 37632 KB Output is correct
72 Correct 94 ms 35328 KB Output is correct
73 Correct 13 ms 31824 KB Output is correct
74 Correct 41 ms 33036 KB Output is correct
75 Correct 108 ms 35132 KB Output is correct
76 Correct 22 ms 32140 KB Output is correct
77 Correct 38 ms 33032 KB Output is correct
78 Correct 13 ms 31824 KB Output is correct
79 Correct 18 ms 17972 KB Output is correct
80 Correct 21 ms 32140 KB Output is correct
81 Correct 36 ms 33200 KB Output is correct
82 Correct 5 ms 9040 KB Output is correct
83 Correct 18 ms 17804 KB Output is correct
84 Correct 45 ms 32808 KB Output is correct
85 Correct 5 ms 9040 KB Output is correct
86 Correct 33 ms 32908 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 14 ms 32120 KB Output is correct
4 Correct 9 ms 11344 KB Output is correct
5 Correct 9 ms 13392 KB Output is correct
6 Correct 12 ms 31824 KB Output is correct
7 Correct 12 ms 31824 KB Output is correct
8 Correct 3 ms 848 KB Output is correct
9 Correct 1 ms 388 KB Output is correct
10 Correct 4 ms 3064 KB Output is correct
11 Correct 9 ms 9464 KB Output is correct
12 Correct 8 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 9 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 12 ms 31972 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 11 ms 31824 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 11 ms 31824 KB Output is correct
21 Correct 11 ms 31824 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 13 ms 32032 KB Output is correct
24 Correct 3 ms 2896 KB Output is correct
25 Correct 12 ms 31844 KB Output is correct
26 Correct 12 ms 31824 KB Output is correct
27 Correct 11 ms 31824 KB Output is correct
28 Correct 12 ms 31824 KB Output is correct
29 Correct 11 ms 31824 KB Output is correct
30 Correct 13 ms 31824 KB Output is correct
31 Correct 13 ms 31824 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 14 ms 31824 KB Output is correct
34 Correct 13 ms 31824 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 7 ms 17400 KB Output is correct
37 Correct 6 ms 17292 KB Output is correct
38 Correct 5 ms 9040 KB Output is correct
39 Correct 4 ms 9040 KB Output is correct
40 Correct 16 ms 32140 KB Output is correct
41 Correct 4 ms 9040 KB Output is correct
42 Correct 16 ms 32144 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 280 ms 263716 KB Output is correct
46 Correct 174 ms 261544 KB Output is correct
47 Correct 247 ms 282756 KB Output is correct
48 Correct 243 ms 283896 KB Output is correct
49 Correct 93 ms 199164 KB Output is correct
50 Correct 262 ms 292268 KB Output is correct
51 Correct 245 ms 285448 KB Output is correct
52 Correct 121 ms 269564 KB Output is correct
53 Correct 93 ms 215708 KB Output is correct
54 Correct 25 ms 3588 KB Output is correct
55 Correct 295 ms 303548 KB Output is correct
56 Correct 109 ms 275196 KB Output is correct
57 Correct 130 ms 276476 KB Output is correct
58 Correct 300 ms 282104 KB Output is correct
59 Correct 101 ms 274940 KB Output is correct
60 Correct 102 ms 276812 KB Output is correct
61 Correct 292 ms 294144 KB Output is correct
62 Correct 170 ms 287996 KB Output is correct
63 Correct 199 ms 283656 KB Output is correct
64 Correct 105 ms 274940 KB Output is correct
65 Correct 255 ms 283360 KB Output is correct
66 Correct 171 ms 282440 KB Output is correct
67 Correct 190 ms 304300 KB Output is correct
68 Correct 221 ms 301816 KB Output is correct
69 Correct 258 ms 301048 KB Output is correct
70 Correct 141 ms 296188 KB Output is correct
71 Correct 220 ms 303608 KB Output is correct
72 Correct 179 ms 298236 KB Output is correct
73 Correct 242 ms 301184 KB Output is correct
74 Correct 136 ms 296188 KB Output is correct
75 Correct 96 ms 158464 KB Output is correct
76 Correct 188 ms 289276 KB Output is correct
77 Correct 240 ms 289784 KB Output is correct
78 Correct 117 ms 159236 KB Output is correct
79 Correct 92 ms 156380 KB Output is correct
80 Correct 42 ms 78476 KB Output is correct
81 Correct 111 ms 159232 KB Output is correct
82 Correct 211 ms 252408 KB Output is correct
83 Correct 44 ms 80516 KB Output is correct
84 Correct 200 ms 272896 KB Output is correct