답안 #551430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551430 2022-04-20T16:16:26 Z blue Political Development (BOI17_politicaldevelopment) C++17
100 / 100
433 ms 29160 KB
#include <iostream>
#include <vector>
#include <set>
using namespace std;

using vi = vector<int>;
using pii = pair<int, int>;
#define sz(x) int(x.size())

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int N, K;
	cin >> N >> K;

	set<int> edge[N];

	set<pii> people;

	for(int i = 0; i < N; i++)
	{
		int D;
		cin >> D;

		people.insert({D, i});

		for(int j = 0; j < D; j++)
		{
			int k;
			cin >> k;

			edge[i].insert(k);
		}
	}

	int res = 1;

	// cerr << "check\n";

	vi getlog(100'000, 0);
	for(int i = 0; i < 15; i++)
		getlog[(1<<i)] = i;

	for(int t = 0; t < N; t++)
	{
		// cerr << "t = " << t << '\n';
		int u = people.begin()->second;
		people.erase(people.begin());

		// cerr << "u = " << u << '\n';

		vi currpeople{u};

		for(int v : edge[u])
		{
			currpeople.push_back(v);
		}

		int h = sz(currpeople);

		vi conn(h, 0);
		for(int i = 0; i < h; i++)
		{
			for(int j = i+1; j < h; j++)
			{
				if(edge[currpeople[i]].find(currpeople[j]) != edge[currpeople[i]].end())
				{
					conn[i] |= (1<<j);
					conn[j] |= (1<<i);
				}
			}
		}

		// cerr << "done\n";

		vi clique((1<<h), 0);
		for(int s = 1; s < (1<<h); s++)
		{
			int ss = s&-s;
			int rs = s - ss;	

			if((conn[getlog[ss]] & rs) == rs)
				clique[s] = clique[rs] + 1;

			res = max(res, clique[s]);
		}

		for(int v : edge[u])
		{
			people.erase({sz(edge[v]), v});
			edge[v].erase(u);
			people.insert({sz(edge[v]), v});

		}
	}

	cout << res << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 700 KB Output is correct
3 Correct 6 ms 1620 KB Output is correct
4 Correct 5 ms 1620 KB Output is correct
5 Correct 5 ms 1612 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 6 ms 1620 KB Output is correct
8 Correct 3 ms 1096 KB Output is correct
9 Correct 1 ms 704 KB Output is correct
10 Correct 3 ms 1092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 700 KB Output is correct
3 Correct 6 ms 1620 KB Output is correct
4 Correct 5 ms 1620 KB Output is correct
5 Correct 5 ms 1612 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 6 ms 1620 KB Output is correct
8 Correct 3 ms 1096 KB Output is correct
9 Correct 1 ms 704 KB Output is correct
10 Correct 3 ms 1092 KB Output is correct
11 Correct 7 ms 1620 KB Output is correct
12 Correct 7 ms 1616 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1612 KB Output is correct
15 Correct 1 ms 596 KB Output is correct
16 Correct 6 ms 1620 KB Output is correct
17 Correct 1 ms 704 KB Output is correct
18 Correct 6 ms 1620 KB Output is correct
19 Correct 2 ms 1108 KB Output is correct
20 Correct 3 ms 1364 KB Output is correct
21 Correct 4 ms 1364 KB Output is correct
22 Correct 2 ms 1108 KB Output is correct
23 Correct 7 ms 1748 KB Output is correct
24 Correct 3 ms 1108 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 9 ms 1748 KB Output is correct
27 Correct 5 ms 1620 KB Output is correct
28 Correct 6 ms 1748 KB Output is correct
29 Correct 5 ms 1620 KB Output is correct
30 Correct 8 ms 1780 KB Output is correct
31 Correct 7 ms 1868 KB Output is correct
32 Correct 9 ms 1876 KB Output is correct
33 Correct 6 ms 1876 KB Output is correct
34 Correct 6 ms 1876 KB Output is correct
35 Correct 4 ms 1228 KB Output is correct
36 Correct 4 ms 1224 KB Output is correct
37 Correct 4 ms 1236 KB Output is correct
38 Correct 3 ms 980 KB Output is correct
39 Correct 3 ms 980 KB Output is correct
40 Correct 10 ms 2124 KB Output is correct
41 Correct 3 ms 976 KB Output is correct
42 Correct 13 ms 2192 KB Output is correct
43 Correct 11 ms 2132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1108 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 364 ms 29104 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 385 ms 29160 KB Output is correct
14 Correct 1 ms 724 KB Output is correct
15 Correct 433 ms 29152 KB Output is correct
16 Correct 358 ms 29120 KB Output is correct
17 Correct 419 ms 29064 KB Output is correct
18 Correct 359 ms 29132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 700 KB Output is correct
3 Correct 6 ms 1620 KB Output is correct
4 Correct 5 ms 1620 KB Output is correct
5 Correct 5 ms 1612 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 6 ms 1620 KB Output is correct
8 Correct 3 ms 1096 KB Output is correct
9 Correct 1 ms 704 KB Output is correct
10 Correct 3 ms 1092 KB Output is correct
11 Correct 7 ms 1620 KB Output is correct
12 Correct 7 ms 1616 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1612 KB Output is correct
15 Correct 1 ms 596 KB Output is correct
16 Correct 6 ms 1620 KB Output is correct
17 Correct 1 ms 704 KB Output is correct
18 Correct 6 ms 1620 KB Output is correct
19 Correct 2 ms 1108 KB Output is correct
20 Correct 3 ms 1364 KB Output is correct
21 Correct 4 ms 1364 KB Output is correct
22 Correct 2 ms 1108 KB Output is correct
23 Correct 7 ms 1748 KB Output is correct
24 Correct 3 ms 1108 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 9 ms 1748 KB Output is correct
27 Correct 5 ms 1620 KB Output is correct
28 Correct 6 ms 1748 KB Output is correct
29 Correct 5 ms 1620 KB Output is correct
30 Correct 8 ms 1780 KB Output is correct
31 Correct 7 ms 1868 KB Output is correct
32 Correct 9 ms 1876 KB Output is correct
33 Correct 6 ms 1876 KB Output is correct
34 Correct 6 ms 1876 KB Output is correct
35 Correct 4 ms 1228 KB Output is correct
36 Correct 4 ms 1224 KB Output is correct
37 Correct 4 ms 1236 KB Output is correct
38 Correct 3 ms 980 KB Output is correct
39 Correct 3 ms 980 KB Output is correct
40 Correct 10 ms 2124 KB Output is correct
41 Correct 3 ms 976 KB Output is correct
42 Correct 13 ms 2192 KB Output is correct
43 Correct 11 ms 2132 KB Output is correct
44 Correct 18 ms 3176 KB Output is correct
45 Correct 1 ms 724 KB Output is correct
46 Correct 12 ms 2132 KB Output is correct
47 Correct 24 ms 3180 KB Output is correct
48 Correct 11 ms 2132 KB Output is correct
49 Correct 23 ms 3156 KB Output is correct
50 Correct 21 ms 3156 KB Output is correct
51 Correct 56 ms 5200 KB Output is correct
52 Correct 7 ms 1608 KB Output is correct
53 Correct 55 ms 5900 KB Output is correct
54 Correct 69 ms 5796 KB Output is correct
55 Correct 9 ms 1620 KB Output is correct
56 Correct 8 ms 1620 KB Output is correct
57 Correct 2 ms 1108 KB Output is correct
58 Correct 54 ms 5756 KB Output is correct
59 Correct 8 ms 2132 KB Output is correct
60 Correct 6 ms 1620 KB Output is correct
61 Correct 8 ms 2132 KB Output is correct
62 Correct 9 ms 2124 KB Output is correct
63 Correct 21 ms 3168 KB Output is correct
64 Correct 19 ms 2900 KB Output is correct
65 Correct 12 ms 2004 KB Output is correct
66 Correct 9 ms 2132 KB Output is correct
67 Correct 27 ms 3664 KB Output is correct
68 Correct 20 ms 2888 KB Output is correct
69 Correct 10 ms 2004 KB Output is correct
70 Correct 17 ms 3020 KB Output is correct
71 Correct 26 ms 3552 KB Output is correct
72 Correct 24 ms 3560 KB Output is correct
73 Correct 6 ms 1620 KB Output is correct
74 Correct 20 ms 3028 KB Output is correct
75 Correct 25 ms 3532 KB Output is correct
76 Correct 17 ms 2540 KB Output is correct
77 Correct 33 ms 4052 KB Output is correct
78 Correct 7 ms 1608 KB Output is correct
79 Correct 16 ms 2388 KB Output is correct
80 Correct 17 ms 2516 KB Output is correct
81 Correct 35 ms 4052 KB Output is correct
82 Correct 3 ms 980 KB Output is correct
83 Correct 17 ms 2376 KB Output is correct
84 Correct 24 ms 3420 KB Output is correct
85 Correct 3 ms 980 KB Output is correct
86 Correct 25 ms 3424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 700 KB Output is correct
3 Correct 6 ms 1620 KB Output is correct
4 Correct 5 ms 1620 KB Output is correct
5 Correct 5 ms 1612 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 6 ms 1620 KB Output is correct
8 Correct 3 ms 1096 KB Output is correct
9 Correct 1 ms 704 KB Output is correct
10 Correct 3 ms 1092 KB Output is correct
11 Correct 7 ms 1620 KB Output is correct
12 Correct 7 ms 1616 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1612 KB Output is correct
15 Correct 1 ms 596 KB Output is correct
16 Correct 6 ms 1620 KB Output is correct
17 Correct 1 ms 704 KB Output is correct
18 Correct 6 ms 1620 KB Output is correct
19 Correct 2 ms 1108 KB Output is correct
20 Correct 3 ms 1364 KB Output is correct
21 Correct 4 ms 1364 KB Output is correct
22 Correct 2 ms 1108 KB Output is correct
23 Correct 7 ms 1748 KB Output is correct
24 Correct 3 ms 1108 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 9 ms 1748 KB Output is correct
27 Correct 5 ms 1620 KB Output is correct
28 Correct 6 ms 1748 KB Output is correct
29 Correct 5 ms 1620 KB Output is correct
30 Correct 8 ms 1780 KB Output is correct
31 Correct 7 ms 1868 KB Output is correct
32 Correct 9 ms 1876 KB Output is correct
33 Correct 6 ms 1876 KB Output is correct
34 Correct 6 ms 1876 KB Output is correct
35 Correct 4 ms 1228 KB Output is correct
36 Correct 4 ms 1224 KB Output is correct
37 Correct 4 ms 1236 KB Output is correct
38 Correct 3 ms 980 KB Output is correct
39 Correct 3 ms 980 KB Output is correct
40 Correct 10 ms 2124 KB Output is correct
41 Correct 3 ms 976 KB Output is correct
42 Correct 13 ms 2192 KB Output is correct
43 Correct 11 ms 2132 KB Output is correct
44 Correct 1 ms 704 KB Output is correct
45 Correct 237 ms 21220 KB Output is correct
46 Correct 86 ms 13292 KB Output is correct
47 Correct 267 ms 21264 KB Output is correct
48 Correct 242 ms 21184 KB Output is correct
49 Correct 60 ms 10744 KB Output is correct
50 Correct 198 ms 26452 KB Output is correct
51 Correct 269 ms 21256 KB Output is correct
52 Correct 56 ms 10764 KB Output is correct
53 Correct 58 ms 10736 KB Output is correct
54 Correct 19 ms 5452 KB Output is correct
55 Correct 212 ms 26512 KB Output is correct
56 Correct 49 ms 8064 KB Output is correct
57 Correct 56 ms 10760 KB Output is correct
58 Correct 71 ms 13336 KB Output is correct
59 Correct 37 ms 8012 KB Output is correct
60 Correct 49 ms 8128 KB Output is correct
61 Correct 79 ms 13336 KB Output is correct
62 Correct 57 ms 10656 KB Output is correct
63 Correct 117 ms 14664 KB Output is correct
64 Correct 34 ms 8136 KB Output is correct
65 Correct 175 ms 17300 KB Output is correct
66 Correct 61 ms 10720 KB Output is correct
67 Correct 131 ms 14592 KB Output is correct
68 Correct 147 ms 16584 KB Output is correct
69 Correct 163 ms 17316 KB Output is correct
70 Correct 63 ms 10700 KB Output is correct
71 Correct 183 ms 16704 KB Output is correct
72 Correct 117 ms 14180 KB Output is correct
73 Correct 204 ms 18984 KB Output is correct
74 Correct 63 ms 10668 KB Output is correct
75 Correct 60 ms 8164 KB Output is correct
76 Correct 109 ms 14216 KB Output is correct
77 Correct 179 ms 18916 KB Output is correct
78 Correct 75 ms 9804 KB Output is correct
79 Correct 62 ms 8104 KB Output is correct
80 Correct 25 ms 4344 KB Output is correct
81 Correct 82 ms 9816 KB Output is correct
82 Correct 123 ms 16004 KB Output is correct
83 Correct 24 ms 4428 KB Output is correct
84 Correct 132 ms 15940 KB Output is correct