# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197161 | 2020-01-19T12:00:27 Z | arnold518 | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 25860 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; set<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].insert(t+1); } } 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(adj[V[j]].find(V[k])==adj[V[j]].end()) flag=false; if(flag) ans=max(ans, (int)V.size()+1); } vis[now]=true; for(auto it : chd) adj[it].erase(now); adj[now].clear(); } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 124 ms | 3064 KB | Output is correct |
4 | Correct | 53 ms | 3192 KB | Output is correct |
5 | Correct | 53 ms | 3236 KB | Output is correct |
6 | Correct | 58 ms | 3192 KB | Output is correct |
7 | Correct | 57 ms | 3320 KB | Output is correct |
8 | Correct | 48 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 53 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 124 ms | 3064 KB | Output is correct |
4 | Correct | 53 ms | 3192 KB | Output is correct |
5 | Correct | 53 ms | 3236 KB | Output is correct |
6 | Correct | 58 ms | 3192 KB | Output is correct |
7 | Correct | 57 ms | 3320 KB | Output is correct |
8 | Correct | 48 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 53 ms | 2680 KB | Output is correct |
11 | Correct | 53 ms | 3192 KB | Output is correct |
12 | Correct | 55 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 49 ms | 3408 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 58 ms | 3232 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 59 ms | 3064 KB | Output is correct |
19 | Correct | 49 ms | 2680 KB | Output is correct |
20 | Correct | 86 ms | 2988 KB | Output is correct |
21 | Correct | 88 ms | 3064 KB | Output is correct |
22 | Correct | 49 ms | 2680 KB | Output is correct |
23 | Correct | 136 ms | 3364 KB | Output is correct |
24 | Correct | 48 ms | 2728 KB | Output is correct |
25 | Correct | 136 ms | 3448 KB | Output is correct |
26 | Correct | 136 ms | 3320 KB | Output is correct |
27 | Correct | 117 ms | 3320 KB | Output is correct |
28 | Correct | 144 ms | 3320 KB | Output is correct |
29 | Correct | 121 ms | 3256 KB | Output is correct |
30 | Correct | 110 ms | 3448 KB | Output is correct |
31 | Correct | 124 ms | 3420 KB | Output is correct |
32 | Correct | 120 ms | 3412 KB | Output is correct |
33 | Correct | 123 ms | 3448 KB | Output is correct |
34 | Correct | 123 ms | 3320 KB | Output is correct |
35 | Correct | 33 ms | 3096 KB | Output is correct |
36 | Correct | 33 ms | 3064 KB | Output is correct |
37 | Correct | 32 ms | 2940 KB | Output is correct |
38 | Correct | 9 ms | 2936 KB | Output is correct |
39 | Correct | 10 ms | 2936 KB | Output is correct |
40 | Correct | 147 ms | 3808 KB | Output is correct |
41 | Correct | 12 ms | 2940 KB | Output is correct |
42 | Correct | 144 ms | 3704 KB | Output is correct |
43 | Correct | 141 ms | 3748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 2756 KB | Output is correct |
2 | Correct | 4 ms | 2684 KB | Output is correct |
3 | Correct | 4 ms | 2728 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 4 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2676 KB | Output is correct |
8 | Correct | 4 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2680 KB | Output is correct |
11 | Execution timed out | 3042 ms | 25860 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 124 ms | 3064 KB | Output is correct |
4 | Correct | 53 ms | 3192 KB | Output is correct |
5 | Correct | 53 ms | 3236 KB | Output is correct |
6 | Correct | 58 ms | 3192 KB | Output is correct |
7 | Correct | 57 ms | 3320 KB | Output is correct |
8 | Correct | 48 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 53 ms | 2680 KB | Output is correct |
11 | Correct | 53 ms | 3192 KB | Output is correct |
12 | Correct | 55 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 49 ms | 3408 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 58 ms | 3232 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 59 ms | 3064 KB | Output is correct |
19 | Correct | 49 ms | 2680 KB | Output is correct |
20 | Correct | 86 ms | 2988 KB | Output is correct |
21 | Correct | 88 ms | 3064 KB | Output is correct |
22 | Correct | 49 ms | 2680 KB | Output is correct |
23 | Correct | 136 ms | 3364 KB | Output is correct |
24 | Correct | 48 ms | 2728 KB | Output is correct |
25 | Correct | 136 ms | 3448 KB | Output is correct |
26 | Correct | 136 ms | 3320 KB | Output is correct |
27 | Correct | 117 ms | 3320 KB | Output is correct |
28 | Correct | 144 ms | 3320 KB | Output is correct |
29 | Correct | 121 ms | 3256 KB | Output is correct |
30 | Correct | 110 ms | 3448 KB | Output is correct |
31 | Correct | 124 ms | 3420 KB | Output is correct |
32 | Correct | 120 ms | 3412 KB | Output is correct |
33 | Correct | 123 ms | 3448 KB | Output is correct |
34 | Correct | 123 ms | 3320 KB | Output is correct |
35 | Correct | 33 ms | 3096 KB | Output is correct |
36 | Correct | 33 ms | 3064 KB | Output is correct |
37 | Correct | 32 ms | 2940 KB | Output is correct |
38 | Correct | 9 ms | 2936 KB | Output is correct |
39 | Correct | 10 ms | 2936 KB | Output is correct |
40 | Correct | 147 ms | 3808 KB | Output is correct |
41 | Correct | 12 ms | 2940 KB | Output is correct |
42 | Correct | 144 ms | 3704 KB | Output is correct |
43 | Correct | 141 ms | 3748 KB | Output is correct |
44 | Correct | 207 ms | 4796 KB | Output is correct |
45 | Correct | 4 ms | 2680 KB | Output is correct |
46 | Correct | 146 ms | 3760 KB | Output is correct |
47 | Correct | 157 ms | 4728 KB | Output is correct |
48 | Correct | 142 ms | 3704 KB | Output is correct |
49 | Correct | 158 ms | 4728 KB | Output is correct |
50 | Correct | 154 ms | 4728 KB | Output is correct |
51 | Correct | 642 ms | 6904 KB | Output is correct |
52 | Correct | 53 ms | 3192 KB | Output is correct |
53 | Correct | 1237 ms | 7288 KB | Output is correct |
54 | Correct | 1194 ms | 7500 KB | Output is correct |
55 | Correct | 58 ms | 3196 KB | Output is correct |
56 | Correct | 53 ms | 3320 KB | Output is correct |
57 | Correct | 48 ms | 2680 KB | Output is correct |
58 | Correct | 1195 ms | 7416 KB | Output is correct |
59 | Correct | 114 ms | 3704 KB | Output is correct |
60 | Correct | 57 ms | 3192 KB | Output is correct |
61 | Correct | 115 ms | 3704 KB | Output is correct |
62 | Correct | 120 ms | 3832 KB | Output is correct |
63 | Correct | 205 ms | 4796 KB | Output is correct |
64 | Correct | 161 ms | 4568 KB | Output is correct |
65 | Correct | 139 ms | 3704 KB | Output is correct |
66 | Correct | 114 ms | 3704 KB | Output is correct |
67 | Correct | 205 ms | 5112 KB | Output is correct |
68 | Correct | 160 ms | 4472 KB | Output is correct |
69 | Correct | 139 ms | 3576 KB | Output is correct |
70 | Correct | 140 ms | 4620 KB | Output is correct |
71 | Correct | 201 ms | 5212 KB | Output is correct |
72 | Correct | 185 ms | 4984 KB | Output is correct |
73 | Correct | 116 ms | 3192 KB | Output is correct |
74 | Correct | 150 ms | 4728 KB | Output is correct |
75 | Correct | 188 ms | 5240 KB | Output is correct |
76 | Correct | 142 ms | 4088 KB | Output is correct |
77 | Correct | 304 ms | 5624 KB | Output is correct |
78 | Correct | 118 ms | 3192 KB | Output is correct |
79 | Correct | 118 ms | 4188 KB | Output is correct |
80 | Correct | 145 ms | 4104 KB | Output is correct |
81 | Correct | 305 ms | 5752 KB | Output is correct |
82 | Correct | 10 ms | 2936 KB | Output is correct |
83 | Correct | 121 ms | 4216 KB | Output is correct |
84 | Correct | 197 ms | 5080 KB | Output is correct |
85 | Correct | 10 ms | 2936 KB | Output is correct |
86 | Correct | 192 ms | 4984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 124 ms | 3064 KB | Output is correct |
4 | Correct | 53 ms | 3192 KB | Output is correct |
5 | Correct | 53 ms | 3236 KB | Output is correct |
6 | Correct | 58 ms | 3192 KB | Output is correct |
7 | Correct | 57 ms | 3320 KB | Output is correct |
8 | Correct | 48 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 53 ms | 2680 KB | Output is correct |
11 | Correct | 53 ms | 3192 KB | Output is correct |
12 | Correct | 55 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 49 ms | 3408 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 58 ms | 3232 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 59 ms | 3064 KB | Output is correct |
19 | Correct | 49 ms | 2680 KB | Output is correct |
20 | Correct | 86 ms | 2988 KB | Output is correct |
21 | Correct | 88 ms | 3064 KB | Output is correct |
22 | Correct | 49 ms | 2680 KB | Output is correct |
23 | Correct | 136 ms | 3364 KB | Output is correct |
24 | Correct | 48 ms | 2728 KB | Output is correct |
25 | Correct | 136 ms | 3448 KB | Output is correct |
26 | Correct | 136 ms | 3320 KB | Output is correct |
27 | Correct | 117 ms | 3320 KB | Output is correct |
28 | Correct | 144 ms | 3320 KB | Output is correct |
29 | Correct | 121 ms | 3256 KB | Output is correct |
30 | Correct | 110 ms | 3448 KB | Output is correct |
31 | Correct | 124 ms | 3420 KB | Output is correct |
32 | Correct | 120 ms | 3412 KB | Output is correct |
33 | Correct | 123 ms | 3448 KB | Output is correct |
34 | Correct | 123 ms | 3320 KB | Output is correct |
35 | Correct | 33 ms | 3096 KB | Output is correct |
36 | Correct | 33 ms | 3064 KB | Output is correct |
37 | Correct | 32 ms | 2940 KB | Output is correct |
38 | Correct | 9 ms | 2936 KB | Output is correct |
39 | Correct | 10 ms | 2936 KB | Output is correct |
40 | Correct | 147 ms | 3808 KB | Output is correct |
41 | Correct | 12 ms | 2940 KB | Output is correct |
42 | Correct | 144 ms | 3704 KB | Output is correct |
43 | Correct | 141 ms | 3748 KB | Output is correct |
44 | Correct | 4 ms | 2680 KB | Output is correct |
45 | Execution timed out | 3029 ms | 18736 KB | Time limit exceeded |
46 | Halted | 0 ms | 0 KB | - |