Submission #245065

# Submission time Handle Problem Language Result Execution time Memory
245065 2020-07-05T11:38:57 Z m3r8 Political Development (BOI17_politicaldevelopment) C++14
77 / 100
3000 ms 29048 KB
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <set>

#define N 50100


std::set<int> tst[N];
std::vector<int> adj[N];
int k;

int clq(std::vector<int> akt, int depth, int idx){
  if(!akt.size() ||depth == k)return depth;
  else{
    int mx = 0;
    for(int i = 0;i<akt.size();i++){
      std::vector<int> nxt;  
      for(int j = i+1;j<akt.size();j++){
        if(tst[akt[i]].count(akt[j])){
          nxt.push_back(akt[j]);  
        };
      };
      mx = std::max(mx,clq(nxt,depth+1,idx));
    };
    return mx;
  };
};

int main(void){
  int n;  
  scanf("%d %d",&n,&k);

  int d;
  int x;
  for(int i = 0;i<n;i++){
    scanf("%d",&d);
    for(int j = 0;j<d;j++){
      scanf("%d",&x);
      adj[i].push_back(x);
      tst[i].insert(x);
    };
  };
  int mx = 0;
  for(int i = 0;i<n;i++){
    int tmp = clq(adj[i],1,i);
    //printf("%d %d %d\n",i,tmp,adj[i].size());
    mx = std::max(tmp,mx);
    if(mx == k)break;
  };
  printf("%d\n",mx);
  return 0;
};

Compilation message

politicaldevelopment.cpp: In function 'int clq(std::vector<int>, int, int)':
politicaldevelopment.cpp:17:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i<akt.size();i++){
                   ~^~~~~~~~~~~
politicaldevelopment.cpp:19:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j = i+1;j<akt.size();j++){
                       ~^~~~~~~~~~~
politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n,&k);
   ~~~~~^~~~~~~~~~~~~~~
politicaldevelopment.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&d);
     ~~~~~^~~~~~~~~
politicaldevelopment.cpp:39:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d",&x);
       ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 8 ms 3840 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 11 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 7 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 8 ms 3840 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 11 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 7 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
