답안 #245177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245177 2020-07-05T16:28:27 Z m3r8 Political Development (BOI17_politicaldevelopment) C++14
77 / 100
3000 ms 27384 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);
      if(x > i){
        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);
       ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 7 ms 3840 KB Output is correct
3 Correct 11 ms 4480 KB Output is correct
4 Correct 10 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 11 ms 4480 KB Output is correct
7 Correct 11 ms 4480 KB Output is correct
8 Correct 8 ms 3840 KB Output is correct
9 Correct 7 ms 3840 KB Output is correct
10 Correct 7 ms 3840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 7 ms 3840 KB Output is correct
3 Correct 11 ms 4480 KB Output is correct
4 Correct 10 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 11 ms 4480 KB Output is correct
7 Correct 11 ms 4480 KB Output is correct
8 Correct 8 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 11 ms 4352 KB Output is correct
12 Correct 24 ms 4480 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 15 ms 4608 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 10 ms 4480 KB Output is correct
17 Correct 7 ms 3840 KB Output is correct
18 Correct 11 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 8 ms 4224 KB Output is correct
21 Correct 11 ms 4352 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 10 ms 4480 KB Output is correct
27 Correct 10 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 20 ms 4736 KB Output is correct
31 Correct 12 ms 4736 KB Output is correct
32 Correct 21 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 9 ms 4224 KB Output is correct
37 Correct 9 ms 4224 KB Output is correct
38 Correct 8 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 14 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 13 ms 4992 KB Output is correct
43 Correct 13 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 3840 KB Output is correct
2 Correct 6 ms 3840 KB Output is correct
3 Correct 6 ms 3840 KB Output is correct
4 Correct 7 ms 3840 KB Output is correct
5 Correct 7 ms 3840 KB Output is correct
6 Correct 7 ms 3892 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 6 ms 3840 KB Output is correct
11 Correct 213 ms 27196 KB Output is correct
12 Correct 7 ms 3840 KB Output is correct
13 Correct 207 ms 27256 KB Output is correct
14 Correct 6 ms 3840 KB Output is correct
15 Correct 241 ms 27384 KB Output is correct
16 Correct 206 ms 27256 KB Output is correct
17 Correct 217 ms 27256 KB Output is correct
18 Correct 213 ms 27384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 7 ms 3840 KB Output is correct
3 Correct 11 ms 4480 KB Output is correct
4 Correct 10 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 11 ms 4480 KB Output is correct
7 Correct 11 ms 4480 KB Output is correct
8 Correct 8 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 11 ms 4352 KB Output is correct
12 Correct 24 ms 4480 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 15 ms 4608 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 10 ms 4480 KB Output is correct
17 Correct 7 ms 3840 KB Output is correct
18 Correct 11 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 8 ms 4224 KB Output is correct
21 Correct 11 ms 4352 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 10 ms 4480 KB Output is correct
27 Correct 10 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 20 ms 4736 KB Output is correct
31 Correct 12 ms 4736 KB Output is correct
32 Correct 21 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 9 ms 4224 KB Output is correct
37 Correct 9 ms 4224 KB Output is correct
38 Correct 8 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 14 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 13 ms 4992 KB Output is correct
43 Correct 13 ms 4992 KB Output is correct
44 Correct 19 ms 6016 KB Output is correct
45 Correct 7 ms 3840 KB Output is correct
46 Correct 14 ms 5008 KB Output is correct
47 Correct 22 ms 6016 KB Output is correct
48 Correct 14 ms 4992 KB Output is correct
49 Correct 21 ms 6144 KB Output is correct
50 Correct 22 ms 6016 KB Output is correct
51 Correct 31 ms 8192 KB Output is correct
52 Correct 10 ms 4352 KB Output is correct
53 Correct 664 ms 8760 KB Output is correct
54 Correct 36 ms 8696 KB Output is correct
55 Correct 13 ms 4480 KB Output is correct
56 Correct 10 ms 4352 KB Output is correct
57 Correct 7 ms 3840 KB Output is correct
58 Correct 572 ms 8748 KB Output is correct
59 Correct 13 ms 4992 KB Output is correct
60 Correct 11 ms 4480 KB Output is correct
61 Correct 13 ms 4992 KB Output is correct
62 Correct 14 ms 4992 KB Output is correct
63 Correct 28 ms 6016 KB Output is correct
64 Correct 35 ms 5760 KB Output is correct
65 Correct 12 ms 4864 KB Output is correct
66 Correct 14 ms 4992 KB Output is correct
67 Correct 22 ms 6528 KB Output is correct
68 Correct 30 ms 5760 KB Output is correct
69 Correct 13 ms 4864 KB Output is correct
70 Correct 22 ms 6016 KB Output is correct
71 Correct 24 ms 6520 KB Output is correct
72 Correct 32 ms 6520 KB Output is correct
73 Correct 10 ms 4480 KB Output is correct
74 Correct 22 ms 5888 KB Output is correct
75 Correct 32 ms 6400 KB Output is correct
76 Correct 18 ms 5376 KB Output is correct
77 Correct 35 ms 7040 KB Output is correct
78 Correct 11 ms 4480 KB Output is correct
79 Correct 19 ms 5504 KB Output is correct
80 Correct 40 ms 5376 KB Output is correct
81 Correct 32 ms 7040 KB Output is correct
82 Correct 10 ms 4096 KB Output is correct
83 Correct 24 ms 5376 KB Output is correct
84 Correct 25 ms 6480 KB Output is correct
85 Correct 8 ms 4096 KB Output is correct
86 Correct 23 ms 6400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3840 KB Output is correct
2 Correct 7 ms 3840 KB Output is correct
3 Correct 11 ms 4480 KB Output is correct
4 Correct 10 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 11 ms 4480 KB Output is correct
7 Correct 11 ms 4480 KB Output is correct
8 Correct 8 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 11 ms 4352 KB Output is correct
12 Correct 24 ms 4480 KB Output is correct
13 Correct 7 ms 3840 KB Output is correct
14 Correct 15 ms 4608 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 10 ms 4480 KB Output is correct
17 Correct 7 ms 3840 KB Output is correct
18 Correct 11 ms 4480 KB Output is correct
19 Correct 7 ms 3840 KB Output is correct
20 Correct 8 ms 4224 KB Output is correct
21 Correct 11 ms 4352 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 10 ms 4480 KB Output is correct
27 Correct 10 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 20 ms 4736 KB Output is correct
31 Correct 12 ms 4736 KB Output is correct
32 Correct 21 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 9 ms 4224 KB Output is correct
37 Correct 9 ms 4224 KB Output is correct
38 Correct 8 ms 4096 KB Output is correct
39 Correct 9 ms 4096 KB Output is correct
40 Correct 14 ms 4992 KB Output is correct
41 Correct 10 ms 4096 KB Output is correct
42 Correct 13 ms 4992 KB Output is correct
43 Correct 13 ms 4992 KB Output is correct
44 Correct 7 ms 3840 KB Output is correct
45 Correct 113 ms 19832 KB Output is correct
46 Correct 2057 ms 12408 KB Output is correct
47 Correct 122 ms 19960 KB Output is correct
48 Correct 103 ms 19832 KB Output is correct
49 Correct 47 ms 9976 KB Output is correct
50 Execution timed out 3070 ms 25460 KB Time limit exceeded
51 Halted 0 ms 0 KB -