# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
311252 | 2020-10-09T19:07:46 Z | Vladth11 | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 28920 KB |
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debug_with_space(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <ll, ll> pii; typedef pair <ll, pii> muchie; const ll NMAX = 100005; const ll INF = (1LL << 60); const ll MOD = 1000000007; const ll BLOCK = 101; set <int> v[NMAX],st; int maxim = 0; int deg[NMAX]; void clique(int i) { int nrbits = v[i].size(); // debug(i); if(nrbits > 10) return; for(int mask = 1; mask < (1 << nrbits); mask++) { int cnt = 0; int j = 0,cc = 0; st.clear(); for(auto y : v[i]){ if(mask & (1 << j)) st.insert(y); j++; } j = 0; for(auto y : v[i]) { if(mask & (1 << j)) { // debug(y); for(auto x : v[y]) { //debug(x); if(st.find(x) != st.end()) cnt++; } } j++; } int bb = __builtin_popcount(mask); // debug_with_space(mask); // debug(cnt); if(cnt == bb * bb) maxim = max(maxim, bb); } } struct cmp{ bool operator()(int x, int y){ return v[x].size() < v[y].size(); } }; int main() { // ifstream cin("catsfood.in"); // ofstream cout("catsfood.out"); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, i, d; cin >> n >> k; for(i = 1; i <= n; i++) { int d; cin >> d; v[i].insert(i); while(d--) { int x; cin >> x; v[i].insert(x + 1); v[x + 1].insert(i); } }priority_queue <int, vector <int>, cmp > pq; for(i = 1; i <= n; i++) { pq.push(i); } while(!pq.empty()){ int top = pq.top(); pq.pop(); clique(top); } cout << maxim; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4992 KB | Output is correct |
2 | Correct | 3 ms | 4992 KB | Output is correct |
3 | Correct | 53 ms | 5760 KB | Output is correct |
4 | Correct | 778 ms | 5880 KB | Output is correct |
5 | Correct | 793 ms | 5880 KB | Output is correct |
6 | Correct | 19 ms | 5760 KB | Output is correct |
7 | Correct | 19 ms | 5888 KB | Output is correct |
8 | Correct | 5 ms | 5376 KB | Output is correct |
9 | Correct | 4 ms | 4992 KB | Output is correct |
10 | Correct | 5 ms | 5376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4992 KB | Output is correct |
2 | Correct | 3 ms | 4992 KB | Output is correct |
3 | Correct | 53 ms | 5760 KB | Output is correct |
4 | Correct | 778 ms | 5880 KB | Output is correct |
5 | Correct | 793 ms | 5880 KB | Output is correct |
6 | Correct | 19 ms | 5760 KB | Output is correct |
7 | Correct | 19 ms | 5888 KB | Output is correct |
8 | Correct | 5 ms | 5376 KB | Output is correct |
9 | Correct | 4 ms | 4992 KB | Output is correct |
10 | Correct | 5 ms | 5376 KB | Output is correct |
11 | Correct | 836 ms | 6008 KB | Output is correct |
12 | Correct | 819 ms | 5908 KB | Output is correct |
13 | Correct | 4 ms | 4992 KB | Output is correct |
14 | Correct | 720 ms | 5912 KB | Output is correct |
15 | Correct | 4 ms | 4992 KB | Output is correct |
16 | Correct | 19 ms | 5888 KB | Output is correct |
17 | Correct | 4 ms | 4992 KB | Output is correct |
18 | Correct | 19 ms | 5888 KB | Output is correct |
19 | Correct | 5 ms | 5376 KB | Output is correct |
20 | Correct | 8 ms | 5632 KB | Output is correct |
21 | Correct | 8 ms | 5632 KB | Output is correct |
22 | Correct | 5 ms | 5376 KB | Output is correct |
23 | Correct | 52 ms | 6016 KB | Output is correct |
24 | Correct | 6 ms | 5504 KB | Output is correct |
25 | Correct | 53 ms | 6016 KB | Output is correct |
26 | Correct | 42 ms | 5976 KB | Output is correct |
27 | Correct | 14 ms | 5888 KB | Output is correct |
28 | Correct | 41 ms | 5888 KB | Output is correct |
29 | Correct | 14 ms | 5888 KB | Output is correct |
30 | Correct | 438 ms | 6016 KB | Output is correct |
31 | Correct | 41 ms | 6016 KB | Output is correct |
32 | Correct | 478 ms | 6016 KB | Output is correct |
33 | Correct | 39 ms | 6016 KB | Output is correct |
34 | Correct | 36 ms | 6060 KB | Output is correct |
35 | Correct | 20 ms | 5504 KB | Output is correct |
36 | Correct | 21 ms | 5504 KB | Output is correct |
37 | Correct | 21 ms | 5504 KB | Output is correct |
38 | Correct | 11 ms | 5248 KB | Output is correct |
39 | Correct | 11 ms | 5504 KB | Output is correct |
40 | Correct | 312 ms | 6520 KB | Output is correct |
41 | Correct | 11 ms | 5376 KB | Output is correct |
42 | Correct | 310 ms | 6520 KB | Output is correct |
43 | Correct | 298 ms | 6400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5376 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 5 ms | 4992 KB | Output is correct |
4 | Correct | 4 ms | 4992 KB | Output is correct |
5 | Correct | 5 ms | 4992 KB | Output is correct |
6 | Correct | 4 ms | 4992 KB | Output is correct |
7 | Correct | 4 ms | 5024 KB | Output is correct |
8 | Correct | 4 ms | 4992 KB | Output is correct |
9 | Correct | 4 ms | 4992 KB | Output is correct |
10 | Correct | 4 ms | 4992 KB | Output is correct |
11 | Execution timed out | 3088 ms | 28920 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4992 KB | Output is correct |
2 | Correct | 3 ms | 4992 KB | Output is correct |
3 | Correct | 53 ms | 5760 KB | Output is correct |
4 | Correct | 778 ms | 5880 KB | Output is correct |
5 | Correct | 793 ms | 5880 KB | Output is correct |
6 | Correct | 19 ms | 5760 KB | Output is correct |
7 | Correct | 19 ms | 5888 KB | Output is correct |
8 | Correct | 5 ms | 5376 KB | Output is correct |
9 | Correct | 4 ms | 4992 KB | Output is correct |
10 | Correct | 5 ms | 5376 KB | Output is correct |
11 | Correct | 836 ms | 6008 KB | Output is correct |
12 | Correct | 819 ms | 5908 KB | Output is correct |
13 | Correct | 4 ms | 4992 KB | Output is correct |
14 | Correct | 720 ms | 5912 KB | Output is correct |
15 | Correct | 4 ms | 4992 KB | Output is correct |
16 | Correct | 19 ms | 5888 KB | Output is correct |
17 | Correct | 4 ms | 4992 KB | Output is correct |
18 | Correct | 19 ms | 5888 KB | Output is correct |
19 | Correct | 5 ms | 5376 KB | Output is correct |
20 | Correct | 8 ms | 5632 KB | Output is correct |
21 | Correct | 8 ms | 5632 KB | Output is correct |
22 | Correct | 5 ms | 5376 KB | Output is correct |
23 | Correct | 52 ms | 6016 KB | Output is correct |
24 | Correct | 6 ms | 5504 KB | Output is correct |
25 | Correct | 53 ms | 6016 KB | Output is correct |
26 | Correct | 42 ms | 5976 KB | Output is correct |
27 | Correct | 14 ms | 5888 KB | Output is correct |
28 | Correct | 41 ms | 5888 KB | Output is correct |
29 | Correct | 14 ms | 5888 KB | Output is correct |
30 | Correct | 438 ms | 6016 KB | Output is correct |
31 | Correct | 41 ms | 6016 KB | Output is correct |
32 | Correct | 478 ms | 6016 KB | Output is correct |
33 | Correct | 39 ms | 6016 KB | Output is correct |
34 | Correct | 36 ms | 6060 KB | Output is correct |
35 | Correct | 20 ms | 5504 KB | Output is correct |
36 | Correct | 21 ms | 5504 KB | Output is correct |
37 | Correct | 21 ms | 5504 KB | Output is correct |
38 | Correct | 11 ms | 5248 KB | Output is correct |
39 | Correct | 11 ms | 5504 KB | Output is correct |
40 | Correct | 312 ms | 6520 KB | Output is correct |
41 | Correct | 11 ms | 5376 KB | Output is correct |
42 | Correct | 310 ms | 6520 KB | Output is correct |
43 | Correct | 298 ms | 6400 KB | Output is correct |
44 | Correct | 2529 ms | 7452 KB | Output is correct |
45 | Correct | 4 ms | 4992 KB | Output is correct |
46 | Incorrect | 329 ms | 6400 KB | Output isn't correct |
47 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4992 KB | Output is correct |
2 | Correct | 3 ms | 4992 KB | Output is correct |
3 | Correct | 53 ms | 5760 KB | Output is correct |
4 | Correct | 778 ms | 5880 KB | Output is correct |
5 | Correct | 793 ms | 5880 KB | Output is correct |
6 | Correct | 19 ms | 5760 KB | Output is correct |
7 | Correct | 19 ms | 5888 KB | Output is correct |
8 | Correct | 5 ms | 5376 KB | Output is correct |
9 | Correct | 4 ms | 4992 KB | Output is correct |
10 | Correct | 5 ms | 5376 KB | Output is correct |
11 | Correct | 836 ms | 6008 KB | Output is correct |
12 | Correct | 819 ms | 5908 KB | Output is correct |
13 | Correct | 4 ms | 4992 KB | Output is correct |
14 | Correct | 720 ms | 5912 KB | Output is correct |
15 | Correct | 4 ms | 4992 KB | Output is correct |
16 | Correct | 19 ms | 5888 KB | Output is correct |
17 | Correct | 4 ms | 4992 KB | Output is correct |
18 | Correct | 19 ms | 5888 KB | Output is correct |
19 | Correct | 5 ms | 5376 KB | Output is correct |
20 | Correct | 8 ms | 5632 KB | Output is correct |
21 | Correct | 8 ms | 5632 KB | Output is correct |
22 | Correct | 5 ms | 5376 KB | Output is correct |
23 | Correct | 52 ms | 6016 KB | Output is correct |
24 | Correct | 6 ms | 5504 KB | Output is correct |
25 | Correct | 53 ms | 6016 KB | Output is correct |
26 | Correct | 42 ms | 5976 KB | Output is correct |
27 | Correct | 14 ms | 5888 KB | Output is correct |
28 | Correct | 41 ms | 5888 KB | Output is correct |
29 | Correct | 14 ms | 5888 KB | Output is correct |
30 | Correct | 438 ms | 6016 KB | Output is correct |
31 | Correct | 41 ms | 6016 KB | Output is correct |
32 | Correct | 478 ms | 6016 KB | Output is correct |
33 | Correct | 39 ms | 6016 KB | Output is correct |
34 | Correct | 36 ms | 6060 KB | Output is correct |
35 | Correct | 20 ms | 5504 KB | Output is correct |
36 | Correct | 21 ms | 5504 KB | Output is correct |
37 | Correct | 21 ms | 5504 KB | Output is correct |
38 | Correct | 11 ms | 5248 KB | Output is correct |
39 | Correct | 11 ms | 5504 KB | Output is correct |
40 | Correct | 312 ms | 6520 KB | Output is correct |
41 | Correct | 11 ms | 5376 KB | Output is correct |
42 | Correct | 310 ms | 6520 KB | Output is correct |
43 | Correct | 298 ms | 6400 KB | Output is correct |
44 | Correct | 4 ms | 4992 KB | Output is correct |
45 | Execution timed out | 3102 ms | 23668 KB | Time limit exceeded |
46 | Halted | 0 ms | 0 KB | - |