# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103329 | 2024-10-20T16:59:44 Z | alexdd | Political Development (BOI17_politicaldevelopment) | C++17 | 28 ms | 9976 KB |
#include <bits/stdc++.h> using namespace std; int n,k,mxm; set<int> con[50005]; set<pair<int,int>> s; int b[20]; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>k; mxm=1; for(int i=1;i<=n;i++) { int nr,x; cin>>nr; for(int j=0;j<nr;j++) { cin>>x; x++; con[j].insert(x); } s.insert({nr,i}); } for(int pas=1;pas<=n;pas++) { auto it = s.begin(); int nod = (*it).second; s.erase(it); vector<int> v; for(auto j:con[nod]) v.push_back(j); for(int config=1;config<(1<<((int)v.size()));config++) { int cnt=0; for(int j=0;j<v.size();j++) { if((1<<j)&config) { b[cnt++]=j; } } if(cnt+1>mxm) { bool bun=1; for(int i=0;i<cnt;i++) { for(int j=i+1;j<cnt;j++) { if(con[i].find(j)==con[i].end()) { bun=0; break; } } if(!bun) break; } if(bun) { mxm = cnt+1; if(mxm==k) { cout<<k; return 0; } } } } for(auto j:con[nod]) { s.erase({con[j].size(),j}); con[j].erase(nod); s.insert({con[j].size(),j}); } } cout<<mxm; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Runtime error | 7 ms | 6484 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Runtime error | 7 ms | 6484 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2912 KB | Output is correct |
2 | Runtime error | 28 ms | 9976 KB | Execution killed with signal 7 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Runtime error | 7 ms | 6484 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Runtime error | 7 ms | 6484 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |