# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
185475 | 2020-01-11T21:45:08 Z | nicolaalexandra | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 25712 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]; int verif (int pas, int nod){ for (int i=1;i<pas;++i){ int vecin = x[i]; if (L[nod].find(vecin) == L[nod].end()) return 0; if (L[vecin].find(nod) == L[vecin].end()) return 0; } return 1; } 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; for (auto vecin:L[nod]) v[++el] = vecin; sort (v+1,v+el+1); back (1); } 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+1); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 9 ms | 3192 KB | Output is correct |
4 | Correct | 31 ms | 3324 KB | Output is correct |
5 | Correct | 10 ms | 3320 KB | Output is correct |
6 | Correct | 9 ms | 3192 KB | Output is correct |
7 | Correct | 9 ms | 3192 KB | Output is correct |
8 | Correct | 5 ms | 2808 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 8 ms | 2816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 9 ms | 3192 KB | Output is correct |
4 | Correct | 31 ms | 3324 KB | Output is correct |
5 | Correct | 10 ms | 3320 KB | Output is correct |
6 | Correct | 9 ms | 3192 KB | Output is correct |
7 | Correct | 9 ms | 3192 KB | Output is correct |
8 | Correct | 5 ms | 2808 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 8 ms | 2816 KB | Output is correct |
11 | Correct | 7 ms | 3320 KB | Output is correct |
12 | Correct | 88 ms | 3388 KB | Output is correct |
13 | Correct | 5 ms | 2680 KB | Output is correct |
14 | Correct | 88 ms | 3192 KB | Output is correct |
15 | Correct | 4 ms | 2712 KB | Output is correct |
16 | Correct | 10 ms | 3192 KB | Output is correct |
17 | Correct | 4 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3236 KB | Output is correct |
19 | Correct | 5 ms | 2808 KB | Output is correct |
20 | Correct | 7 ms | 3008 KB | Output is correct |
21 | Correct | 5 ms | 2936 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2936 KB | Output is correct |
25 | Correct | 11 ms | 3448 KB | Output is correct |
26 | Correct | 10 ms | 3320 KB | Output is correct |
27 | Correct | 9 ms | 3320 KB | Output is correct |
28 | Correct | 11 ms | 3316 KB | Output is correct |
29 | Correct | 21 ms | 3320 KB | Output is correct |
30 | Correct | 29 ms | 3576 KB | Output is correct |
31 | Correct | 10 ms | 3448 KB | Output is correct |
32 | Correct | 30 ms | 3320 KB | Output is correct |
33 | Correct | 12 ms | 3448 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 7 ms | 3064 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 6 ms | 2936 KB | Output is correct |
39 | Correct | 6 ms | 2936 KB | Output is correct |
40 | Correct | 14 ms | 3704 KB | Output is correct |
41 | Correct | 6 ms | 2936 KB | Output is correct |
42 | Correct | 14 ms | 3832 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2808 KB | Output is correct |
2 | Correct | 5 ms | 2684 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 5 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 4 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2680 KB | Output is correct |
11 | Correct | 321 ms | 25584 KB | Output is correct |
12 | Correct | 5 ms | 2680 KB | Output is correct |
13 | Correct | 344 ms | 25456 KB | Output is correct |
14 | Correct | 1 ms | 2680 KB | Output is correct |
15 | Correct | 377 ms | 25712 KB | Output is correct |
16 | Correct | 289 ms | 25592 KB | Output is correct |
17 | Correct | 334 ms | 25456 KB | Output is correct |
18 | Correct | 287 ms | 25456 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 9 ms | 3192 KB | Output is correct |
4 | Correct | 31 ms | 3324 KB | Output is correct |
5 | Correct | 10 ms | 3320 KB | Output is correct |
6 | Correct | 9 ms | 3192 KB | Output is correct |
7 | Correct | 9 ms | 3192 KB | Output is correct |
8 | Correct | 5 ms | 2808 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 8 ms | 2816 KB | Output is correct |
11 | Correct | 7 ms | 3320 KB | Output is correct |
12 | Correct | 88 ms | 3388 KB | Output is correct |
13 | Correct | 5 ms | 2680 KB | Output is correct |
14 | Correct | 88 ms | 3192 KB | Output is correct |
15 | Correct | 4 ms | 2712 KB | Output is correct |
16 | Correct | 10 ms | 3192 KB | Output is correct |
17 | Correct | 4 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3236 KB | Output is correct |
19 | Correct | 5 ms | 2808 KB | Output is correct |
20 | Correct | 7 ms | 3008 KB | Output is correct |
21 | Correct | 5 ms | 2936 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2936 KB | Output is correct |
25 | Correct | 11 ms | 3448 KB | Output is correct |
26 | Correct | 10 ms | 3320 KB | Output is correct |
27 | Correct | 9 ms | 3320 KB | Output is correct |
28 | Correct | 11 ms | 3316 KB | Output is correct |
29 | Correct | 21 ms | 3320 KB | Output is correct |
30 | Correct | 29 ms | 3576 KB | Output is correct |
31 | Correct | 10 ms | 3448 KB | Output is correct |
32 | Correct | 30 ms | 3320 KB | Output is correct |
33 | Correct | 12 ms | 3448 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 7 ms | 3064 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 6 ms | 2936 KB | Output is correct |
39 | Correct | 6 ms | 2936 KB | Output is correct |
40 | Correct | 14 ms | 3704 KB | Output is correct |
41 | Correct | 6 ms | 2936 KB | Output is correct |
42 | Correct | 14 ms | 3832 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
44 | Correct | 64 ms | 4768 KB | Output is correct |
45 | Correct | 5 ms | 2680 KB | Output is correct |
46 | Correct | 14 ms | 3832 KB | Output is correct |
47 | Correct | 27 ms | 4732 KB | Output is correct |
48 | Correct | 14 ms | 3832 KB | Output is correct |
49 | Correct | 26 ms | 4856 KB | Output is correct |
50 | Correct | 26 ms | 4728 KB | Output is correct |
51 | Correct | 69 ms | 7004 KB | Output is correct |
52 | Correct | 9 ms | 3320 KB | Output is correct |
53 | Correct | 767 ms | 7644 KB | Output is correct |
54 | Correct | 72 ms | 7416 KB | Output is correct |
55 | Correct | 10 ms | 3192 KB | Output is correct |
56 | Correct | 9 ms | 3320 KB | Output is correct |
57 | Correct | 5 ms | 2808 KB | Output is correct |
58 | Correct | 763 ms | 7568 KB | Output is correct |
59 | Correct | 11 ms | 3832 KB | Output is correct |
60 | Correct | 10 ms | 3320 KB | Output is correct |
61 | Correct | 12 ms | 3832 KB | Output is correct |
62 | Correct | 11 ms | 3832 KB | Output is correct |
63 | Correct | 54 ms | 4856 KB | Output is correct |
64 | Correct | 36 ms | 4600 KB | Output is correct |
65 | Correct | 13 ms | 3704 KB | Output is correct |
66 | Correct | 14 ms | 3832 KB | Output is correct |
67 | Correct | 44 ms | 5256 KB | Output is correct |
68 | Correct | 35 ms | 4600 KB | Output is correct |
69 | Correct | 13 ms | 3704 KB | Output is correct |
70 | Correct | 24 ms | 4604 KB | Output is correct |
71 | Correct | 48 ms | 5240 KB | Output is correct |
72 | Correct | 42 ms | 5112 KB | Output is correct |
73 | Correct | 10 ms | 3320 KB | Output is correct |
74 | Correct | 28 ms | 4728 KB | Output is correct |
75 | Correct | 42 ms | 5112 KB | Output is correct |
76 | Correct | 38 ms | 4216 KB | Output is correct |
77 | Correct | 36 ms | 5792 KB | Output is correct |
78 | Correct | 7 ms | 3320 KB | Output is correct |
79 | Correct | 19 ms | 4216 KB | Output is correct |
80 | Correct | 34 ms | 4088 KB | Output is correct |
81 | Correct | 35 ms | 5752 KB | Output is correct |
82 | Correct | 7 ms | 2936 KB | Output is correct |
83 | Correct | 19 ms | 4216 KB | Output is correct |
84 | Correct | 28 ms | 5184 KB | Output is correct |
85 | Correct | 6 ms | 3016 KB | Output is correct |
86 | Correct | 26 ms | 5240 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 9 ms | 3192 KB | Output is correct |
4 | Correct | 31 ms | 3324 KB | Output is correct |
5 | Correct | 10 ms | 3320 KB | Output is correct |
6 | Correct | 9 ms | 3192 KB | Output is correct |
7 | Correct | 9 ms | 3192 KB | Output is correct |
8 | Correct | 5 ms | 2808 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 8 ms | 2816 KB | Output is correct |
11 | Correct | 7 ms | 3320 KB | Output is correct |
12 | Correct | 88 ms | 3388 KB | Output is correct |
13 | Correct | 5 ms | 2680 KB | Output is correct |
14 | Correct | 88 ms | 3192 KB | Output is correct |
15 | Correct | 4 ms | 2712 KB | Output is correct |
16 | Correct | 10 ms | 3192 KB | Output is correct |
17 | Correct | 4 ms | 2680 KB | Output is correct |
18 | Correct | 10 ms | 3236 KB | Output is correct |
19 | Correct | 5 ms | 2808 KB | Output is correct |
20 | Correct | 7 ms | 3008 KB | Output is correct |
21 | Correct | 5 ms | 2936 KB | Output is correct |
22 | Correct | 5 ms | 2808 KB | Output is correct |
23 | Correct | 10 ms | 3448 KB | Output is correct |
24 | Correct | 5 ms | 2936 KB | Output is correct |
25 | Correct | 11 ms | 3448 KB | Output is correct |
26 | Correct | 10 ms | 3320 KB | Output is correct |
27 | Correct | 9 ms | 3320 KB | Output is correct |
28 | Correct | 11 ms | 3316 KB | Output is correct |
29 | Correct | 21 ms | 3320 KB | Output is correct |
30 | Correct | 29 ms | 3576 KB | Output is correct |
31 | Correct | 10 ms | 3448 KB | Output is correct |
32 | Correct | 30 ms | 3320 KB | Output is correct |
33 | Correct | 12 ms | 3448 KB | Output is correct |
34 | Correct | 11 ms | 3448 KB | Output is correct |
35 | Correct | 7 ms | 3064 KB | Output is correct |
36 | Correct | 7 ms | 3064 KB | Output is correct |
37 | Correct | 7 ms | 3064 KB | Output is correct |
38 | Correct | 6 ms | 2936 KB | Output is correct |
39 | Correct | 6 ms | 2936 KB | Output is correct |
40 | Correct | 14 ms | 3704 KB | Output is correct |
41 | Correct | 6 ms | 2936 KB | Output is correct |
42 | Correct | 14 ms | 3832 KB | Output is correct |
43 | Correct | 15 ms | 3832 KB | Output is correct |
44 | Correct | 4 ms | 2680 KB | Output is correct |
45 | Correct | 254 ms | 18232 KB | Output is correct |
46 | Correct | 2090 ms | 11436 KB | Output is correct |
47 | Correct | 207 ms | 18160 KB | Output is correct |
48 | Correct | 208 ms | 18032 KB | Output is correct |
49 | Correct | 84 ms | 9112 KB | Output is correct |
50 | Execution timed out | 3067 ms | 23332 KB | Time limit exceeded |
51 | Halted | 0 ms | 0 KB | - |