# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203623 | 2020-02-21T16:17:23 Z | karma | Political Development (BOI17_politicaldevelopment) | C++14 | 6 ms | 1656 KB |
#include<bits/stdc++.h> #define ll long long #define pb emplace_back #define fi first #define se second #define mp make_pair //#define int int64_t using namespace std; typedef pair<int, int> pii; const int N = (int)5e4 + 2; priority_queue<pii, vector<pii>, greater<pii>> pq; int n, k, d, u, cnt, res, ans; int deg[N], f[N], lab[N], id[N]; bool del[N], ok; vector<int> adj[N]; map<pii, bool> edges; pii top; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FileName "test" if(fopen(FileName".inp", "r")) { freopen(FileName".inp", "r", stdin); freopen(FileName".out", "w", stdout); } cin >> n >> k; for(int i = 1; i <= n; ++i) { cin >> d; adj[i].resize(d); for(int& c: adj[i]) cin >> c, edges[{c, i}] = 1; deg[i] = d; pq.push(mp(deg[i], i)); } res = 1; while(pq.size()) { top = pq.top(); pq.pop(); if(top.fi != deg[top.se]) continue; u = top.se; cnt = 0; for(int v: adj[u]) { if(del[v]) continue; id[lab[v] = cnt ++] = v; } for(int i = 0; i < (1 << cnt); ++i) { if((ans = __builtin_popcount(i)) < res) continue; ok = 1; for(int j = 0; j < cnt; ++j) { if(!(i >> j & 1)) continue; for(int k = j + 1; k < cnt; ++k) { if((i >> k & 1) && !edges[{id[j], id[k]}]) ok = 0; } if(!ok) break; } if(ok) res = ans + 1; } } cout << res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1656 KB | Output is correct |
2 | Incorrect | 5 ms | 1528 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |