답안 #607886

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
607886 2022-07-27T04:37:07 Z tmt514 Wells (CEOI21_wells) C++14
30 / 100
10000 ms 56528 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1500001;
const long long MOD = 1e9+7;
vector<int> a[MAXN];
int e[MAXN][2];
int dp[MAXN][2];

int isfree[MAXN];
int depth[MAXN];
int N, K;

// compute longest path on edge i direction d
int go(int i, int d) {
  if(dp[i][d] != -1) return dp[i][d];
  // fprintf(stderr, "i=%d, d=%d\n", i, d);
  int x = e[i][d], y = e[i][d^1];
  dp[i][d] = 2;
  for(int j : a[y]) {
    if (j != i) {
      int d2 = (y == e[j][1]);
      dp[i][d] = max(dp[i][d], go(j, d2) + 1);
    }
  }
  return dp[i][d];
}

// test
bool test(int x, int p, int level, int longest_outside_path=0) {
  
  bool success = true;
  if (level == 0) {
    for(int i : a[x]) {
      int d = (x == e[i][1]);
      int y = e[i][d^1];
      if (y == p) continue;
      if (isfree[y]) continue;

      success &= test(y, x, K-1, dp[i][d^1]);
      if (!success) return false;
    }
  } else {
    int deepmost = 0, deeptwo = 0, deepthree = 0;
    for(int i : a[x]) {
      int d = (x == e[i][1]);
      int y = e[i][d^1];
      if (y == p) continue;
      if (isfree[y]) continue;

      success &= test(y, x, level - 1, dp[i][d^1]);
      if (!success) return false;

      if (dp[i][d]-1 > deepmost) {
        deepthree = deeptwo;
        deeptwo = deepmost;
        deepmost = dp[i][d] - 1;
      } else if (dp[i][d]-1 > deeptwo) {
        deepthree = deeptwo;
        deeptwo = dp[i][d] - 1;
      } else if (dp[i][d] - 1 > deepthree) {
        deepthree = dp[i][d] - 1;
      }
    }
    if (deepmost >= level && deeptwo >= level && deepmost + deeptwo + 1 >= K && level * 2 + 1 <= K) {
      return false;
    }

    if (deeptwo + longest_outside_path < K &&
      min(level-1, deepmost) + min(level-1, deeptwo) + 1 >= K &&
      deeptwo + deepthree + 1 >= K) {
        return false;
      }

    
    if (deeptwo + longest_outside_path >= K  &&
      min(level-1, deepmost) + min(level-1, deeptwo) + 1 >= K) {
      // printf("x=%d, deep=%d + %d\n", x, min(level-1,deepmost), min(level-1,deeptwo));
      return false;
    }
  }
  return success;
}

int main() {
  scanf("%d%d", &N, &K);
  for(int i=1;i<N;i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x].push_back(i);
    a[y].push_back(i);
    e[i][0] = x;
    e[i][1] = y;
  }
  memset(dp, -1, sizeof(dp));
  for(int i=1;i<N;i++) {
    for(int d=0;d<2;d++) go(i, d);
  }

  
  // check if each vertex is a "free vertex"  
  int freecount=0;
  for(int x=1;x<=N;x++) {
    vector<int> lens;
    for(int i : a[x]) {
      int d = (x == e[i][1]);
      lens.push_back(dp[i][d]-1);
    }
    sort(lens.begin(), lens.end(), greater<>());
    int big = (lens.size()>=1? lens[0]:0) + (lens.size()>=2? lens[1]:0);
    if(big+1<K) {
      isfree[x]=1;
      ++freecount;
    }
  }

  // trivial case: no vertex belongs to a path of length K.
  if (freecount == N) {
    long long ans = 1;
    for(int i=0;i<N;i++) ans=ans*2%MOD;
    printf("YES\n%lld\n", ans);
    return 0;
  }
  // find one non-free vertex, and do DFS.
  // find a path of length k.
  auto get_one_path_start = [&]() {
    for(int x=1;x<=N;x++) {
    for(int i: a[x]) {
      int d = (x==e[i][1]);
      if(dp[i][d] >= K)
      return x;
    }  
  }
  return -1;
  };
  int x = get_one_path_start();
  vector<int> path;
  while(path.size() < K-1) {
    for(int i:a[x]) {
      int d = (x==e[i][1]);
      if((path.size()==0 || e[i][d^1]!=path.back()) && dp[i][d] >= K - (int)path.size()) {
        path.push_back(x);
        x = e[i][d^1];
        break;
      }
    }
  }
  path.push_back(x);

