# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
197164 | 2020-01-19T12:10:14 Z | arnold518 | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 5500 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 5e4; int N, K, ans=1; vector<int> adj[MAXN+10]; bool vis[MAXN+10]; int main() { int i, j, k; scanf("%d%d", &N, &K); for(i=1; i<=N; i++) { int s; scanf("%d", &s); while(s--) { int t; scanf("%d", &t); adj[i].push_back(t+1); } } for(i=1; i<=N; i++) sort(adj[i].begin(), adj[i].end()); while(1) { pii t(987654321, 0); for(i=1; i<=N; i++) if(!vis[i]) t=min(t, pii(adj[i].size(), i)); if(t.second==0) break; int now=t.second; vector<int> chd; for(auto it : adj[now]) chd.push_back(it); for(i=0; i<(1<<chd.size()); i++) { vector<int> V; for(j=0; j<chd.size(); j++) if(i&(1<<j)) V.push_back(chd[j]); bool flag=true; for(j=0; j<V.size(); j++) for(k=j+1; k<V.size(); k++) if(!binary_search(adj[V[j]].begin(), adj[V[j]].end(), V[k])) flag=false; if(flag) ans=max(ans, (int)V.size()+1); } vis[now]=true; for(auto it : chd) adj[it].erase(lower_bound(adj[it].begin(), adj[it].end(), now)); adj[now].clear(); } printf("%d", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Correct | 123 ms | 1656 KB | Output is correct |
4 | Correct | 51 ms | 1784 KB | Output is correct |
5 | Correct | 51 ms | 1656 KB | Output is correct |
6 | Correct | 58 ms | 1656 KB | Output is correct |
7 | Correct | 57 ms | 1656 KB | Output is correct |
8 | Correct | 47 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 47 ms | 1528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Correct | 123 ms | 1656 KB | Output is correct |
4 | Correct | 51 ms | 1784 KB | Output is correct |
5 | Correct | 51 ms | 1656 KB | Output is correct |
6 | Correct | 58 ms | 1656 KB | Output is correct |
7 | Correct | 57 ms | 1656 KB | Output is correct |
8 | Correct | 47 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 47 ms | 1528 KB | Output is correct |
11 | Correct | 57 ms | 1712 KB | Output is correct |
12 | Correct | 51 ms | 1656 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
14 | Correct | 51 ms | 1656 KB | Output is correct |
15 | Correct | 3 ms | 1528 KB | Output is correct |
16 | Correct | 58 ms | 1728 KB | Output is correct |
17 | Correct | 3 ms | 1528 KB | Output is correct |
18 | Correct | 58 ms | 1656 KB | Output is correct |
19 | Correct | 47 ms | 1528 KB | Output is correct |
20 | Correct | 75 ms | 1656 KB | Output is correct |
21 | Correct | 76 ms | 1656 KB | Output is correct |
22 | Correct | 47 ms | 1528 KB | Output is correct |
23 | Correct | 134 ms | 1656 KB | Output is correct |
24 | Correct | 47 ms | 1528 KB | Output is correct |
25 | Correct | 138 ms | 1756 KB | Output is correct |
26 | Correct | 134 ms | 1656 KB | Output is correct |
27 | Correct | 110 ms | 1704 KB | Output is correct |
28 | Correct | 136 ms | 1732 KB | Output is correct |
29 | Correct | 109 ms | 1756 KB | Output is correct |
30 | Correct | 115 ms | 1656 KB | Output is correct |
31 | Correct | 126 ms | 1784 KB | Output is correct |
32 | Correct | 115 ms | 1784 KB | Output is correct |
33 | Correct | 124 ms | 1656 KB | Output is correct |
34 | Correct | 122 ms | 1656 KB | Output is correct |
35 | Correct | 30 ms | 1556 KB | Output is correct |
36 | Correct | 30 ms | 1528 KB | Output is correct |
37 | Correct | 30 ms | 1528 KB | Output is correct |
38 | Correct | 9 ms | 1528 KB | Output is correct |
39 | Correct | 9 ms | 1528 KB | Output is correct |
40 | Correct | 144 ms | 1756 KB | Output is correct |
41 | Correct | 8 ms | 1528 KB | Output is correct |
42 | Correct | 144 ms | 1656 KB | Output is correct |
43 | Correct | 143 ms | 1788 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Correct | 3 ms | 1528 KB | Output is correct |
4 | Correct | 3 ms | 1528 KB | Output is correct |
5 | Correct | 3 ms | 1528 KB | Output is correct |
6 | Correct | 3 ms | 1528 KB | Output is correct |
7 | Correct | 3 ms | 1528 KB | Output is correct |
8 | Correct | 3 ms | 1528 KB | Output is correct |
9 | Correct | 3 ms | 1532 KB | Output is correct |
10 | Correct | 3 ms | 1528 KB | Output is correct |
11 | Execution timed out | 3007 ms | 5500 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Correct | 123 ms | 1656 KB | Output is correct |
4 | Correct | 51 ms | 1784 KB | Output is correct |
5 | Correct | 51 ms | 1656 KB | Output is correct |
6 | Correct | 58 ms | 1656 KB | Output is correct |
7 | Correct | 57 ms | 1656 KB | Output is correct |
8 | Correct | 47 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 47 ms | 1528 KB | Output is correct |
11 | Correct | 57 ms | 1712 KB | Output is correct |
12 | Correct | 51 ms | 1656 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
14 | Correct | 51 ms | 1656 KB | Output is correct |
15 | Correct | 3 ms | 1528 KB | Output is correct |
16 | Correct | 58 ms | 1728 KB | Output is correct |
17 | Correct | 3 ms | 1528 KB | Output is correct |
18 | Correct | 58 ms | 1656 KB | Output is correct |
19 | Correct | 47 ms | 1528 KB | Output is correct |
20 | Correct | 75 ms | 1656 KB | Output is correct |
21 | Correct | 76 ms | 1656 KB | Output is correct |
22 | Correct | 47 ms | 1528 KB | Output is correct |
23 | Correct | 134 ms | 1656 KB | Output is correct |
24 | Correct | 47 ms | 1528 KB | Output is correct |
25 | Correct | 138 ms | 1756 KB | Output is correct |
26 | Correct | 134 ms | 1656 KB | Output is correct |
27 | Correct | 110 ms | 1704 KB | Output is correct |
28 | Correct | 136 ms | 1732 KB | Output is correct |
29 | Correct | 109 ms | 1756 KB | Output is correct |
30 | Correct | 115 ms | 1656 KB | Output is correct |
31 | Correct | 126 ms | 1784 KB | Output is correct |
32 | Correct | 115 ms | 1784 KB | Output is correct |
33 | Correct | 124 ms | 1656 KB | Output is correct |
34 | Correct | 122 ms | 1656 KB | Output is correct |
35 | Correct | 30 ms | 1556 KB | Output is correct |
36 | Correct | 30 ms | 1528 KB | Output is correct |
37 | Correct | 30 ms | 1528 KB | Output is correct |
38 | Correct | 9 ms | 1528 KB | Output is correct |
39 | Correct | 9 ms | 1528 KB | Output is correct |
40 | Correct | 144 ms | 1756 KB | Output is correct |
41 | Correct | 8 ms | 1528 KB | Output is correct |
42 | Correct | 144 ms | 1656 KB | Output is correct |
43 | Correct | 143 ms | 1788 KB | Output is correct |
44 | Correct | 185 ms | 1776 KB | Output is correct |
45 | Correct | 3 ms | 1528 KB | Output is correct |
46 | Correct | 136 ms | 1656 KB | Output is correct |
47 | Correct | 147 ms | 1784 KB | Output is correct |
48 | Correct | 140 ms | 1656 KB | Output is correct |
49 | Correct | 151 ms | 1912 KB | Output is correct |
50 | Correct | 145 ms | 1884 KB | Output is correct |
51 | Correct | 609 ms | 2168 KB | Output is correct |
52 | Correct | 51 ms | 1832 KB | Output is correct |
53 | Correct | 1145 ms | 2296 KB | Output is correct |
54 | Correct | 1185 ms | 2172 KB | Output is correct |
55 | Correct | 58 ms | 1660 KB | Output is correct |
56 | Correct | 51 ms | 1760 KB | Output is correct |
57 | Correct | 47 ms | 1540 KB | Output is correct |
58 | Correct | 1152 ms | 2296 KB | Output is correct |
59 | Correct | 103 ms | 1656 KB | Output is correct |
60 | Correct | 58 ms | 1656 KB | Output is correct |
61 | Correct | 108 ms | 1656 KB | Output is correct |
62 | Correct | 104 ms | 1692 KB | Output is correct |
63 | Correct | 186 ms | 1784 KB | Output is correct |
64 | Correct | 143 ms | 1784 KB | Output is correct |
65 | Correct | 136 ms | 1716 KB | Output is correct |
66 | Correct | 103 ms | 1784 KB | Output is correct |
67 | Correct | 194 ms | 1876 KB | Output is correct |
68 | Correct | 143 ms | 1656 KB | Output is correct |
69 | Correct | 135 ms | 1716 KB | Output is correct |
70 | Correct | 140 ms | 1804 KB | Output is correct |
71 | Correct | 189 ms | 1872 KB | Output is correct |
72 | Correct | 174 ms | 1864 KB | Output is correct |
73 | Correct | 110 ms | 1700 KB | Output is correct |
74 | Correct | 141 ms | 1784 KB | Output is correct |
75 | Correct | 178 ms | 1912 KB | Output is correct |
76 | Correct | 137 ms | 1656 KB | Output is correct |
77 | Correct | 287 ms | 1912 KB | Output is correct |
78 | Correct | 110 ms | 1660 KB | Output is correct |
79 | Correct | 110 ms | 1756 KB | Output is correct |
80 | Correct | 136 ms | 1756 KB | Output is correct |
81 | Correct | 287 ms | 1912 KB | Output is correct |
82 | Correct | 8 ms | 1532 KB | Output is correct |
83 | Correct | 113 ms | 1732 KB | Output is correct |
84 | Correct | 180 ms | 1912 KB | Output is correct |
85 | Correct | 8 ms | 1528 KB | Output is correct |
86 | Correct | 181 ms | 1912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Correct | 123 ms | 1656 KB | Output is correct |
4 | Correct | 51 ms | 1784 KB | Output is correct |
5 | Correct | 51 ms | 1656 KB | Output is correct |
6 | Correct | 58 ms | 1656 KB | Output is correct |
7 | Correct | 57 ms | 1656 KB | Output is correct |
8 | Correct | 47 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 47 ms | 1528 KB | Output is correct |
11 | Correct | 57 ms | 1712 KB | Output is correct |
12 | Correct | 51 ms | 1656 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
14 | Correct | 51 ms | 1656 KB | Output is correct |
15 | Correct | 3 ms | 1528 KB | Output is correct |
16 | Correct | 58 ms | 1728 KB | Output is correct |
17 | Correct | 3 ms | 1528 KB | Output is correct |
18 | Correct | 58 ms | 1656 KB | Output is correct |
19 | Correct | 47 ms | 1528 KB | Output is correct |
20 | Correct | 75 ms | 1656 KB | Output is correct |
21 | Correct | 76 ms | 1656 KB | Output is correct |
22 | Correct | 47 ms | 1528 KB | Output is correct |
23 | Correct | 134 ms | 1656 KB | Output is correct |
24 | Correct | 47 ms | 1528 KB | Output is correct |
25 | Correct | 138 ms | 1756 KB | Output is correct |
26 | Correct | 134 ms | 1656 KB | Output is correct |
27 | Correct | 110 ms | 1704 KB | Output is correct |
28 | Correct | 136 ms | 1732 KB | Output is correct |
29 | Correct | 109 ms | 1756 KB | Output is correct |
30 | Correct | 115 ms | 1656 KB | Output is correct |
31 | Correct | 126 ms | 1784 KB | Output is correct |
32 | Correct | 115 ms | 1784 KB | Output is correct |
33 | Correct | 124 ms | 1656 KB | Output is correct |
34 | Correct | 122 ms | 1656 KB | Output is correct |
35 | Correct | 30 ms | 1556 KB | Output is correct |
36 | Correct | 30 ms | 1528 KB | Output is correct |
37 | Correct | 30 ms | 1528 KB | Output is correct |
38 | Correct | 9 ms | 1528 KB | Output is correct |
39 | Correct | 9 ms | 1528 KB | Output is correct |
40 | Correct | 144 ms | 1756 KB | Output is correct |
41 | Correct | 8 ms | 1528 KB | Output is correct |
42 | Correct | 144 ms | 1656 KB | Output is correct |
43 | Correct | 143 ms | 1788 KB | Output is correct |
44 | Correct | 3 ms | 1528 KB | Output is correct |
45 | Execution timed out | 3012 ms | 4020 KB | Time limit exceeded |
46 | Halted | 0 ms | 0 KB | - |