# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
186954 | 2020-01-12T11:48:03 Z | nicolaalexandra | Political Development (BOI17_politicaldevelopment) | C++14 | 443 ms | 29080 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 get_max_clique (int nod){ el = 0; v[++el] = nod; for (auto vecin:L[nod]) v[++el] = vecin; // cout<<el<<endl; 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=0;i<=val;i++){ int ok = 0; for (int bit=0;bit<el;bit++){ if (!(i&(1<<bit))) /// nu face parte din masca continue; if ((mask[bit+1]&i) != i){ /// nu se potrivesc ok = 1; break; } } if (!ok) sol = max (sol,__builtin_popcount(i)); } } 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2756 KB | Output is correct |
2 | Correct | 3 ms | 2560 KB | Output is correct |
3 | Correct | 9 ms | 3320 KB | Output is correct |
4 | Correct | 9 ms | 3320 KB | Output is correct |
5 | Correct | 10 ms | 3248 KB | Output is correct |
6 | Correct | 10 ms | 3320 KB | Output is correct |
7 | Correct | 8 ms | 3320 KB | Output is correct |
8 | Correct | 10 ms | 2808 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2756 KB | Output is correct |
2 | Correct | 3 ms | 2560 KB | Output is correct |
3 | Correct | 9 ms | 3320 KB | Output is correct |
4 | Correct | 9 ms | 3320 KB | Output is correct |
5 | Correct | 10 ms | 3248 KB | Output is correct |
6 | Correct | 10 ms | 3320 KB | Output is correct |
7 | Correct | 8 ms | 3320 KB | Output is correct |
8 | Correct | 10 ms | 2808 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 9 ms | 3320 KB | Output is correct |
12 | Correct | 10 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 12 ms | 3320 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3212 KB | Output is correct |
19 | Correct | 5 ms | 2780 KB | Output is correct |
20 | Correct | 8 ms | 3064 KB | Output is correct |
21 | Correct | 8 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 6 ms | 3420 KB | Output is correct |
24 | Correct | 5 ms | 2812 KB | Output is correct |
25 | Correct | 13 ms | 3492 KB | Output is correct |
26 | Correct | 10 ms | 3328 KB | Output is correct |
27 | Correct | 9 ms | 3244 KB | Output is correct |
28 | Correct | 10 ms | 3320 KB | Output is correct |
29 | Correct | 9 ms | 3320 KB | Output is correct |
30 | Correct | 13 ms | 3448 KB | Output is correct |
31 | Correct | 12 ms | 3428 KB | Output is correct |
32 | Correct | 12 ms | 3576 KB | Output is correct |
33 | Correct | 7 ms | 3500 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 8 ms | 3036 KB | Output is correct |
36 | Correct | 8 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 8 ms | 3016 KB | Output is correct |
39 | Correct | 7 ms | 2928 KB | Output is correct |
40 | Correct | 16 ms | 3960 KB | Output is correct |
41 | Correct | 7 ms | 2936 KB | Output is correct |
42 | Correct | 16 ms | 3960 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2856 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 17 ms | 2680 KB | Output is correct |
6 | Correct | 16 ms | 2780 KB | Output is correct |
7 | Correct | 4 ms | 2684 KB | Output is correct |
8 | Correct | 3 ms | 2724 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2716 KB | Output is correct |
11 | Correct | 413 ms | 28920 KB | Output is correct |
12 | Correct | 8 ms | 2680 KB | Output is correct |
13 | Correct | 407 ms | 28916 KB | Output is correct |
14 | Correct | 4 ms | 2808 KB | Output is correct |
15 | Correct | 406 ms | 28940 KB | Output is correct |
16 | Correct | 377 ms | 29080 KB | Output is correct |
17 | Correct | 392 ms | 28832 KB | Output is correct |
18 | Correct | 443 ms | 28940 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2756 KB | Output is correct |
2 | Correct | 3 ms | 2560 KB | Output is correct |
3 | Correct | 9 ms | 3320 KB | Output is correct |
4 | Correct | 9 ms | 3320 KB | Output is correct |
5 | Correct | 10 ms | 3248 KB | Output is correct |
6 | Correct | 10 ms | 3320 KB | Output is correct |
7 | Correct | 8 ms | 3320 KB | Output is correct |
8 | Correct | 10 ms | 2808 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 9 ms | 3320 KB | Output is correct |
12 | Correct | 10 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 12 ms | 3320 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3212 KB | Output is correct |
19 | Correct | 5 ms | 2780 KB | Output is correct |
20 | Correct | 8 ms | 3064 KB | Output is correct |
21 | Correct | 8 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 6 ms | 3420 KB | Output is correct |
24 | Correct | 5 ms | 2812 KB | Output is correct |
25 | Correct | 13 ms | 3492 KB | Output is correct |
26 | Correct | 10 ms | 3328 KB | Output is correct |
27 | Correct | 9 ms | 3244 KB | Output is correct |
28 | Correct | 10 ms | 3320 KB | Output is correct |
29 | Correct | 9 ms | 3320 KB | Output is correct |
30 | Correct | 13 ms | 3448 KB | Output is correct |
31 | Correct | 12 ms | 3428 KB | Output is correct |
32 | Correct | 12 ms | 3576 KB | Output is correct |
33 | Correct | 7 ms | 3500 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 8 ms | 3036 KB | Output is correct |
36 | Correct | 8 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 8 ms | 3016 KB | Output is correct |
39 | Correct | 7 ms | 2928 KB | Output is correct |
40 | Correct | 16 ms | 3960 KB | Output is correct |
41 | Correct | 7 ms | 2936 KB | Output is correct |
42 | Correct | 16 ms | 3960 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
44 | Correct | 54 ms | 4852 KB | Output is correct |
45 | Correct | 4 ms | 2724 KB | Output is correct |
46 | Correct | 16 ms | 3832 KB | Output is correct |
47 | Correct | 31 ms | 5112 KB | Output is correct |
48 | Correct | 14 ms | 3892 KB | Output is correct |
49 | Correct | 33 ms | 5112 KB | Output is correct |
50 | Correct | 31 ms | 5084 KB | Output is correct |
51 | Correct | 81 ms | 7472 KB | Output is correct |
52 | Correct | 9 ms | 3320 KB | Output is correct |
53 | Correct | 93 ms | 7952 KB | Output is correct |
54 | Correct | 107 ms | 7928 KB | Output is correct |
55 | Correct | 7 ms | 3240 KB | Output is correct |
56 | Correct | 10 ms | 3240 KB | Output is correct |
57 | Correct | 5 ms | 2816 KB | Output is correct |
58 | Correct | 92 ms | 7812 KB | Output is correct |
59 | Correct | 14 ms | 3832 KB | Output is correct |
60 | Correct | 9 ms | 3320 KB | Output is correct |
61 | Correct | 19 ms | 3832 KB | Output is correct |
62 | Correct | 14 ms | 3832 KB | Output is correct |
63 | Correct | 54 ms | 4856 KB | Output is correct |
64 | Correct | 31 ms | 4600 KB | Output is correct |
65 | Correct | 15 ms | 3804 KB | Output is correct |
66 | Correct | 14 ms | 3752 KB | Output is correct |
67 | Correct | 47 ms | 5576 KB | Output is correct |
68 | Correct | 32 ms | 4600 KB | Output is correct |
69 | Correct | 14 ms | 3740 KB | Output is correct |
70 | Correct | 27 ms | 4732 KB | Output is correct |
71 | Correct | 45 ms | 5496 KB | Output is correct |
72 | Correct | 39 ms | 5436 KB | Output is correct |
73 | Correct | 9 ms | 3320 KB | Output is correct |
74 | Correct | 27 ms | 4828 KB | Output is correct |
75 | Correct | 40 ms | 5496 KB | Output is correct |
76 | Correct | 22 ms | 4316 KB | Output is correct |
77 | Correct | 51 ms | 6008 KB | Output is correct |
78 | Correct | 9 ms | 3320 KB | Output is correct |
79 | Correct | 28 ms | 4396 KB | Output is correct |
80 | Correct | 21 ms | 4328 KB | Output is correct |
81 | Correct | 51 ms | 6072 KB | Output is correct |
82 | Correct | 7 ms | 2936 KB | Output is correct |
83 | Correct | 26 ms | 4444 KB | Output is correct |
84 | Correct | 37 ms | 5368 KB | Output is correct |
85 | Correct | 7 ms | 2936 KB | Output is correct |
86 | Correct | 36 ms | 5368 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2756 KB | Output is correct |
2 | Correct | 3 ms | 2560 KB | Output is correct |
3 | Correct | 9 ms | 3320 KB | Output is correct |
4 | Correct | 9 ms | 3320 KB | Output is correct |
5 | Correct | 10 ms | 3248 KB | Output is correct |
6 | Correct | 10 ms | 3320 KB | Output is correct |
7 | Correct | 8 ms | 3320 KB | Output is correct |
8 | Correct | 10 ms | 2808 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 5 ms | 2808 KB | Output is correct |
11 | Correct | 9 ms | 3320 KB | Output is correct |
12 | Correct | 10 ms | 3320 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 12 ms | 3320 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 10 ms | 3320 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3212 KB | Output is correct |
19 | Correct | 5 ms | 2780 KB | Output is correct |
20 | Correct | 8 ms | 3064 KB | Output is correct |
21 | Correct | 8 ms | 3064 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 6 ms | 3420 KB | Output is correct |
24 | Correct | 5 ms | 2812 KB | Output is correct |
25 | Correct | 13 ms | 3492 KB | Output is correct |
26 | Correct | 10 ms | 3328 KB | Output is correct |
27 | Correct | 9 ms | 3244 KB | Output is correct |
28 | Correct | 10 ms | 3320 KB | Output is correct |
29 | Correct | 9 ms | 3320 KB | Output is correct |
30 | Correct | 13 ms | 3448 KB | Output is correct |
31 | Correct | 12 ms | 3428 KB | Output is correct |
32 | Correct | 12 ms | 3576 KB | Output is correct |
33 | Correct | 7 ms | 3500 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 8 ms | 3036 KB | Output is correct |
36 | Correct | 8 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 8 ms | 3016 KB | Output is correct |
39 | Correct | 7 ms | 2928 KB | Output is correct |
40 | Correct | 16 ms | 3960 KB | Output is correct |
41 | Correct | 7 ms | 2936 KB | Output is correct |
42 | Correct | 16 ms | 3960 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
44 | Correct | 4 ms | 2652 KB | Output is correct |
45 | Correct | 236 ms | 21092 KB | Output is correct |
46 | Correct | 120 ms | 11660 KB | Output is correct |
47 | Correct | 240 ms | 21052 KB | Output is correct |
48 | Correct | 239 ms | 21164 KB | Output is correct |
49 | Correct | 77 ms | 8852 KB | Output is correct |
50 | Correct | 306 ms | 26220 KB | Output is correct |
51 | Correct | 247 ms | 21088 KB | Output is correct |
52 | Correct | 70 ms | 8816 KB | Output is correct |
53 | Correct | 93 ms | 8892 KB | Output is correct |
54 | Correct | 22 ms | 3696 KB | Output is correct |
55 | Correct | 325 ms | 26204 KB | Output is correct |
56 | Correct | 47 ms | 6228 KB | Output is correct |
57 | Correct | 72 ms | 8912 KB | Output is correct |
58 | Correct | 92 ms | 11500 KB | Output is correct |
59 | Correct | 41 ms | 6256 KB | Output is correct |
60 | Correct | 41 ms | 6256 KB | Output is correct |
61 | Correct | 93 ms | 11544 KB | Output is correct |
62 | Correct | 72 ms | 8712 KB | Output is correct |
63 | Correct | 132 ms | 13444 KB | Output is correct |
64 | Correct | 41 ms | 6256 KB | Output is correct |
65 | Correct | 171 ms | 16244 KB | Output is correct |
66 | Correct | 65 ms | 8816 KB | Output is correct |
67 | Correct | 132 ms | 13396 KB | Output is correct |
68 | Correct | 160 ms | 15356 KB | Output is correct |
69 | Correct | 136 ms | 16024 KB | Output is correct |
70 | Correct | 73 ms | 8816 KB | Output is correct |
71 | Correct | 163 ms | 15472 KB | Output is correct |
72 | Correct | 152 ms | 13000 KB | Output is correct |
73 | Correct | 191 ms | 17776 KB | Output is correct |
74 | Correct | 70 ms | 8816 KB | Output is correct |
75 | Correct | 70 ms | 8564 KB | Output is correct |
76 | Correct | 146 ms | 12964 KB | Output is correct |
77 | Correct | 189 ms | 17796 KB | Output is correct |
78 | Correct | 94 ms | 10252 KB | Output is correct |
79 | Correct | 70 ms | 8536 KB | Output is correct |
80 | Correct | 34 ms | 5652 KB | Output is correct |
81 | Correct | 90 ms | 10264 KB | Output is correct |
82 | Correct | 138 ms | 14828 KB | Output is correct |
83 | Correct | 36 ms | 5596 KB | Output is correct |
84 | Correct | 140 ms | 14704 KB | Output is correct |