// sort(path.begin(), path.end());
// fprintf(stderr, "path: ");
//   for(int i:path) fprintf(stderr, "%d, ", i);
// fprintf(stderr, "\n");

  // fprintf(stderr, "free=%d\n", freecount);
  int possible = 0;
  for(int y : path) {
    if (test(y, -1, 0)) ++possible;
  }
  if (!possible) {
    printf("NO\n0\n");
  } else {
    for(int i=0;i<freecount;i++) {
      possible = possible*2%MOD;
    }
    printf("YES\n%d\n", possible);
  }
  
  return 0;
}

Compilation message

wells.cpp: In function 'int go(int, int)':
wells.cpp:18:7: warning: unused variable 'x' [-Wunused-variable]
   18 |   int x = e[i][d], y = e[i][d^1];
      |       ^
wells.cpp: In function 'int main()':
wells.cpp:138:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  138 |   while(path.size() < K-1) {
      |         ~~~~~~~~~~~~^~~~~
wells.cpp:86:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   86 |   scanf("%d%d", &N, &K);
      |   ~~~~~^~~~~~~~~~~~~~~~
wells.cpp:89:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   89 |     scanf("%d%d", &x, &y);
      |     ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47192 KB Output is correct
2 Correct 26 ms 47296 KB Output is correct
3 Correct 24 ms 47224 KB Output is correct
4 Correct 21 ms 47300 KB Output is correct
5 Correct 23 ms 47264 KB Output is correct
6 Correct 24 ms 47396 KB Output is correct
7 Correct 26 ms 47276 KB Output is correct
8 Correct 21 ms 47220 KB Output is correct
9 Correct 25 ms 47252 KB Output is correct
10 Correct 27 ms 47180 KB Output is correct
11 Correct 24 ms 47292 KB Output is correct
12 Correct 25 ms 47240 KB Output is correct
13 Correct 23 ms 47224 KB Output is correct
14 Correct 25 ms 47236 KB Output is correct
15 Correct 22 ms 47284 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Partially correct 24 ms 47300 KB Output is partially correct
18 Partially correct 24 ms 47260 KB Output is partially correct
19 Correct 23 ms 47188 KB Output is correct
20 Correct 21 ms 47216 KB Output is correct
21 Correct 27 ms 47268 KB Output is correct
22 Partially correct 28 ms 47292 KB Output is partially correct
23 Partially correct 32 ms 47284 KB Output is partially correct
24 Correct 27 ms 47188 KB Output is correct
25 Correct 22 ms 47272 KB Output is correct
26 Correct 29 ms 47180 KB Output is correct
27 Correct 26 ms 47248 KB Output is correct
28 Correct 26 ms 47204 KB Output is correct
29 Correct 24 ms 47296 KB Output is correct
30 Correct 27 ms 47220 KB Output is correct
31 Correct 25 ms 47316 KB Output is correct
32 Correct 29 ms 47296 KB Output is correct
33 Correct 28 ms 47236 KB Output is correct
34 Correct 30 ms 47276 KB Output is correct
35 Correct 25 ms 47188 KB Output is correct
36 Correct 25 ms 47264 KB Output is correct
37 Correct 23 ms 47188 KB Output is correct
38 Correct 21 ms 47228 KB Output is correct
39 Correct 21 ms 47188 KB Output is correct
40 Correct 27 ms 47292 KB Output is correct
41 Correct 27 ms 47188 KB Output is correct
42 Correct 24 ms 47184 KB Output is correct
43 Correct 23 ms 47284 KB Output is correct
44 Correct 28 ms 47236 KB Output is correct
45 Correct 27 ms 47216 KB Output is correct
46 Correct 22 ms 47252 KB Output is correct
47 Correct 22 ms 47284 KB Output is correct
48 Correct 27 ms 47176 KB Output is correct
49 Partially correct 29 ms 47204 KB Output is partially correct
50 Correct 23 ms 47216 KB Output is correct
51 Partially correct 25 ms 47240 KB Output is partially correct
52 Partially correct 32 ms 47188 KB Output is partially correct
53 Correct 24 ms 47204 KB Output is correct
54 Correct 27 ms 47296 KB Output is correct
55 Correct 27 ms 47304 KB Output is correct
56 Correct 46 ms 47160 KB Output is correct
57 Correct 31 ms 47268 KB Output is correct
58 Correct 30 ms 47188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47192 KB Output is correct
2 Correct 26 ms 47296 KB Output is correct
3 Correct 24 ms 47224 KB Output is correct
4 Correct 21 ms 47300 KB Output is correct
5 Correct 23 ms 47264 KB Output is correct
6 Correct 24 ms 47396 KB Output is correct
7 Correct 26 ms 47276 KB Output is correct
8 Correct 21 ms 47220 KB Output is correct
9 Correct 25 ms 47252 KB Output is correct
10 Correct 27 ms 47180 KB Output is correct
11 Correct 24 ms 47292 KB Output is correct
12 Correct 25 ms 47240 KB Output is correct
13 Correct 23 ms 47224 KB Output is correct
14 Correct 25 ms 47236 KB Output is correct
15 Correct 22 ms 47284 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Partially correct 24 ms 47300 KB Output is partially correct
18 Partially correct 24 ms 47260 KB Output is partially correct
19 Correct 23 ms 47188 KB Output is correct
20 Correct 21 ms 47216 KB Output is correct
21 Correct 27 ms 47268 KB Output is correct
22 Partially correct 28 ms 47292 KB Output is partially correct
23 Partially correct 32 ms 47284 KB Output is partially correct
24 Correct 27 ms 47188 KB Output is correct
25 Correct 22 ms 47272 KB Output is correct
26 Correct 29 ms 47180 KB Output is correct
27 Correct 26 ms 47248 KB Output is correct
28 Correct 26 ms 47204 KB Output is correct
29 Correct 24 ms 47296 KB Output is correct
30 Correct 27 ms 47220 KB Output is correct
31 Correct 25 ms 47316 KB Output is correct
32 Correct 29 ms 47296 KB Output is correct
33 Correct 28 ms 47236 KB Output is correct
34 Correct 30 ms 47276 KB Output is correct
35 Correct 25 ms 47188 KB Output is correct
36 Correct 25 ms 47264 KB Output is correct
37 Correct 23 ms 47188 KB Output is correct
38 Correct 21 ms 47228 KB Output is correct
39 Correct 21 ms 47188 KB Output is correct
40 Correct 27 ms 47292 KB Output is correct
41 Correct 27 ms 47188 KB Output is correct
42 Correct 24 ms 47184 KB Output is correct
43 Correct 23 ms 47284 KB Output is correct
44 Correct 28 ms 47236 KB Output is correct
45 Correct 27 ms 47216 KB Output is correct
46 Correct 22 ms 47252 KB Output is correct
47 Correct 22 ms 47284 KB Output is correct
48 Correct 27 ms 47176 KB Output is correct
49 Partially correct 29 ms 47204 KB Output is partially correct
50 Correct 23 ms 47216 KB Output is correct
51 Partially correct 25 ms 47240 KB Output is partially correct
52 Partially correct 32 ms 47188 KB Output is partially correct
53 Correct 24 ms 47204 KB Output is correct
54 Correct 27 ms 47296 KB Output is correct
55 Correct 27 ms 47304 KB Output is correct
56 Correct 46 ms 47160 KB Output is correct
57 Correct 31 ms 47268 KB Output is correct
58 Correct 30 ms 47188 KB Output is correct
59 Correct 30 ms 47252 KB Output is correct
60 Correct 55 ms 47512 KB Output is correct
61 Correct 51 ms 47348 KB Output is correct
62 Correct 49 ms 47508 KB Output is correct
63 Correct 160 ms 47800 KB Output is correct
64 Correct 1532 ms 48292 KB Output is correct
65 Correct 42 ms 47684 KB Output is correct
66 Correct 41 ms 47664 KB Output is correct
67 Correct 1755 ms 48312 KB Output is correct
68 Correct 83 ms 47516 KB Output is correct
69 Correct 40 ms 47504 KB Output is correct
70 Correct 37 ms 47764 KB Output is correct
71 Correct 65 ms 47528 KB Output is correct
72 Correct 81 ms 47540 KB Output is correct
73 Correct 277 ms 47684 KB Output is correct
74 Partially correct 1497 ms 48088 KB Output is partially correct
75 Partially correct 327 ms 47856 KB Output is partially correct
76 Correct 193 ms 47836 KB Output is correct
77 Partially correct 45 ms 47492 KB Output is partially correct
78 Correct 94 ms 47532 KB Output is correct
79 Correct 50 ms 47492 KB Output is correct
80 Partially correct 1043 ms 47924 KB Output is partially correct
81 Partially correct 1250 ms 47952 KB Output is partially correct
82 Partially correct 445 ms 47852 KB Output is partially correct
83 Correct 779 ms 47880 KB Output is correct
84 Correct 85 ms 47712 KB Output is correct
85 Correct 1303 ms 48088 KB Output is correct
86 Correct 156 ms 47788 KB Output is correct
87 Correct 675 ms 47928 KB Output is correct
88 Correct 638 ms 47884 KB Output is correct
89 Correct 92 ms 47728 KB Output is correct
90 Correct 98 ms 47552 KB Output is correct
91 Correct 498 ms 47852 KB Output is correct
92 Correct 1182 ms 47956 KB Output is correct
93 Correct 185 ms 47828 KB Output is correct
94 Partially correct 67 ms 47704 KB Output is partially correct
95 Partially correct 213 ms 47820 KB Output is partially correct
96 Correct 81 ms 47516 KB Output is correct
97 Partially correct 373 ms 47700 KB Output is partially correct
98 Partially correct 453 ms 47716 KB Output is partially correct
99 Partially correct 278 ms 47684 KB Output is partially correct
100 Partially correct 784 ms 47896 KB Output is partially correct
101 Correct 190 ms 47752 KB Output is correct
102 Correct 267 ms 47924 KB Output is correct
103 Correct 122 ms 47820 KB Output is correct
104 Correct 226 ms 47876 KB Output is correct
105 Correct 555 ms 47920 KB Output is correct
106 Correct 32 ms 47560 KB Output is correct
107 Correct 892 ms 48052 KB Output is correct
108 Correct 288 ms 47724 KB Output is correct
109 Correct 49 ms 47656 KB Output is correct
110 Correct 63 ms 47824 KB Output is correct
111 Correct 611 ms 47852 KB Output is correct
112 Partially correct 895 ms 47992 KB Output is partially correct
113 Correct 462 ms 47836 KB Output is correct
114 Correct 528 ms 47916 KB Output is correct
115 Correct 266 ms 47780 KB Output is correct
116 Correct 999 ms 48040 KB Output is correct
117 Correct 537 ms 47832 KB Output is correct
118 Correct 1168 ms 48064 KB Output is correct
119 Partially correct 463 ms 47828 KB Output is partially correct
120 Correct 872 ms 47960 KB Output is correct
121 Correct 476 ms 48008 KB Output is correct
122 Correct 539 ms 47908 KB Output is correct
123 Correct 523 ms 47792 KB Output is correct
124 Correct 547 ms 48008 KB Output is correct
125 Correct 377 ms 47840 KB Output is correct
126 Partially correct 146 ms 47760 KB Output is partially correct
127 Correct 1187 ms 48040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47192 KB Output is correct
2 Correct 26 ms 47296 KB Output is correct
3 Correct 24 ms 47224 KB Output is correct
4 Correct 21 ms 47300 KB Output is correct
5 Correct 23 ms 47264 KB Output is correct
6 Correct 24 ms 47396 KB Output is correct
7 Correct 26 ms 47276 KB Output is correct
8 Correct 21 ms 47220 KB Output is correct
9 Correct 25 ms 47252 KB Output is correct
10 Correct 27 ms 47180 KB Output is correct
11 Correct 24 ms 47292 KB Output is correct
12 Correct 25 ms 47240 KB Output is correct
13 Correct 23 ms 47224 KB Output is correct
14 Correct 25 ms 47236 KB Output is correct
15 Correct 22 ms 47284 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Partially correct 24 ms 47300 KB Output is partially correct
18 Partially correct 24 ms 47260 KB Output is partially correct
19 Correct 23 ms 47188 KB Output is correct
20 Correct 21 ms 47216 KB Output is correct
21 Correct 27 ms 47268 KB Output is correct
22 Partially correct 28 ms 47292 KB Output is partially correct
23 Partially correct 32 ms 47284 KB Output is partially correct
24 Correct 27 ms 47188 KB Output is correct
25 Correct 22 ms 47272 KB Output is correct
26 Correct 29 ms 47180 KB Output is correct
27 Correct 26 ms 47248 KB Output is correct
28 Correct 26 ms 47204 KB Output is correct
29 Correct 24 ms 47296 KB Output is correct
30 Correct 27 ms 47220 KB Output is correct
31 Correct 25 ms 47316 KB Output is correct
32 Correct 29 ms 47296 KB Output is correct
33 Correct 28 ms 47236 KB Output is correct
34 Correct 30 ms 47276 KB Output is correct
35 Correct 25 ms 47188 KB Output is correct
36 Correct 25 ms 47264 KB Output is correct
37 Correct 23 ms 47188 KB Output is correct
38 Correct 21 ms 47228 KB Output is correct
39 Correct 21 ms 47188 KB Output is correct
40 Correct 27 ms 47292 KB Output is correct
41 Correct 27 ms 47188 KB Output is correct
42 Correct 24 ms 47184 KB Output is correct
43 Correct 23 ms 47284 KB Output is correct
44 Correct 28 ms 47236 KB Output is correct
45 Correct 27 ms 47216 KB Output is correct
46 Correct 22 ms 47252 KB Output is correct
47 Correct 22 ms 47284 KB Output is correct
48 Correct 27 ms 47176 KB Output is correct
49 Partially correct 29 ms 47204 KB Output is partially correct
50 Correct 23 ms 47216 KB Output is correct
51 Partially correct 25 ms 47240 KB Output is partially correct
52 Partially correct 32 ms 47188 KB Output is partially correct
53 Correct 24 ms 47204 KB Output is correct
54 Correct 27 ms 47296 KB Output is correct
55 Correct 27 ms 47304 KB Output is correct
56 Correct 46 ms 47160 KB Output is correct
57 Correct 31 ms 47268 KB Output is correct
58 Correct 30 ms 47188 KB Output is correct
59 Correct 30 ms 47252 KB Output is correct
60 Correct 55 ms 47512 KB Output is correct
61 Correct 51 ms 47348 KB Output is correct
62 Correct 49 ms 47508 KB Output is correct
63 Correct 160 ms 47800 KB Output is correct
64 Correct 1532 ms 48292 KB Output is correct
65 Correct 42 ms 47684 KB Output is correct
66 Correct 41 ms 47664 KB Output is correct
67 Correct 1755 ms 48312 KB Output is correct
68 Correct 83 ms 47516 KB Output is correct
69 Correct 40 ms 47504 KB Output is correct
70 Correct 37 ms 47764 KB Output is correct
71 Correct 65 ms 47528 KB Output is correct
72 Correct 81 ms 47540 KB Output is correct
73 Correct 277 ms 47684 KB Output is correct
74 Partially correct 1497 ms 48088 KB Output is partially correct
75 Partially correct 327 ms 47856 KB Output is partially correct
76 Correct 193 ms 47836 KB Output is correct
77 Partially correct 45 ms 47492 KB Output is partially correct
78 Correct 94 ms 47532 KB Output is correct
79 Correct 50 ms 47492 KB Output is correct
80 Partially correct 1043 ms 47924 KB Output is partially correct
81 Partially correct 1250 ms 47952 KB Output is partially correct
82 Partially correct 445 ms 47852 KB Output is partially correct
83 Correct 779 ms 47880 KB Output is correct
84 Correct 85 ms 47712 KB Output is correct
85 Correct 1303 ms 48088 KB Output is correct
86 Correct 156 ms 47788 KB Output is correct
87 Correct 675 ms 47928 KB Output is correct
88 Correct 638 ms 47884 KB Output is correct
89 Correct 92 ms 47728 KB Output is correct
90 Correct 98 ms 47552 KB Output is correct
91 Correct 498 ms 47852 KB Output is correct
92 Correct 1182 ms 47956 KB Output is correct
93 Correct 185 ms 47828 KB Output is correct
94 Partially correct 67 ms 47704 KB Output is partially correct
95 Partially correct 213 ms 47820 KB Output is partially correct
96 Correct 81 ms 47516 KB Output is correct
97 Partially correct 373 ms 47700 KB Output is partially correct
98 Partially correct 453 ms 47716 KB Output is partially correct
99 Partially correct 278 ms 47684 KB Output is partially correct
100 Partially correct 784 ms 47896 KB Output is partially correct
101 Correct 190 ms 47752 KB Output is correct
102 Correct 267 ms 47924 KB Output is correct
103 Correct 122 ms 47820 KB Output is correct
104 Correct 226 ms 47876 KB Output is correct
105 Correct 555 ms 47920 KB Output is correct
106 Correct 32 ms 47560 KB Output is correct
107 Correct 892 ms 48052 KB Output is correct
108 Correct 288 ms 47724 KB Output is correct
109 Correct 49 ms 47656 KB Output is correct
110 Correct 63 ms 47824 KB Output is correct
111 Correct 611 ms 47852 KB Output is correct
112 Partially correct 895 ms 47992 KB Output is partially correct
113 Correct 462 ms 47836 KB Output is correct
114 Correct 528 ms 47916 KB Output is correct
115 Correct 266 ms 47780 KB Output is correct
116 Correct 999 ms 48040 KB Output is correct
117 Correct 537 ms 47832 KB Output is correct
118 Correct 1168 ms 48064 KB Output is correct
119 Partially correct 463 ms 47828 KB Output is partially correct
120 Correct 872 ms 47960 KB Output is correct
121 Correct 476 ms 48008 KB Output is correct
122 Correct 539 ms 47908 KB Output is correct
123 Correct 523 ms 47792 KB Output is correct
124 Correct 547 ms 48008 KB Output is correct
125 Correct 377 ms 47840 KB Output is correct
126 Partially correct 146 ms 47760 KB Output is partially correct
127 Correct 1187 ms 48040 KB Output is correct
128 Correct 26 ms 47156 KB Output is correct
129 Execution timed out 10069 ms 56528 KB Time limit exceeded
130 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47192 KB Output is correct
2 Correct 26 ms 47296 KB Output is correct
3 Correct 24 ms 47224 KB Output is correct
4 Correct 21 ms 47300 KB Output is correct
5 Correct 23 ms 47264 KB Output is correct
6 Correct 24 ms 47396 KB Output is correct
7 Correct 26 ms 47276 KB Output is correct
8 Correct 21 ms 47220 KB Output is correct
9 Correct 25 ms 47252 KB Output is correct
10 Correct 27 ms 47180 KB Output is correct
11 Correct 24 ms 47292 KB Output is correct
12 Correct 25 ms 47240 KB Output is correct
13 Correct 23 ms 47224 KB Output is correct
14 Correct 25 ms 47236 KB Output is correct
15 Correct 22 ms 47284 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Partially correct 24 ms 47300 KB Output is partially correct
18 Partially correct 24 ms 47260 KB Output is partially correct
19 Correct 23 ms 47188 KB Output is correct
20 Correct 21 ms 47216 KB Output is correct
21 Correct 27 ms 47268 KB Output is correct
22 Partially correct 28 ms 47292 KB Output is partially correct
23 Partially correct 32 ms 47284 KB Output is partially correct
24 Correct 27 ms 47188 KB Output is correct
25 Correct 22 ms 47272 KB Output is correct
26 Correct 29 ms 47180 KB Output is correct
27 Correct 26 ms 47248 KB Output is correct
28 Correct 26 ms 47204 KB Output is correct
29 Correct 24 ms 47296 KB Output is correct
30 Correct 27 ms 47220 KB Output is correct
31 Correct 25 ms 47316 KB Output is correct
32 Correct 29 ms 47296 KB Output is correct
33 Correct 28 ms 47236 KB Output is correct
34 Correct 30 ms 47276 KB Output is correct
35 Correct 25 ms 47188 KB Output is correct
36 Correct 25 ms 47264 KB Output is correct
37 Correct 23 ms 47188 KB Output is correct
38 Correct 21 ms 47228 KB Output is correct
39 Correct 21 ms 47188 KB Output is correct
40 Correct 27 ms 47292 KB Output is correct
41 Correct 27 ms 47188 KB Output is correct
42 Correct 24 ms 47184 KB Output is correct
43 Correct 23 ms 47284 KB Output is correct
44 Correct 28 ms 47236 KB Output is correct
45 Correct 27 ms 47216 KB Output is correct
46 Correct 22 ms 47252 KB Output is correct
47 Correct 22 ms 47284 KB Output is correct
48 Correct 27 ms 47176 KB Output is correct
49 Partially correct 29 ms 47204 KB Output is partially correct
50 Correct 23 ms 47216 KB Output is correct
51 Partially correct 25 ms 47240 KB Output is partially correct
52 Partially correct 32 ms 47188 KB Output is partially correct
53 Correct 24 ms 47204 KB Output is correct
54 Correct 27 ms 47296 KB Output is correct
55 Correct 27 ms 47304 KB Output is correct
56 Correct 46 ms 47160 KB Output is correct
57 Correct 31 ms 47268 KB Output is correct
58 Correct 30 ms 47188 KB Output is correct
59 Correct 30 ms 47252 KB Output is correct
60 Correct 55 ms 47512 KB Output is correct
61 Correct 51 ms 47348 KB Output is correct
62 Correct 49 ms 47508 KB Output is correct
63 Correct 160 ms 47800 KB Output is correct
64 Correct 1532 ms 48292 KB Output is correct
65 Correct 42 ms 47684 KB Output is correct
66 Correct 41 ms 47664 KB Output is correct
67 Correct 1755 ms 48312 KB Output is correct
68 Correct 83 ms 47516 KB Output is correct
69 Correct 40 ms 47504 KB Output is correct
70 Correct 37 ms 47764 KB Output is correct
71 Correct 65 ms 47528 KB Output is correct
72 Correct 81 ms 47540 KB Output is correct
73 Correct 277 ms 47684 KB Output is correct
74 Partially correct 1497 ms 48088 KB Output is partially correct
75 Partially correct 327 ms 47856 KB Output is partially correct
76 Correct 193 ms 47836 KB Output is correct
77 Partially correct 45 ms 47492 KB Output is partially correct
78 Correct 94 ms 47532 KB Output is correct
79 Correct 50 ms 47492 KB Output is correct
80 Partially correct 1043 ms 47924 KB Output is partially correct
81 Partially correct 1250 ms 47952 KB Output is partially correct
82 Partially correct 445 ms 47852 KB Output is partially correct
83 Correct 779 ms 47880 KB Output is correct
84 Correct 85 ms 47712 KB Output is correct
85 Correct 1303 ms 48088 KB Output is correct
86 Correct 156 ms 47788 KB Output is correct
87 Correct 675 ms 47928 KB Output is correct
88 Correct 638 ms 47884 KB Output is correct
89 Correct 92 ms 47728 KB Output is correct
90 Correct 98 ms 47552 KB Output is correct
91 Correct 498 ms 47852 KB Output is correct
92 Correct 1182 ms 47956 KB Output is correct
93 Correct 185 ms 47828 KB Output is correct
94 Partially correct 67 ms 47704 KB Output is partially correct
95 Partially correct 213 ms 47820 KB Output is partially correct
96 Correct 81 ms 47516 KB Output is correct
97 Partially correct 373 ms 47700 KB Output is partially correct
98 Partially correct 453 ms 47716 KB Output is partially correct
99 Partially correct 278 ms 47684 KB Output is partially correct
100 Partially correct 784 ms 47896 KB Output is partially correct
101 Correct 190 ms 47752 KB Output is correct
102 Correct 267 ms 47924 KB Output is correct
103 Correct 122 ms 47820 KB Output is correct
104 Correct 226 ms 47876 KB Output is correct
105 Correct 555 ms 47920 KB Output is correct
106 Correct 32 ms 47560 KB Output is correct
107 Correct 892 ms 48052 KB Output is correct
108 Correct 288 ms 47724 KB Output is correct
109 Correct 49 ms 47656 KB Output is correct
110 Correct 63 ms 47824 KB Output is correct
111 Correct 611 ms 47852 KB Output is correct
112 Partially correct 895 ms 47992 KB Output is partially correct
113 Correct 462 ms 47836 KB Output is correct
114 Correct 528 ms 47916 KB Output is correct
115 Correct 266 ms 47780 KB Output is correct
116 Correct 999 ms 48040 KB Output is correct
117 Correct 537 ms 47832 KB Output is correct
118 Correct 1168 ms 48064 KB Output is correct
119 Partially correct 463 ms 47828 KB Output is partially correct
120 Correct 872 ms 47960 KB Output is correct
121 Correct 476 ms 48008 KB Output is correct
122 Correct 539 ms 47908 KB Output is correct
123 Correct 523 ms 47792 KB Output is correct
124 Correct 547 ms 48008 KB Output is correct
125 Correct 377 ms 47840 KB Output is correct
126 Partially correct 146 ms 47760 KB Output is partially correct
127 Correct 1187 ms 48040 KB Output is correct
128 Correct 26 ms 47156 KB Output is correct
129 Execution timed out 10069 ms 56528 KB Time limit exceeded
130 Halted 0 ms 0 KB -