11 Correct 10 ms 4480 KB Output is correct
12 Correct 95 ms 4600 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 126 ms 4480 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 12 ms 4480 KB Output is correct
17 Correct 6 ms 3840 KB Output is correct
18 Correct 12 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 9 ms 4224 KB Output is correct
21 Correct 8 ms 4224 KB Output is correct
22 Correct 7 ms 3840 KB Output is correct
23 Correct 10 ms 4608 KB Output is correct
24 Correct 7 ms 3840 KB Output is correct
25 Correct 11 ms 4608 KB Output is correct
26 Correct 11 ms 4480 KB Output is correct
27 Correct 11 ms 4480 KB Output is correct
28 Correct 11 ms 4480 KB Output is correct
29 Correct 10 ms 4480 KB Output is correct
30 Correct 39 ms 4608 KB Output is correct
31 Correct 12 ms 4608 KB Output is correct
32 Correct 40 ms 4608 KB Output is correct
33 Correct 12 ms 4608 KB Output is correct
34 Correct 12 ms 4608 KB Output is correct
35 Correct 9 ms 4224 KB Output is correct
36 Correct 12 ms 4224 KB Output is correct
37 Correct 10 ms 4224 KB Output is correct
38 Correct 9 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 13 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 21 ms 4992 KB Output is correct
43 Correct 18 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3840 KB Output is correct
2 Correct 6 ms 3840 KB Output is correct
3 Correct 7 ms 3840 KB Output is correct
4 Correct 9 ms 3840 KB Output is correct
5 Correct 7 ms 3840 KB Output is correct
6 Correct 7 ms 3840 KB Output is correct
7 Correct 6 ms 3840 KB Output is correct
8 Correct 7 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
11 Correct 340 ms 28932 KB Output is correct
12 Correct 6 ms 3840 KB Output is correct
13 Correct 343 ms 28928 KB Output is correct
14 Correct 7 ms 3892 KB Output is correct
15 Correct 328 ms 29048 KB Output is correct
16 Correct 343 ms 29048 KB Output is correct
17 Correct 327 ms 28848 KB Output is correct
18 Correct 345 ms 28924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 8 ms 3840 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 11 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 7 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
11 Correct 10 ms 4480 KB Output is correct
12 Correct 95 ms 4600 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 126 ms 4480 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 12 ms 4480 KB Output is correct
17 Correct 6 ms 3840 KB Output is correct
18 Correct 12 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 9 ms 4224 KB Output is correct
21 Correct 8 ms 4224 KB Output is correct
22 Correct 7 ms 3840 KB Output is correct
23 Correct 10 ms 4608 KB Output is correct
24 Correct 7 ms 3840 KB Output is correct
25 Correct 11 ms 4608 KB Output is correct
26 Correct 11 ms 4480 KB Output is correct
27 Correct 11 ms 4480 KB Output is correct
28 Correct 11 ms 4480 KB Output is correct
29 Correct 10 ms 4480 KB Output is correct
30 Correct 39 ms 4608 KB Output is correct
31 Correct 12 ms 4608 KB Output is correct
32 Correct 40 ms 4608 KB Output is correct
33 Correct 12 ms 4608 KB Output is correct
34 Correct 12 ms 4608 KB Output is correct
35 Correct 9 ms 4224 KB Output is correct
36 Correct 12 ms 4224 KB Output is correct
37 Correct 10 ms 4224 KB Output is correct
38 Correct 9 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 13 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 21 ms 4992 KB Output is correct
43 Correct 18 ms 4992 KB Output is correct
44 Correct 20 ms 5996 KB Output is correct
45 Correct 7 ms 3840 KB Output is correct
46 Correct 15 ms 4992 KB Output is correct
47 Correct 30 ms 6016 KB Output is correct
48 Correct 16 ms 4992 KB Output is correct
49 Correct 27 ms 6016 KB Output is correct
50 Correct 30 ms 6016 KB Output is correct
51 Correct 34 ms 8184 KB Output is correct
52 Correct 10 ms 4480 KB Output is correct
53 Correct 1957 ms 8720 KB Output is correct
54 Correct 39 ms 8568 KB Output is correct
55 Correct 13 ms 4480 KB Output is correct
56 Correct 10 ms 4480 KB Output is correct
57 Correct 7 ms 3840 KB Output is correct
58 Correct 2084 ms 8728 KB Output is correct
59 Correct 13 ms 4864 KB Output is correct
60 Correct 12 ms 4480 KB Output is correct
61 Correct 13 ms 4864 KB Output is correct
62 Correct 18 ms 4864 KB Output is correct
63 Correct 35 ms 6016 KB Output is correct
64 Correct 69 ms 5752 KB Output is correct
65 Correct 13 ms 4864 KB Output is correct
66 Correct 19 ms 4984 KB Output is correct
67 Correct 23 ms 6400 KB Output is correct
68 Correct 67 ms 5880 KB Output is correct
69 Correct 14 ms 4864 KB Output is correct
70 Correct 29 ms 5760 KB Output is correct
71 Correct 24 ms 6400 KB Output is correct
72 Correct 49 ms 6272 KB Output is correct
73 Correct 11 ms 4480 KB Output is correct
74 Correct 32 ms 5760 KB Output is correct
75 Correct 48 ms 6272 KB Output is correct
76 Correct 56 ms 5248 KB Output is correct
77 Correct 41 ms 6904 KB Output is correct
78 Correct 11 ms 4480 KB Output is correct
79 Correct 22 ms 5376 KB Output is correct
80 Correct 57 ms 5248 KB Output is correct
81 Correct 42 ms 6912 KB Output is correct
82 Correct 9 ms 4096 KB Output is correct
83 Correct 22 ms 5376 KB Output is correct
84 Correct 28 ms 6272 KB Output is correct
85 Correct 9 ms 4096 KB Output is correct
86 Correct 31 ms 6272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 8 ms 3840 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 11 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 7 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
11 Correct 10 ms 4480 KB Output is correct
12 Correct 95 ms 4600 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 126 ms 4480 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 12 ms 4480 KB Output is correct
17 Correct 6 ms 3840 KB Output is correct
18 Correct 12 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 9 ms 4224 KB Output is correct
21 Correct 8 ms 4224 KB Output is correct
22 Correct 7 ms 3840 KB Output is correct
23 Correct 10 ms 4608 KB Output is correct
24 Correct 7 ms 3840 KB Output is correct
25 Correct 11 ms 4608 KB Output is correct
26 Correct 11 ms 4480 KB Output is correct
27 Correct 11 ms 4480 KB Output is correct
28 Correct 11 ms 4480 KB Output is correct
29 Correct 10 ms 4480 KB Output is correct
30 Correct 39 ms 4608 KB Output is correct
31 Correct 12 ms 4608 KB Output is correct
32 Correct 40 ms 4608 KB Output is correct
33 Correct 12 ms 4608 KB Output is correct
34 Correct 12 ms 4608 KB Output is correct
35 Correct 9 ms 4224 KB Output is correct
36 Correct 12 ms 4224 KB Output is correct
37 Correct 10 ms 4224 KB Output is correct
38 Correct 9 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 13 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 21 ms 4992 KB Output is correct
43 Correct 18 ms 4992 KB Output is correct
44 Correct 7 ms 3840 KB Output is correct
45 Correct 127 ms 20216 KB Output is correct
46 Correct 2637 ms 12696 KB Output is correct
47 Correct 127 ms 20344 KB Output is correct
48 Correct 116 ms 20220 KB Output is correct
49 Correct 50 ms 10356 KB Output is correct
50 Execution timed out 3094 ms 27604 KB Time limit exceeded
51 Halted 0 ms 0 KB -