답안 #572712

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572712 2022-06-05T06:54:52 Z 장태환(#8351) Political Development (BOI17_politicaldevelopment) C++17
100 / 100
412 ms 316824 KB
#include <bits/stdc++.h>
using namespace std;
bitset<50100>larr[50100];
vector<int>link[50100];
int rlink[50];
int cnt[50010];
int er[50010];
priority_queue<pair<int, int>>t;
int main()
{
	int N, M;
	cin >> N >> M;
	int i;
	for (i = 0; i < N; i++)
	{
		cin >> cnt[i];
		t.push({ -cnt[i],i });
		int j;
		for (j = 0; j < cnt[i]; j++)
		{
			int a;
			cin >> a;
			link[i].push_back(a);
			larr[i].set(a);
		}
	}
	int ma = 0;
	while (t.size())
	{
		auto r = t.top();
		t.pop();
		if (er[r.second])
			continue;
		int rc = 0;
		er[r.second] = 1;
		int j;
		for (j = 0; j < link[r.second].size(); j++)
		{
			if (er[link[r.second][j]])
				continue;
			rlink[rc++] = link[r.second][j];
			cnt[link[r.second][j]]--;
			t.push({ -cnt[link[r.second][j]],link[r.second][j] });
		}
		for (j = 0; j < (1<<rc); j++)
		{
			int c = 0;
			int k;
			for (k = 0; k < rc; k++)
			{
				if ((1 << k) & j)
				{
					c++;
					int l;
					for (l = 0; l < k; l++)
					{
						if (((1 << l) & j) && !larr[rlink[k]][rlink[l]])
							goto T;
					}
				}
			}
			ma = max(ma, c+1);
			if (ma == M)
			{
				cout << ma;
				return 0;
			}
		T:
			int d;
		}
	
	}
	cout << ma;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:37:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for (j = 0; j < link[r.second].size(); j++)
      |               ~~^~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:69:8: warning: unused variable 'd' [-Wunused-variable]
   69 |    int d;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 17 ms 22464 KB Output is correct
4 Correct 13 ms 21776 KB Output is correct
5 Correct 13 ms 21848 KB Output is correct
6 Correct 13 ms 21844 KB Output is correct
7 Correct 13 ms 21844 KB Output is correct
8 Correct 4 ms 1620 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 3 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 17 ms 22464 KB Output is correct
4 Correct 13 ms 21776 KB Output is correct
5 Correct 13 ms 21848 KB Output is correct
6 Correct 13 ms 21844 KB Output is correct
7 Correct 13 ms 21844 KB Output is correct
8 Correct 4 ms 1620 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 3 ms 1624 KB Output is correct
11 Correct 15 ms 21812 KB Output is correct
12 Correct 15 ms 21844 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 17 ms 21828 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 18 ms 21796 KB Output is correct
17 Correct 2 ms 1492 KB Output is correct
18 Correct 18 ms 21844 KB Output is correct
19 Correct 3 ms 1620 KB Output is correct
20 Correct 11 ms 21716 KB Output is correct
21 Correct 12 ms 21716 KB Output is correct
22 Correct 3 ms 1624 KB Output is correct
23 Correct 21 ms 22996 KB Output is correct
24 Correct 3 ms 1632 KB Output is correct
25 Correct 16 ms 22868 KB Output is correct
26 Correct 16 ms 22248 KB Output is correct
27 Correct 14 ms 22860 KB Output is correct
28 Correct 15 ms 22080 KB Output is correct
29 Correct 14 ms 22732 KB Output is correct
30 Correct 17 ms 22732 KB Output is correct
31 Correct 15 ms 23124 KB Output is correct
32 Correct 18 ms 22724 KB Output is correct
33 Correct 18 ms 23124 KB Output is correct
34 Correct 18 ms 23104 KB Output is correct
35 Correct 9 ms 11988 KB Output is correct
36 Correct 9 ms 11868 KB Output is correct
37 Correct 10 ms 11900 KB Output is correct
38 Correct 5 ms 6620 KB Output is correct
39 Correct 7 ms 6612 KB Output is correct
40 Correct 19 ms 23536 KB Output is correct
41 Correct 5 ms 6612 KB Output is correct
42 Correct 20 ms 23508 KB Output is correct
43 Correct 16 ms 23380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1620 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 1 ms 1492 KB Output is correct
4 Correct 1 ms 1492 KB Output is correct
5 Correct 1 ms 1572 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1488 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
11 Correct 412 ms 316824 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 385 ms 316792 KB Output is correct
14 Correct 1 ms 1492 KB Output is correct
15 Correct 370 ms 316780 KB Output is correct
16 Correct 369 ms 316764 KB Output is correct
17 Correct 393 ms 316732 KB Output is correct
18 Correct 386 ms 316768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 17 ms 22464 KB Output is correct
4 Correct 13 ms 21776 KB Output is correct
5 Correct 13 ms 21848 KB Output is correct
6 Correct 13 ms 21844 KB Output is correct
7 Correct 13 ms 21844 KB Output is correct
8 Correct 4 ms 1620 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 3 ms 1624 KB Output is correct
11 Correct 15 ms 21812 KB Output is correct
12 Correct 15 ms 21844 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 17 ms 21828 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 18 ms 21796 KB Output is correct
17 Correct 2 ms 1492 KB Output is correct
18 Correct 18 ms 21844 KB Output is correct
19 Correct 3 ms 1620 KB Output is correct
20 Correct 11 ms 21716 KB Output is correct
21 Correct 12 ms 21716 KB Output is correct
22 Correct 3 ms 1624 KB Output is correct
23 Correct 21 ms 22996 KB Output is correct
24 Correct 3 ms 1632 KB Output is correct
25 Correct 16 ms 22868 KB Output is correct
26 Correct 16 ms 22248 KB Output is correct
27 Correct 14 ms 22860 KB Output is correct
28 Correct 15 ms 22080 KB Output is correct
29 Correct 14 ms 22732 KB Output is correct
30 Correct 17 ms 22732 KB Output is correct
31 Correct 15 ms 23124 KB Output is correct
32 Correct 18 ms 22724 KB Output is correct
33 Correct 18 ms 23124 KB Output is correct
34 Correct 18 ms 23104 KB Output is correct
35 Correct 9 ms 11988 KB Output is correct
36 Correct 9 ms 11868 KB Output is correct
37 Correct 10 ms 11900 KB Output is correct
38 Correct 5 ms 6620 KB Output is correct
39 Correct 7 ms 6612 KB Output is correct
40 Correct 19 ms 23536 KB Output is correct
41 Correct 5 ms 6612 KB Output is correct
42 Correct 20 ms 23508 KB Output is correct
43 Correct 16 ms 23380 KB Output is correct
44 Correct 43 ms 24308 KB Output is correct
45 Correct 1 ms 1488 KB Output is correct
46 Correct 26 ms 23376 KB Output is correct
47 Correct 29 ms 24668 KB Output is correct
48 Correct 23 ms 23444 KB Output is correct
49 Correct 33 ms 24648 KB Output is correct
50 Correct 26 ms 24448 KB Output is correct
51 Correct 54 ms 25688 KB Output is correct
52 Correct 14 ms 21752 KB Output is correct
53 Correct 67 ms 25784 KB Output is correct
54 Correct 79 ms 25800 KB Output is correct
55 Correct 14 ms 21892 KB Output is correct
56 Correct 15 ms 21832 KB Output is correct
57 Correct 2 ms 1620 KB Output is correct
58 Correct 66 ms 25672 KB Output is correct
59 Correct 25 ms 23640 KB Output is correct
60 Correct 19 ms 21860 KB Output is correct
61 Correct 19 ms 23604 KB Output is correct
62 Correct 23 ms 23636 KB Output is correct
63 Correct 45 ms 24420 KB Output is correct
64 Correct 31 ms 24268 KB Output is correct
65 Correct 17 ms 23384 KB Output is correct
66 Correct 22 ms 23736 KB Output is correct
67 Correct 44 ms 24788 KB Output is correct
68 Correct 39 ms 24324 KB Output is correct
69 Correct 23 ms 23380 KB Output is correct
70 Correct 29 ms 24272 KB Output is correct
71 Correct 37 ms 24496 KB Output is correct
72 Correct 32 ms 24612 KB Output is correct
73 Correct 14 ms 22768 KB Output is correct
74 Correct 28 ms 24328 KB Output is correct
75 Correct 38 ms 24648 KB Output is correct
76 Correct 28 ms 24028 KB Output is correct
77 Correct 48 ms 25084 KB Output is correct
78 Correct 17 ms 22868 KB Output is correct
79 Correct 18 ms 12756 KB Output is correct
80 Correct 21 ms 24020 KB Output is correct
81 Correct 38 ms 25088 KB Output is correct
82 Correct 5 ms 6624 KB Output is correct
83 Correct 21 ms 12756 KB Output is correct
84 Correct 39 ms 24848 KB Output is correct
85 Correct 6 ms 6612 KB Output is correct
86 Correct 32 ms 24908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 17 ms 22464 KB Output is correct
4 Correct 13 ms 21776 KB Output is correct
5 Correct 13 ms 21848 KB Output is correct
6 Correct 13 ms 21844 KB Output is correct
7 Correct 13 ms 21844 KB Output is correct
8 Correct 4 ms 1620 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 3 ms 1624 KB Output is correct
11 Correct 15 ms 21812 KB Output is correct
12 Correct 15 ms 21844 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 17 ms 21828 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 18 ms 21796 KB Output is correct
17 Correct 2 ms 1492 KB Output is correct
18 Correct 18 ms 21844 KB Output is correct
19 Correct 3 ms 1620 KB Output is correct
20 Correct 11 ms 21716 KB Output is correct
21 Correct 12 ms 21716 KB Output is correct
22 Correct 3 ms 1624 KB Output is correct
23 Correct 21 ms 22996 KB Output is correct
24 Correct 3 ms 1632 KB Output is correct
25 Correct 16 ms 22868 KB Output is correct
26 Correct 16 ms 22248 KB Output is correct
27 Correct 14 ms 22860 KB Output is correct
28 Correct 15 ms 22080 KB Output is correct
29 Correct 14 ms 22732 KB Output is correct
30 Correct 17 ms 22732 KB Output is correct
31 Correct 15 ms 23124 KB Output is correct
32 Correct 18 ms 22724 KB Output is correct
33 Correct 18 ms 23124 KB Output is correct
34 Correct 18 ms 23104 KB Output is correct
35 Correct 9 ms 11988 KB Output is correct
36 Correct 9 ms 11868 KB Output is correct
37 Correct 10 ms 11900 KB Output is correct
38 Correct 5 ms 6620 KB Output is correct
39 Correct 7 ms 6612 KB Output is correct
40 Correct 19 ms 23536 KB Output is correct
41 Correct 5 ms 6612 KB Output is correct
42 Correct 20 ms 23508 KB Output is correct
43 Correct 16 ms 23380 KB Output is correct
44 Correct 1 ms 1492 KB Output is correct
45 Correct 238 ms 308788 KB Output is correct
46 Correct 206 ms 278440 KB Output is correct
47 Correct 261 ms 307776 KB Output is correct
48 Correct 248 ms 308680 KB Output is correct
49 Correct 113 ms 205004 KB Output is correct
50 Correct 262 ms 315088 KB Output is correct
51 Correct 265 ms 307468 KB Output is correct
52 Correct 122 ms 191832 KB Output is correct
53 Correct 121 ms 205084 KB Output is correct
54 Correct 17 ms 2508 KB Output is correct
55 Correct 283 ms 315176 KB Output is correct
56 Correct 104 ms 190564 KB Output is correct
57 Correct 146 ms 193108 KB Output is correct
58 Correct 199 ms 292044 KB Output is correct
59 Correct 123 ms 190336 KB Output is correct
60 Correct 104 ms 190368 KB Output is correct
61 Correct 198 ms 291792 KB Output is correct
62 Correct 154 ms 263256 KB Output is correct
63 Correct 191 ms 286916 KB Output is correct
64 Correct 120 ms 190784 KB Output is correct
65 Correct 219 ms 297592 KB Output is correct
66 Correct 154 ms 263532 KB Output is correct
67 Correct 193 ms 286536 KB Output is correct
68 Correct 255 ms 295884 KB Output is correct
69 Correct 221 ms 296628 KB Output is correct
70 Correct 157 ms 263120 KB Output is correct
71 Correct 239 ms 296004 KB Output is correct
72 Correct 199 ms 277392 KB Output is correct
73 Correct 230 ms 309028 KB Output is correct
74 Correct 157 ms 262988 KB Output is correct
75 Correct 109 ms 143844 KB Output is correct
76 Correct 181 ms 270336 KB Output is correct
77 Correct 243 ms 309020 KB Output is correct
78 Correct 119 ms 149740 KB Output is correct
79 Correct 119 ms 144416 KB Output is correct
80 Correct 43 ms 59120 KB Output is correct
81 Correct 115 ms 149508 KB Output is correct
82 Correct 231 ms 304512 KB Output is correct
83 Correct 53 ms 59188 KB Output is correct
84 Correct 218 ms 304372 KB Output is correct