답안 #244696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244696 2020-07-04T15:48:13 Z TheLorax Political Development (BOI17_politicaldevelopment) C++11
16 / 100
163 ms 4600 KB
#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC optimize ("Ofast")

#define F first
#define S second
#define MT make_tuple
#define MP make_pair
#define SZ(a) ((int)(a).size())
#define PB push_back
#define LEFT(i) (2*(i))
#define RIGHT(i) (2*(i)+1)
#define PAR(i) ((i)/2)
#define ALL(a) (a).begin(), (a).end()
#define END(s) {cout << s;return;}

using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;

int n;
std::vector<std::vector<int> > e;

void rek(int a, int f, int s){
  for(auto x: e[a]){
    if(x==s){
      printf("3\n");
      exit(0);
    } if(x==f)
      continue;
    if(s==-1)
      rek(x, a, f);
  }
}

int main(){
  int k;
  scanf("%d %d", &n, &k);
  e.resize(n);
  for(int i=0; i<n; i++){
    int d; scanf("%d", &d);
    for(int j=0; j<d; j++){
      int t;
      scanf("%d", &t);
      e[i].PB(t);
    }
  }

  //k<=3
  for(int i=0; i<n; i++)
    rek(i, -1, -1);
  //k<=2
  for(int i=0; i<n; i++)
    if(SZ(e[i])){
      printf("2\n");
      return 0;
    }
  //k<=1
  printf("1\n");
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:40: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:43:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int d; scanf("%d", &d);
            ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:46:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d", &t);
       ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 640 KB Output is correct
4 Correct 163 ms 716 KB Output is correct
5 Correct 162 ms 640 KB Output is correct
6 Correct 11 ms 640 KB Output is correct
7 Correct 10 ms 640 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 640 KB Output is correct
4 Correct 163 ms 716 KB Output is correct
5 Correct 162 ms 640 KB Output is correct
6 Correct 11 ms 640 KB Output is correct
7 Correct 10 ms 640 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 146 ms 768 KB Output is correct
12 Correct 148 ms 760 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
14 Correct 155 ms 760 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 10 ms 640 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 10 ms 640 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 8 ms 640 KB Output is correct
24 Correct 5 ms 512 KB Output is correct
25 Correct 8 ms 640 KB Output is correct
26 Correct 9 ms 640 KB Output is correct
27 Correct 8 ms 640 KB Output is correct
28 Correct 9 ms 640 KB Output is correct
29 Correct 8 ms 640 KB Output is correct
30 Correct 111 ms 640 KB Output is correct
31 Correct 9 ms 640 KB Output is correct
32 Correct 114 ms 736 KB Output is correct
33 Correct 10 ms 640 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 7 ms 512 KB Output is correct
36 Correct 7 ms 512 KB Output is correct
37 Correct 7 ms 512 KB Output is correct
38 Correct 7 ms 384 KB Output is correct
39 Correct 8 ms 384 KB Output is correct
40 Correct 9 ms 768 KB Output is correct
41 Correct 7 ms 384 KB Output is correct
42 Correct 10 ms 768 KB Output is correct
43 Correct 10 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 640 KB Output is correct
4 Correct 163 ms 716 KB Output is correct
5 Correct 162 ms 640 KB Output is correct
6 Correct 11 ms 640 KB Output is correct
7 Correct 10 ms 640 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 146 ms 768 KB Output is correct
12 Correct 148 ms 760 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
14 Correct 155 ms 760 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 10 ms 640 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 10 ms 640 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 8 ms 640 KB Output is correct
24 Correct 5 ms 512 KB Output is correct
25 Correct 8 ms 640 KB Output is correct
26 Correct 9 ms 640 KB Output is correct
27 Correct 8 ms 640 KB Output is correct
28 Correct 9 ms 640 KB Output is correct
29 Correct 8 ms 640 KB Output is correct
30 Correct 111 ms 640 KB Output is correct
31 Correct 9 ms 640 KB Output is correct
32 Correct 114 ms 736 KB Output is correct
33 Correct 10 ms 640 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 7 ms 512 KB Output is correct
36 Correct 7 ms 512 KB Output is correct
37 Correct 7 ms 512 KB Output is correct
38 Correct 7 ms 384 KB Output is correct
39 Correct 8 ms 384 KB Output is correct
40 Correct 9 ms 768 KB Output is correct
41 Correct 7 ms 384 KB Output is correct
42 Correct 10 ms 768 KB Output is correct
43 Correct 10 ms 768 KB Output is correct
44 Incorrect 13 ms 896 KB Output isn't correct
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 640 KB Output is correct
4 Correct 163 ms 716 KB Output is correct
5 Correct 162 ms 640 KB Output is correct
6 Correct 11 ms 640 KB Output is correct
7 Correct 10 ms 640 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 146 ms 768 KB Output is correct
12 Correct 148 ms 760 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
14 Correct 155 ms 760 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 10 ms 640 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 10 ms 640 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 8 ms 640 KB Output is correct
24 Correct 5 ms 512 KB Output is correct
25 Correct 8 ms 640 KB Output is correct
26 Correct 9 ms 640 KB Output is correct
27 Correct 8 ms 640 KB Output is correct
28 Correct 9 ms 640 KB Output is correct
29 Correct 8 ms 640 KB Output is correct
30 Correct 111 ms 640 KB Output is correct
31 Correct 9 ms 640 KB Output is correct
32 Correct 114 ms 736 KB Output is correct
33 Correct 10 ms 640 KB Output is correct
34 Correct 9 ms 640 KB Output is correct
35 Correct 7 ms 512 KB Output is correct
36 Correct 7 ms 512 KB Output is correct
37 Correct 7 ms 512 KB Output is correct
38 Correct 7 ms 384 KB Output is correct
39 Correct 8 ms 384 KB Output is correct
40 Correct 9 ms 768 KB Output is correct
41 Correct 7 ms 384 KB Output is correct
42 Correct 10 ms 768 KB Output is correct
43 Correct 10 ms 768 KB Output is correct
44 Correct 5 ms 384 KB Output is correct
45 Incorrect 75 ms 4600 KB Output isn't correct
46 Halted 0 ms 0 KB -