# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1103335 | 2024-10-20T17:01:19 Z | alexdd | Political Development (BOI17_politicaldevelopment) | C++17 | 6 ms | 3424 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[i].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); assert((int)v.size() < k); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2640 KB | Output is correct |
2 | Correct | 1 ms | 2640 KB | Output is correct |
3 | Correct | 3 ms | 3408 KB | Output is correct |
4 | Correct | 4 ms | 3412 KB | Output is correct |
5 | Correct | 4 ms | 3424 KB | Output is correct |
6 | Correct | 4 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2900 KB | Output is correct |
9 | Correct | 2 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2820 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2640 KB | Output is correct |
2 | Correct | 1 ms | 2640 KB | Output is correct |
3 | Correct | 3 ms | 3408 KB | Output is correct |
4 | Correct | 4 ms | 3412 KB | Output is correct |
5 | Correct | 4 ms | 3424 KB | Output is correct |
6 | Correct | 4 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2900 KB | Output is correct |
9 | Correct | 2 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2820 KB | Output is correct |
11 | Correct | 5 ms | 3412 KB | Output is correct |
12 | Correct | 6 ms | 3412 KB | Output is correct |
13 | Correct | 1 ms | 2644 KB | Output is correct |
14 | Correct | 4 ms | 3412 KB | Output is correct |
15 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2896 KB | Output is correct |
2 | Incorrect | 1 ms | 2640 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2640 KB | Output is correct |
2 | Correct | 1 ms | 2640 KB | Output is correct |
3 | Correct | 3 ms | 3408 KB | Output is correct |
4 | Correct | 4 ms | 3412 KB | Output is correct |
5 | Correct | 4 ms | 3424 KB | Output is correct |
6 | Correct | 4 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2900 KB | Output is correct |
9 | Correct | 2 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2820 KB | Output is correct |
11 | Correct | 5 ms | 3412 KB | Output is correct |
12 | Correct | 6 ms | 3412 KB | Output is correct |
13 | Correct | 1 ms | 2644 KB | Output is correct |
14 | Correct | 4 ms | 3412 KB | Output is correct |
15 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2640 KB | Output is correct |
2 | Correct | 1 ms | 2640 KB | Output is correct |
3 | Correct | 3 ms | 3408 KB | Output is correct |
4 | Correct | 4 ms | 3412 KB | Output is correct |
5 | Correct | 4 ms | 3424 KB | Output is correct |
6 | Correct | 4 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2900 KB | Output is correct |
9 | Correct | 2 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2820 KB | Output is correct |
11 | Correct | 5 ms | 3412 KB | Output is correct |
12 | Correct | 6 ms | 3412 KB | Output is correct |
13 | Correct | 1 ms | 2644 KB | Output is correct |
14 | Correct | 4 ms | 3412 KB | Output is correct |
15 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |