# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
186841 | 2020-01-12T11:10:48 Z | nicolaalexandra | Political Development (BOI17_politicaldevelopment) | C++14 | 80 ms | 3576 KB |
#include <bits/stdc++.h> #define DIM 50010 using namespace std; priority_queue <pair<int,int>, vector <pair<int,int> >, greater<pair<int,int> > > H; set <int> L[DIM]; int n,k,i,j,sol,el,nod; int v[DIM],x[DIM],viz[DIM],f[DIM],g[DIM],mask[DIM]; int verif (int x, int y){ if (L[x].find(y) != L[x].end()) return 1; return 0; } void back (int pas){ sol = max (sol,pas-1); if (pas >= k) return; for (int i=1;i<=el;++i){ if (!f[i] && v[i] > x[pas-1] && verif(pas,v[i])){ x[pas] = v[i]; f[i] = 1; back(pas+1); f[i] = 0; } } } void get_max_clique (int nod){ el = 0; v[++el] = nod; for (auto vecin:L[nod]) v[++el] = vecin; for (int i=1;i<=el;i++) mask[i] = 0; for (int i=1;i<=el;i++) for (int j=1;j<=el;j++){ if (i == j){ mask[i] |= (1<<(i-1)); continue; } if (verif(v[i],v[j])) mask[i] |= (1<<(j-1)); } int val = (1<<el)-1; for (int i=1;i<=el;i++) val &= mask[i]; sol = max (sol,__builtin_popcount(val)); } int main (){ FILE *fin = stdin; FILE *fout = stdout; fscanf (fin,"%d%d",&n,&k); for (i=1;i<=n;++i){ fscanf (fin,"%d",&g[i]); for (j=1;j<=g[i];++j){ fscanf (fin,"%d",&nod); L[i].insert(nod+1); } H.push (make_pair(g[i],i)); } while (!H.empty()){ int nod = H.top().second; int grad = H.top().first; H.pop(); if (grad != g[nod]) /// inseamna ca nu e ala cu gradul minim continue; /// vreau sa gasesc clica maxima din care poate face parte nod get_max_clique (nod); viz[nod] = 1; /// acum il elimin pe nod si toate muchiile for (auto vecin:L[nod]){ if (viz[vecin]) continue; /// nu am incercat sa obtin clica de aici deloc viz[vecin] = 1; --g[vecin]; L[vecin].erase(L[vecin].find(nod)); H.push(make_pair(g[vecin],vecin)); } L[nod].clear(); } fprintf(fout,"%d",sol); return 0; } /// din nou, nu sunt in stare sa citesc un enunt cum trb
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 10 ms | 3292 KB | Output is correct |
4 | Correct | 43 ms | 3320 KB | Output is correct |
5 | Correct | 43 ms | 3320 KB | Output is correct |
6 | Correct | 8 ms | 3320 KB | Output is correct |
7 | Correct | 10 ms | 3320 KB | Output is correct |
8 | Correct | 5 ms | 2856 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 10 ms | 3292 KB | Output is correct |
4 | Correct | 43 ms | 3320 KB | Output is correct |
5 | Correct | 43 ms | 3320 KB | Output is correct |
6 | Correct | 8 ms | 3320 KB | Output is correct |
7 | Correct | 10 ms | 3320 KB | Output is correct |
8 | Correct | 5 ms | 2856 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 44 ms | 3328 KB | Output is correct |
12 | Correct | 40 ms | 3368 KB | Output is correct |
13 | Correct | 4 ms | 2752 KB | Output is correct |
14 | Correct | 43 ms | 3336 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3320 KB | Output is correct |
19 | Correct | 5 ms | 2852 KB | Output is correct |
20 | Correct | 5 ms | 3036 KB | Output is correct |
21 | Correct | 7 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2780 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2808 KB | Output is correct |
25 | Correct | 10 ms | 3420 KB | Output is correct |
26 | Correct | 12 ms | 3320 KB | Output is correct |
27 | Correct | 11 ms | 3320 KB | Output is correct |
28 | Correct | 10 ms | 3292 KB | Output is correct |
29 | Correct | 10 ms | 3320 KB | Output is correct |
30 | Correct | 80 ms | 3496 KB | Output is correct |
31 | Correct | 12 ms | 3456 KB | Output is correct |
32 | Correct | 21 ms | 3448 KB | Output is correct |
33 | Correct | 12 ms | 3576 KB | Output is correct |
34 | Correct | 12 ms | 3420 KB | Output is correct |
35 | Correct | 9 ms | 3124 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Incorrect | 7 ms | 2936 KB | Output isn't correct |
39 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2808 KB | Output is correct |
2 | Incorrect | 5 ms | 2680 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 10 ms | 3292 KB | Output is correct |
4 | Correct | 43 ms | 3320 KB | Output is correct |
5 | Correct | 43 ms | 3320 KB | Output is correct |
6 | Correct | 8 ms | 3320 KB | Output is correct |
7 | Correct | 10 ms | 3320 KB | Output is correct |
8 | Correct | 5 ms | 2856 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 44 ms | 3328 KB | Output is correct |
12 | Correct | 40 ms | 3368 KB | Output is correct |
13 | Correct | 4 ms | 2752 KB | Output is correct |
14 | Correct | 43 ms | 3336 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3320 KB | Output is correct |
19 | Correct | 5 ms | 2852 KB | Output is correct |
20 | Correct | 5 ms | 3036 KB | Output is correct |
21 | Correct | 7 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2780 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2808 KB | Output is correct |
25 | Correct | 10 ms | 3420 KB | Output is correct |
26 | Correct | 12 ms | 3320 KB | Output is correct |
27 | Correct | 11 ms | 3320 KB | Output is correct |
28 | Correct | 10 ms | 3292 KB | Output is correct |
29 | Correct | 10 ms | 3320 KB | Output is correct |
30 | Correct | 80 ms | 3496 KB | Output is correct |
31 | Correct | 12 ms | 3456 KB | Output is correct |
32 | Correct | 21 ms | 3448 KB | Output is correct |
33 | Correct | 12 ms | 3576 KB | Output is correct |
34 | Correct | 12 ms | 3420 KB | Output is correct |
35 | Correct | 9 ms | 3124 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Incorrect | 7 ms | 2936 KB | Output isn't correct |
39 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 10 ms | 3292 KB | Output is correct |
4 | Correct | 43 ms | 3320 KB | Output is correct |
5 | Correct | 43 ms | 3320 KB | Output is correct |
6 | Correct | 8 ms | 3320 KB | Output is correct |
7 | Correct | 10 ms | 3320 KB | Output is correct |
8 | Correct | 5 ms | 2856 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 44 ms | 3328 KB | Output is correct |
12 | Correct | 40 ms | 3368 KB | Output is correct |
13 | Correct | 4 ms | 2752 KB | Output is correct |
14 | Correct | 43 ms | 3336 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3320 KB | Output is correct |
19 | Correct | 5 ms | 2852 KB | Output is correct |
20 | Correct | 5 ms | 3036 KB | Output is correct |
21 | Correct | 7 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2780 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2808 KB | Output is correct |
25 | Correct | 10 ms | 3420 KB | Output is correct |
26 | Correct | 12 ms | 3320 KB | Output is correct |
27 | Correct | 11 ms | 3320 KB | Output is correct |
28 | Correct | 10 ms | 3292 KB | Output is correct |
29 | Correct | 10 ms | 3320 KB | Output is correct |
30 | Correct | 80 ms | 3496 KB | Output is correct |
31 | Correct | 12 ms | 3456 KB | Output is correct |
32 | Correct | 21 ms | 3448 KB | Output is correct |
33 | Correct | 12 ms | 3576 KB | Output is correct |
34 | Correct | 12 ms | 3420 KB | Output is correct |
35 | Correct | 9 ms | 3124 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Incorrect | 7 ms | 2936 KB | Output isn't correct |
39 | Halted | 0 ms | 0 KB | - |