# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
246584 | 2020-07-09T16:05:16 Z | m3r8 | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 313592 KB |
#include <stdio.h> #include <vector> #include <algorithm> #include <set> #include <bitset> #include <utility> #include <queue> #define N 50100 #define ii std::pair<int,int> std::vector<int> adj[N]; int k; std::vector<std::bitset<N>> add(N); std::queue<int> que; std::vector<int> akt; int used[N]; int clq(int idx){ int erg = 0; for(int i = 0;i<(1<<akt.size());i++){ std::bitset<N> tmp = add[idx]; int cnt = 1; for(int j = 0;j<akt.size();j++){ if(i & (1<<j)){ cnt++; tmp &= add[akt[j]]; }; }; int pos = 1; for(int j = 0;j<akt.size();j++){ if(i & (1<<j) && !tmp[akt[j]]){ pos = 0; break; }; }; if(pos){ erg = std::max(erg,cnt); }; }; return erg; }; int main(void){ int n; scanf("%d %d",&n,&k); int d; int x; int mx = 0; for(int i = 0;i<n;i++){ mx = 1; add[i][i] = 1; scanf("%d",&d); for(int j = 0;j<d;j++){ mx = 2; scanf("%d",&x); add[i][x] = 1; adj[i].push_back(x); }; }; for(int i = 0;i<n;i++){ if(adj[i].size() < k){ //printf("%d %d\n",i,adj[i].size()); used[i] = 1; que.push(i); }; }; while(que.size()){ int ak = que.front();que.pop(); // printf("%d\n",ak); akt.clear(); used[ak] = 2; for(auto i: adj[ak]){ if(used[i] != 2){ akt.push_back(i); }; }; mx = std::max(mx,clq(ak)); for(auto i: adj[ak]){ if(!used[i]){ add[i][ak] = 0; if(add[i].count() < k){ used[i] = 1; que.push(i); }; }; }; }; printf("%d\n",mx); return 0; };
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 152 ms | 308600 KB | Output is correct |
2 | Correct | 151 ms | 308600 KB | Output is correct |
3 | Correct | 168 ms | 308856 KB | Output is correct |
4 | Correct | 173 ms | 309036 KB | Output is correct |
5 | Correct | 169 ms | 308856 KB | Output is correct |
6 | Correct | 173 ms | 308856 KB | Output is correct |
7 | Correct | 176 ms | 308856 KB | Output is correct |
8 | Correct | 174 ms | 308600 KB | Output is correct |
9 | Correct | 151 ms | 308600 KB | Output is correct |
10 | Correct | 225 ms | 308600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 152 ms | 308600 KB | Output is correct |
2 | Correct | 151 ms | 308600 KB | Output is correct |
3 | Correct | 168 ms | 308856 KB | Output is correct |
4 | Correct | 173 ms | 309036 KB | Output is correct |
5 | Correct | 169 ms | 308856 KB | Output is correct |
6 | Correct | 173 ms | 308856 KB | Output is correct |
7 | Correct | 176 ms | 308856 KB | Output is correct |
8 | Correct | 174 ms | 308600 KB | Output is correct |
9 | Correct | 151 ms | 308600 KB | Output is correct |
10 | Correct | 225 ms | 308600 KB | Output is correct |
11 | Correct | 175 ms | 308856 KB | Output is correct |
12 | Correct | 181 ms | 308856 KB | Output is correct |
13 | Correct | 154 ms | 308604 KB | Output is correct |
14 | Correct | 173 ms | 308860 KB | Output is correct |
15 | Correct | 152 ms | 308728 KB | Output is correct |
16 | Correct | 172 ms | 308860 KB | Output is correct |
17 | Correct | 151 ms | 308552 KB | Output is correct |
18 | Correct | 173 ms | 308856 KB | Output is correct |
19 | Correct | 155 ms | 308600 KB | Output is correct |
20 | Correct | 162 ms | 308856 KB | Output is correct |
21 | Correct | 161 ms | 308728 KB | Output is correct |
22 | Correct | 162 ms | 308600 KB | Output is correct |
23 | Incorrect | 178 ms | 308856 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 153 ms | 308604 KB | Output is correct |
2 | Correct | 152 ms | 308560 KB | Output is correct |
3 | Correct | 155 ms | 308600 KB | Output is correct |
4 | Correct | 156 ms | 308600 KB | Output is correct |
5 | Correct | 152 ms | 308612 KB | Output is correct |
6 | Correct | 155 ms | 308600 KB | Output is correct |
7 | Correct | 154 ms | 308604 KB | Output is correct |
8 | Correct | 156 ms | 308600 KB | Output is correct |
9 | Correct | 150 ms | 308600 KB | Output is correct |
10 | Correct | 155 ms | 308600 KB | Output is correct |
11 | Execution timed out | 3108 ms | 313592 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 152 ms | 308600 KB | Output is correct |
2 | Correct | 151 ms | 308600 KB | Output is correct |
3 | Correct | 168 ms | 308856 KB | Output is correct |
4 | Correct | 173 ms | 309036 KB | Output is correct |
5 | Correct | 169 ms | 308856 KB | Output is correct |
6 | Correct | 173 ms | 308856 KB | Output is correct |
7 | Correct | 176 ms | 308856 KB | Output is correct |
8 | Correct | 174 ms | 308600 KB | Output is correct |
9 | Correct | 151 ms | 308600 KB | Output is correct |
10 | Correct | 225 ms | 308600 KB | Output is correct |
11 | Correct | 175 ms | 308856 KB | Output is correct |
12 | Correct | 181 ms | 308856 KB | Output is correct |
13 | Correct | 154 ms | 308604 KB | Output is correct |
14 | Correct | 173 ms | 308860 KB | Output is correct |
15 | Correct | 152 ms | 308728 KB | Output is correct |
16 | Correct | 172 ms | 308860 KB | Output is correct |
17 | Correct | 151 ms | 308552 KB | Output is correct |
18 | Correct | 173 ms | 308856 KB | Output is correct |
19 | Correct | 155 ms | 308600 KB | Output is correct |
20 | Correct | 162 ms | 308856 KB | Output is correct |
21 | Correct | 161 ms | 308728 KB | Output is correct |
22 | Correct | 162 ms | 308600 KB | Output is correct |
23 | Incorrect | 178 ms | 308856 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 152 ms | 308600 KB | Output is correct |
2 | Correct | 151 ms | 308600 KB | Output is correct |
3 | Correct | 168 ms | 308856 KB | Output is correct |
4 | Correct | 173 ms | 309036 KB | Output is correct |
5 | Correct | 169 ms | 308856 KB | Output is correct |
6 | Correct | 173 ms | 308856 KB | Output is correct |
7 | Correct | 176 ms | 308856 KB | Output is correct |
8 | Correct | 174 ms | 308600 KB | Output is correct |
9 | Correct | 151 ms | 308600 KB | Output is correct |
10 | Correct | 225 ms | 308600 KB | Output is correct |
11 | Correct | 175 ms | 308856 KB | Output is correct |
12 | Correct | 181 ms | 308856 KB | Output is correct |
13 | Correct | 154 ms | 308604 KB | Output is correct |
14 | Correct | 173 ms | 308860 KB | Output is correct |
15 | Correct | 152 ms | 308728 KB | Output is correct |
16 | Correct | 172 ms | 308860 KB | Output is correct |
17 | Correct | 151 ms | 308552 KB | Output is correct |
18 | Correct | 173 ms | 308856 KB | Output is correct |
19 | Correct | 155 ms | 308600 KB | Output is correct |
20 | Correct | 162 ms | 308856 KB | Output is correct |
21 | Correct | 161 ms | 308728 KB | Output is correct |
22 | Correct | 162 ms | 308600 KB | Output is correct |
23 | Incorrect | 178 ms | 308856 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |