Submission #607805

# Submission time Handle Problem Language Result Execution time Memory
607805 2022-07-27T04:22:21 Z tmt514 Wells (CEOI21_wells) C++14
30 / 100
10000 ms 59048 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) {
      // 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:131:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  131 |   while(path.size() < K-1) {
      |         ~~~~~~~~~~~~^~~~~
wells.cpp:79:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   79 |   scanf("%d%d", &N, &K);
      |   ~~~~~^~~~~~~~~~~~~~~~
wells.cpp:82:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   82 |     scanf("%d%d", &x, &y);
      |     ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47188 KB Output is correct
2 Correct 21 ms 47288 KB Output is correct
3 Correct 21 ms 47216 KB Output is correct
4 Partially correct 22 ms 47288 KB Output is partially correct
5 Correct 22 ms 47172 KB Output is correct
6 Correct 22 ms 47188 KB Output is correct
7 Correct 22 ms 47188 KB Output is correct
8 Correct 24 ms 47200 KB Output is correct
9 Correct 22 ms 47228 KB Output is correct
10 Correct 22 ms 47296 KB Output is correct
11 Correct 23 ms 47160 KB Output is correct
12 Correct 22 ms 47176 KB Output is correct
13 Correct 24 ms 47208 KB Output is correct
14 Correct 26 ms 47188 KB Output is correct
15 Correct 23 ms 47280 KB Output is correct
16 Correct 23 ms 47188 KB Output is correct
17 Partially correct 24 ms 47316 KB Output is partially correct
18 Partially correct 23 ms 47296 KB Output is partially correct
19 Correct 23 ms 47300 KB Output is correct
20 Correct 20 ms 47188 KB Output is correct
21 Correct 21 ms 47200 KB Output is correct
22 Partially correct 25 ms 47252 KB Output is partially correct
23 Partially correct 21 ms 47188 KB Output is partially correct
24 Correct 24 ms 47180 KB Output is correct
25 Correct 22 ms 47228 KB Output is correct
26 Correct 22 ms 47300 KB Output is correct
27 Correct 26 ms 47308 KB Output is correct
28 Correct 22 ms 47300 KB Output is correct
29 Correct 24 ms 47196 KB Output is correct
30 Correct 21 ms 47200 KB Output is correct
31 Correct 25 ms 47296 KB Output is correct
32 Correct 25 ms 47288 KB Output is correct
33 Correct 24 ms 47184 KB Output is correct
34 Correct 25 ms 47284 KB Output is correct
35 Correct 23 ms 47188 KB Output is correct
36 Correct 24 ms 47300 KB Output is correct
37 Correct 24 ms 47196 KB Output is correct
38 Correct 24 ms 47168 KB Output is correct
39 Correct 23 ms 47284 KB Output is correct
40 Correct 24 ms 47188 KB Output is correct
41 Correct 24 ms 47180 KB Output is correct
42 Correct 24 ms 47304 KB Output is correct
43 Correct 23 ms 47188 KB Output is correct
44 Correct 22 ms 47200 KB Output is correct
45 Correct 25 ms 47176 KB Output is correct
46 Correct 23 ms 47188 KB Output is correct
47 Correct 23 ms 47188 KB Output is correct
48 Correct 23 ms 47188 KB Output is correct
49 Partially correct 23 ms 47188 KB Output is partially correct
50 Correct 24 ms 47288 KB Output is correct
51 Partially correct 23 ms 47188 KB Output is partially correct
52 Partially correct 24 ms 47304 KB Output is partially correct
53 Correct 23 ms 47180 KB Output is correct
54 Correct 23 ms 47276 KB Output is correct
55 Correct 22 ms 47188 KB Output is correct
56 Correct 23 ms 47188 KB Output is correct
57 Correct 22 ms 47296 KB Output is correct
58 Correct 23 ms 47308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47188 KB Output is correct
2 Correct 21 ms 47288 KB Output is correct
3 Correct 21 ms 47216 KB Output is correct
4 Partially correct 22 ms 47288 KB Output is partially correct
5 Correct 22 ms 47172 KB Output is correct
6 Correct 22 ms 47188 KB Output is correct
7 Correct 22 ms 47188 KB Output is correct
8 Correct 24 ms 47200 KB Output is correct
9 Correct 22 ms 47228 KB Output is correct
10 Correct 22 ms 47296 KB Output is correct
11 Correct 23 ms 47160 KB Output is correct
12 Correct 22 ms 47176 KB Output is correct
13 Correct 24 ms 47208 KB Output is correct
14 Correct 26 ms 47188 KB Output is correct
15 Correct 23 ms 47280 KB Output is correct
16 Correct 23 ms 47188 KB Output is correct
17 Partially correct 24 ms 47316 KB Output is partially correct
18 Partially correct 23 ms 47296 KB Output is partially correct
19 Correct 23 ms 47300 KB Output is correct
20 Correct 20 ms 47188 KB Output is correct
21 Correct 21 ms 47200 KB Output is correct
22 Partially correct 25 ms 47252 KB Output is partially correct
23 Partially correct 21 ms 47188 KB Output is partially correct
24 Correct 24 ms 47180 KB Output is correct
25 Correct 22 ms 47228 KB Output is correct
26 Correct 22 ms 47300 KB Output is correct
27 Correct 26 ms 47308 KB Output is correct
28 Correct 22 ms 47300 KB Output is correct
29 Correct 24 ms 47196 KB Output is correct
30 Correct 21 ms 47200 KB Output is correct
31 Correct 25 ms 47296 KB Output is correct
32 Correct 25 ms 47288 KB Output is correct
33 Correct 24 ms 47184 KB Output is correct
34 Correct 25 ms 47284 KB Output is correct
35 Correct 23 ms 47188 KB Output is correct
36 Correct 24 ms 47300 KB Output is correct
37 Correct 24 ms 47196 KB Output is correct
38 Correct 24 ms 47168 KB Output is correct
39 Correct 23 ms 47284 KB Output is correct
40 Correct 24 ms 47188 KB Output is correct
41 Correct 24 ms 47180 KB Output is correct
42 Correct 24 ms 47304 KB Output is correct
43 Correct 23 ms 47188 KB Output is correct
44 Correct 22 ms 47200 KB Output is correct
45 Correct 25 ms 47176 KB Output is correct
46 Correct 23 ms 47188 KB Output is correct
47 Correct 23 ms 47188 KB Output is correct
48 Correct 23 ms 47188 KB Output is correct
49 Partially correct 23 ms 47188 KB Output is partially correct
50 Correct 24 ms 47288 KB Output is correct
51 Partially correct 23 ms 47188 KB Output is partially correct
52 Partially correct 24 ms 47304 KB Output is partially correct
53 Correct 23 ms 47180 KB Output is correct
54 Correct 23 ms 47276 KB Output is correct
55 Correct 22 ms 47188 KB Output is correct
56 Correct 23 ms 47188 KB Output is correct
57 Correct 22 ms 47296 KB Output is correct
58 Correct 23 ms 47308 KB Output is correct
59 Correct 23 ms 47188 KB Output is correct
60 Correct 53 ms 47564 KB Output is correct
61 Correct 34 ms 47436 KB Output is correct
62 Correct 44 ms 47520 KB Output is correct
63 Correct 126 ms 47892 KB Output is correct
64 Correct 1361 ms 48400 KB Output is correct
65 Correct 39 ms 47696 KB Output is correct
66 Correct 34 ms 47740 KB Output is correct
67 Correct 1539 ms 48412 KB Output is correct
68 Correct 60 ms 47564 KB Output is correct
69 Correct 26 ms 47396 KB Output is correct
70 Correct 31 ms 47896 KB Output is correct
71 Correct 66 ms 47560 KB Output is correct
72 Correct 63 ms 47592 KB Output is correct
73 Correct 205 ms 47728 KB Output is correct
74 Partially correct 1318 ms 48256 KB Output is partially correct
75 Partially correct 340 ms 47948 KB Output is partially correct
76 Correct 170 ms 47932 KB Output is correct
77 Partially correct 32 ms 47456 KB Output is partially correct
78 Correct 85 ms 47608 KB Output is correct
79 Correct 47 ms 47492 KB Output is correct
80 Partially correct 835 ms 47996 KB Output is partially correct
81 Partially correct 865 ms 48016 KB Output is partially correct
82 Partially correct 334 ms 47992 KB Output is partially correct
83 Correct 369 ms 47984 KB Output is correct
84 Correct 76 ms 47820 KB Output is correct
85 Correct 1201 ms 48172 KB Output is correct
86 Correct 127 ms 47968 KB Output is correct
87 Correct 497 ms 48204 KB Output is correct
88 Correct 527 ms 48132 KB Output is correct
89 Correct 80 ms 47824 KB Output is correct
90 Correct 77 ms 47564 KB Output is correct
91 Correct 451 ms 48076 KB Output is correct
92 Correct 915 ms 48108 KB Output is correct
93 Correct 139 ms 48016 KB Output is correct
94 Partially correct 57 ms 47800 KB Output is partially correct
95 Partially correct 172 ms 47736 KB Output is partially correct
96 Correct 65 ms 47572 KB Output is correct
97 Partially correct 343 ms 47748 KB Output is partially correct
98 Partially correct 354 ms 47772 KB Output is partially correct
99 Partially correct 225 ms 47820 KB Output is partially correct
100 Partially correct 678 ms 47976 KB Output is partially correct
101 Correct 133 ms 47948 KB Output is correct
102 Correct 232 ms 48080 KB Output is correct
103 Correct 133 ms 47976 KB Output is correct
104 Correct 240 ms 47976 KB Output is correct
105 Correct 559 ms 48012 KB Output is correct
106 Correct 30 ms 47764 KB Output is correct
107 Correct 739 ms 48164 KB Output is correct
108 Correct 151 ms 47824 KB Output is correct
109 Correct 59 ms 47852 KB Output is correct
110 Correct 68 ms 47864 KB Output is correct
111 Correct 490 ms 47936 KB Output is correct
112 Partially correct 849 ms 48096 KB Output is partially correct
113 Correct 379 ms 47940 KB Output is correct
114 Correct 473 ms 48076 KB Output is correct
115 Correct 191 ms 47820 KB Output is correct
116 Correct 844 ms 48104 KB Output is correct
117 Correct 324 ms 47928 KB Output is correct
118 Correct 1008 ms 48156 KB Output is correct
119 Partially correct 375 ms 47936 KB Output is partially correct
120 Correct 702 ms 48028 KB Output is correct
121 Correct 390 ms 48212 KB Output is correct
122 Correct 392 ms 48044 KB Output is correct
123 Correct 463 ms 47920 KB Output is correct
124 Correct 490 ms 48132 KB Output is correct
125 Correct 249 ms 47936 KB Output is correct
126 Partially correct 99 ms 47844 KB Output is partially correct
127 Correct 814 ms 48212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47188 KB Output is correct
2 Correct 21 ms 47288 KB Output is correct
3 Correct 21 ms 47216 KB Output is correct
4 Partially correct 22 ms 47288 KB Output is partially correct
5 Correct 22 ms 47172 KB Output is correct
6 Correct 22 ms 47188 KB Output is correct
7 Correct 22 ms 47188 KB Output is correct
8 Correct 24 ms 47200 KB Output is correct
9 Correct 22 ms 47228 KB Output is correct
10 Correct 22 ms 47296 KB Output is correct
11 Correct 23 ms 47160 KB Output is correct
12 Correct 22 ms 47176 KB Output is correct
13 Correct 24 ms 47208 KB Output is correct
14 Correct 26 ms 47188 KB Output is correct
15 Correct 23 ms 47280 KB Output is correct
16 Correct 23 ms 47188 KB Output is correct
17 Partially correct 24 ms 47316 KB Output is partially correct
18 Partially correct 23 ms 47296 KB Output is partially correct
19 Correct 23 ms 47300 KB Output is correct
20 Correct 20 ms 47188 KB Output is correct
21 Correct 21 ms 47200 KB Output is correct
22 Partially correct 25 ms 47252 KB Output is partially correct
23 Partially correct 21 ms 47188 KB Output is partially correct
24 Correct 24 ms 47180 KB Output is correct
25 Correct 22 ms 47228 KB Output is correct
26 Correct 22 ms 47300 KB Output is correct
27 Correct 26 ms 47308 KB Output is correct
28 Correct 22 ms 47300 KB Output is correct
29 Correct 24 ms 47196 KB Output is correct
30 Correct 21 ms 47200 KB Output is correct
31 Correct 25 ms 47296 KB Output is correct
32 Correct 25 ms 47288 KB Output is correct
33 Correct 24 ms 47184 KB Output is correct
34 Correct 25 ms 47284 KB Output is correct
35 Correct 23 ms 47188 KB Output is correct
36 Correct 24 ms 47300 KB Output is correct
37 Correct 24 ms 47196 KB Output is correct
38 Correct 24 ms 47168 KB Output is correct
39 Correct 23 ms 47284 KB Output is correct
40 Correct 24 ms 47188 KB Output is correct
41 Correct 24 ms 47180 KB Output is correct
42 Correct 24 ms 47304 KB Output is correct
43 Correct 23 ms 47188 KB Output is correct
44 Correct 22 ms 47200 KB Output is correct
45 Correct 25 ms 47176 KB Output is correct
46 Correct 23 ms 47188 KB Output is correct
47 Correct 23 ms 47188 KB Output is correct
48 Correct 23 ms 47188 KB Output is correct
49 Partially correct 23 ms 47188 KB Output is partially correct
50 Correct 24 ms 47288 KB Output is correct
51 Partially correct 23 ms 47188 KB Output is partially correct
52 Partially correct 24 ms 47304 KB Output is partially correct
53 Correct 23 ms 47180 KB Output is correct
54 Correct 23 ms 47276 KB Output is correct
55 Correct 22 ms 47188 KB Output is correct
56 Correct 23 ms 47188 KB Output is correct
57 Correct 22 ms 47296 KB Output is correct
58 Correct 23 ms 47308 KB Output is correct
59 Correct 23 ms 47188 KB Output is correct
60 Correct 53 ms 47564 KB Output is correct
61 Correct 34 ms 47436 KB Output is correct
62 Correct 44 ms 47520 KB Output is correct
63 Correct 126 ms 47892 KB Output is correct
64 Correct 1361 ms 48400 KB Output is correct
65 Correct 39 ms 47696 KB Output is correct
66 Correct 34 ms 47740 KB Output is correct
67 Correct 1539 ms 48412 KB Output is correct
68 Correct 60 ms 47564 KB Output is correct
69 Correct 26 ms 47396 KB Output is correct
70 Correct 31 ms 47896 KB Output is correct
71 Correct 66 ms 47560 KB Output is correct
72 Correct 63 ms 47592 KB Output is correct
73 Correct 205 ms 47728 KB Output is correct
74 Partially correct 1318 ms 48256 KB Output is partially correct
75 Partially correct 340 ms 47948 KB Output is partially correct
76 Correct 170 ms 47932 KB Output is correct
77 Partially correct 32 ms 47456 KB Output is partially correct
78 Correct 85 ms 47608 KB Output is correct
79 Correct 47 ms 47492 KB Output is correct
80 Partially correct 835 ms 47996 KB Output is partially correct
81 Partially correct 865 ms 48016 KB Output is partially correct
82 Partially correct 334 ms 47992 KB Output is partially correct
83 Correct 369 ms 47984 KB Output is correct
84 Correct 76 ms 47820 KB Output is correct
85 Correct 1201 ms 48172 KB Output is correct
86 Correct 127 ms 47968 KB Output is correct
87 Correct 497 ms 48204 KB Output is correct
88 Correct 527 ms 48132 KB Output is correct
89 Correct 80 ms 47824 KB Output is correct
90 Correct 77 ms 47564 KB Output is correct
91 Correct 451 ms 48076 KB Output is correct
92 Correct 915 ms 48108 KB Output is correct
93 Correct 139 ms 48016 KB Output is correct
94 Partially correct 57 ms 47800 KB Output is partially correct
95 Partially correct 172 ms 47736 KB Output is partially correct
96 Correct 65 ms 47572 KB Output is correct
97 Partially correct 343 ms 47748 KB Output is partially correct
98 Partially correct 354 ms 47772 KB Output is partially correct
99 Partially correct 225 ms 47820 KB Output is partially correct
100 Partially correct 678 ms 47976 KB Output is partially correct
101 Correct 133 ms 47948 KB Output is correct
102 Correct 232 ms 48080 KB Output is correct
103 Correct 133 ms 47976 KB Output is correct
104 Correct 240 ms 47976 KB Output is correct
105 Correct 559 ms 48012 KB Output is correct
106 Correct 30 ms 47764 KB Output is correct
107 Correct 739 ms 48164 KB Output is correct
108 Correct 151 ms 47824 KB Output is correct
109 Correct 59 ms 47852 KB Output is correct
110 Correct 68 ms 47864 KB Output is correct
111 Correct 490 ms 47936 KB Output is correct
112 Partially correct 849 ms 48096 KB Output is partially correct
113 Correct 379 ms 47940 KB Output is correct
114 Correct 473 ms 48076 KB Output is correct
115 Correct 191 ms 47820 KB Output is correct
116 Correct 844 ms 48104 KB Output is correct
117 Correct 324 ms 47928 KB Output is correct
118 Correct 1008 ms 48156 KB Output is correct
119 Partially correct 375 ms 47936 KB Output is partially correct
120 Correct 702 ms 48028 KB Output is correct
121 Correct 390 ms 48212 KB Output is correct
122 Correct 392 ms 48044 KB Output is correct
123 Correct 463 ms 47920 KB Output is correct
124 Correct 490 ms 48132 KB Output is correct
125 Correct 249 ms 47936 KB Output is correct
126 Partially correct 99 ms 47844 KB Output is partially correct
127 Correct 814 ms 48212 KB Output is correct
128 Correct 23 ms 47308 KB Output is correct
129 Execution timed out 10018 ms 59048 KB Time limit exceeded
130 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47188 KB Output is correct
2 Correct 21 ms 47288 KB Output is correct
3 Correct 21 ms 47216 KB Output is correct
4 Partially correct 22 ms 47288 KB Output is partially correct
5 Correct 22 ms 47172 KB Output is correct
6 Correct 22 ms 47188 KB Output is correct
7 Correct 22 ms 47188 KB Output is correct
8 Correct 24 ms 47200 KB Output is correct
9 Correct 22 ms 47228 KB Output is correct
10 Correct 22 ms 47296 KB Output is correct
11 Correct 23 ms 47160 KB Output is correct
12 Correct 22 ms 47176 KB Output is correct
13 Correct 24 ms 47208 KB Output is correct
14 Correct 26 ms 47188 KB Output is correct
15 Correct 23 ms 47280 KB Output is correct
16 Correct 23 ms 47188 KB Output is correct
17 Partially correct 24 ms 47316 KB Output is partially correct
18 Partially correct 23 ms 47296 KB Output is partially correct
19 Correct 23 ms 47300 KB Output is correct
20 Correct 20 ms 47188 KB Output is correct
21 Correct 21 ms 47200 KB Output is correct
22 Partially correct 25 ms 47252 KB Output is partially correct
23 Partially correct 21 ms 47188 KB Output is partially correct
24 Correct 24 ms 47180 KB Output is correct
25 Correct 22 ms 47228 KB Output is correct
26 Correct 22 ms 47300 KB Output is correct
27 Correct 26 ms 47308 KB Output is correct
28 Correct 22 ms 47300 KB Output is correct
29 Correct 24 ms 47196 KB Output is correct
30 Correct 21 ms 47200 KB Output is correct
31 Correct 25 ms 47296 KB Output is correct
32 Correct 25 ms 47288 KB Output is correct
33 Correct 24 ms 47184 KB Output is correct
34 Correct 25 ms 47284 KB Output is correct
35 Correct 23 ms 47188 KB Output is correct
36 Correct 24 ms 47300 KB Output is correct
37 Correct 24 ms 47196 KB Output is correct
38 Correct 24 ms 47168 KB Output is correct
39 Correct 23 ms 47284 KB Output is correct
40 Correct 24 ms 47188 KB Output is correct
41 Correct 24 ms 47180 KB Output is correct
42 Correct 24 ms 47304 KB Output is correct
43 Correct 23 ms 47188 KB Output is correct
44 Correct 22 ms 47200 KB Output is correct
45 Correct 25 ms 47176 KB Output is correct
46 Correct 23 ms 47188 KB Output is correct
47 Correct 23 ms 47188 KB Output is correct
48 Correct 23 ms 47188 KB Output is correct
49 Partially correct 23 ms 47188 KB Output is partially correct
50 Correct 24 ms 47288 KB Output is correct
51 Partially correct 23 ms 47188 KB Output is partially correct
52 Partially correct 24 ms 47304 KB Output is partially correct
53 Correct 23 ms 47180 KB Output is correct
54 Correct 23 ms 47276 KB Output is correct
55 Correct 22 ms 47188 KB Output is correct
56 Correct 23 ms 47188 KB Output is correct
57 Correct 22 ms 47296 KB Output is correct
58 Correct 23 ms 47308 KB Output is correct
59 Correct 23 ms 47188 KB Output is correct
60 Correct 53 ms 47564 KB Output is correct
61 Correct 34 ms 47436 KB Output is correct
62 Correct 44 ms 47520 KB Output is correct
63 Correct 126 ms 47892 KB Output is correct
64 Correct 1361 ms 48400 KB Output is correct
65 Correct 39 ms 47696 KB Output is correct
66 Correct 34 ms 47740 KB Output is correct
67 Correct 1539 ms 48412 KB Output is correct
68 Correct 60 ms 47564 KB Output is correct
69 Correct 26 ms 47396 KB Output is correct
70 Correct 31 ms 47896 KB Output is correct
71 Correct 66 ms 47560 KB Output is correct
72 Correct 63 ms 47592 KB Output is correct
73 Correct 205 ms 47728 KB Output is correct
74 Partially correct 1318 ms 48256 KB Output is partially correct
75 Partially correct 340 ms 47948 KB Output is partially correct
76 Correct 170 ms 47932 KB Output is correct
77 Partially correct 32 ms 47456 KB Output is partially correct
78 Correct 85 ms 47608 KB Output is correct
79 Correct 47 ms 47492 KB Output is correct
80 Partially correct 835 ms 47996 KB Output is partially correct
81 Partially correct 865 ms 48016 KB Output is partially correct
82 Partially correct 334 ms 47992 KB Output is partially correct
83 Correct 369 ms 47984 KB Output is correct
84 Correct 76 ms 47820 KB Output is correct
85 Correct 1201 ms 48172 KB Output is correct
86 Correct 127 ms 47968 KB Output is correct
87 Correct 497 ms 48204 KB Output is correct
88 Correct 527 ms 48132 KB Output is correct
89 Correct 80 ms 47824 KB Output is correct
90 Correct 77 ms 47564 KB Output is correct
91 Correct 451 ms 48076 KB Output is correct
92 Correct 915 ms 48108 KB Output is correct
93 Correct 139 ms 48016 KB Output is correct
94 Partially correct 57 ms 47800 KB Output is partially correct
95 Partially correct 172 ms 47736 KB Output is partially correct
96 Correct 65 ms 47572 KB Output is correct
97 Partially correct 343 ms 47748 KB Output is partially correct
98 Partially correct 354 ms 47772 KB Output is partially correct
99 Partially correct 225 ms 47820 KB Output is partially correct
100 Partially correct 678 ms 47976 KB Output is partially correct
101 Correct 133 ms 47948 KB Output is correct
102 Correct 232 ms 48080 KB Output is correct
103 Correct 133 ms 47976 KB Output is correct
104 Correct 240 ms 47976 KB Output is correct
105 Correct 559 ms 48012 KB Output is correct
106 Correct 30 ms 47764 KB Output is correct
107 Correct 739 ms 48164 KB Output is correct
108 Correct 151 ms 47824 KB Output is correct
109 Correct 59 ms 47852 KB Output is correct
110 Correct 68 ms 47864 KB Output is correct
111 Correct 490 ms 47936 KB Output is correct
112 Partially correct 849 ms 48096 KB Output is partially correct
113 Correct 379 ms 47940 KB Output is correct
114 Correct 473 ms 48076 KB Output is correct
115 Correct 191 ms 47820 KB Output is correct
116 Correct 844 ms 48104 KB Output is correct
117 Correct 324 ms 47928 KB Output is correct
118 Correct 1008 ms 48156 KB Output is correct
119 Partially correct 375 ms 47936 KB Output is partially correct
120 Correct 702 ms 48028 KB Output is correct
121 Correct 390 ms 48212 KB Output is correct
122 Correct 392 ms 48044 KB Output is correct
123 Correct 463 ms 47920 KB Output is correct
124 Correct 490 ms 48132 KB Output is correct
125 Correct 249 ms 47936 KB Output is correct
126 Partially correct 99 ms 47844 KB Output is partially correct
127 Correct 814 ms 48212 KB Output is correct
128 Correct 23 ms 47308 KB Output is correct
129 Execution timed out 10018 ms 59048 KB Time limit exceeded
130 Halted 0 ms 0 KB -