Submission #1040634

# Submission time Handle Problem Language Result Execution time Memory
1040634 2024-08-01T07:58:04 Z erray Beech Tree (IOI23_beechtree) C++17
100 / 100
228 ms 77760 KB
#include "beechtree.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG 
  #include "/home/ioi/contests/ioi23_d2/debug.h"
#else 
  #define debug(...) void(37)
#endif

/*
template<typename T, using F = function<T(const T&, const T&)>>
struct SegTree {
  F op;
  vector<T> tree; T def;
  int n;
  SegTree(int _n, T _def, F _op) : n(_n), op(_op), def(_def) {
    tree.resize(2 * n);
  }
  T get(int l, int r) {
    T res = def;
    for (l += n, r += n + 1; l < r; l >> 1, r >> 1) {
      if (l % 2) res = op(res, tree[l++]);
      if (r % 2) res = op(res, tree[--r]);
    }
    return res;
  } 
  void modify(int p, T x) {
    for (tree[p += n] = x; p > 1; p >>= 1) {
      tree[p >> 1] = op(tree[p], tree[p ^ 1]);
    }
  }
};
*/
struct Fenwick {
  vector<int> sum;
  int n;
  Fenwick() { } 
  Fenwick(int _n) : n(_n) {
    sum.resize(n + 1);
  }
  int get(int x) {
    x += 1;
    int res = 0;
    while (x > 0) {
      res += sum[x];
      x -= x & -x;
    } 
    return res;
  }
  void modify(int x, int v) {
    x += 1;
    while (x <= n) {
      sum[x] += v;
      x += x & -x;
    }
  }
};

std::vector<int> beechtree(int N, int M, std::vector<int> P, std::vector<int> C) {
  for (auto& x : C) --x;
  vector<vector<int>> g(N);
  for (int i = 1; i < N; ++i) {
    g[P[i]].push_back(i);
  }
  vector<vector<int>> sub(N);
  vector<int> s(N, 1);
  for (int i = N - 1; i > 0; --i) {
    s[P[i]] += s[i];
    sub[P[i]].push_back(C[i]);
  }
  vector<bool> bad(N, false);
  for (int i = 0; i < N; ++i) {
    sort(sub[i].begin(), sub[i].end());
    for (int j = 0; j < int(sub[i].size()) - 1; ++j) {
      if (sub[i][j] == sub[i][j + 1]) bad[i] = true;
    }
  }
  for (int i = 0; i < N; ++i) {
    for (auto u : g[i]) {
      if (int(g[u].size()) > int(g[i].size())) bad[i] = true;
    }
  }
  vector<vector<int>> all(M);
  for (int i = 1; i < N; ++i) {
    all[C[i]].push_back(s[i]);
  }
  debug(all);
  for (int i = 0; i < M; ++i) {
    sort(all[i].begin(), all[i].end());
    all[i].erase(unique(all[i].begin(), all[i].end()), all[i].end());
  }
  vector<int> ind(N, -1);
  for (int i = 1; i < N; ++i) {
    ind[i] = int(all[C[i]].size()) - 1 - int(lower_bound(all[C[i]].begin(), all[C[i]].end(), s[i]) - all[C[i]].begin());
  }
  debug(ind);
  vector<Fenwick> fenws(M);
  for (int i = 0; i < M; ++i) {
    fenws[i] = Fenwick(int(all[i].size()));
  }
  vector<int> ct(M);
  set<array<int, 2>> sizes;
  vector<array<int, 2>> fenwick_updates;
  bool still_good = true;
  
  vector<bool> cur_color(M);
  auto Add = [&](int v) {
    int l = 0, r = N;
    for (auto u : g[v]) {
      cur_color[C[u]] = true;
    }
    {
      auto it = sizes.begin();
      while (it != sizes.end()) {
        if (!cur_color[(*it)[1]]) {
          l = -(*it)[0];
          break;
        }
        it = next(it);
      }
    }
    for (auto u : g[v]) {
      r = min(r, fenws[C[u]].get(ind[u]));
      l = max(l, fenws[C[u]].get(ind[u] - 1));
    }
    still_good &= l <= r;
    for (auto u : g[v]) {
      cur_color[C[u]] = false;
      sizes.erase({-ct[C[u]], C[u]});
      ct[C[u]]++;
      sizes.insert({-ct[C[u]], C[u]});
      fenws[C[u]].modify(ind[u], +1);
      fenwick_updates.push_back({C[u], ind[u]});
    }
  };
  auto Reset = [&] {
    still_good = true;
    sizes.clear();
    for (auto[c, x] : fenwick_updates) {
      fenws[c].modify(x, -1);
      ct[c] = 0;
    }
    fenwick_updates.clear();
  };
  auto Dfs = [&](int v, bool calculating, auto&& Dfs) -> void {
    debug(v, calculating);
    for (int i = 0; i < int(g[v].size()); ++i) {
      if (s[g[v][0]] < s[g[v][i]]) swap(g[v][0], g[v][i]);
    }
    if (calculating) {
      for (int i = int(g[v].size()) - 1; i >= 0; --i) {
        Reset();
        Dfs(g[v][i], true, Dfs);
      }
      for (int i = int(g[v].size()) - 1; i > 0; --i) {
        Dfs(g[v][i], false, Dfs);
      }
      Add(v);
      if (!still_good) bad[v] = true;
    } else {
      Add(v);
      for (auto u : g[v]) {
        Dfs(u, false, Dfs);
      }
    }
  };
  Dfs(0, true, Dfs);
  
  for (int i = N - 1; i > 0; --i) {
    if (bad[i]) bad[P[i]] = true;
  }
  vector<int> res(N);
  for (int i = 0; i < N; ++i) res[i] = 1 ^ bool(bad[i]);
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 228 ms 77760 KB Output is correct
8 Correct 148 ms 73916 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 12 ms 18844 KB Output is correct
14 Correct 12 ms 18780 KB Output is correct
15 Correct 14 ms 18868 KB Output is correct
16 Correct 13 ms 19008 KB Output is correct
17 Correct 132 ms 67772 KB Output is correct
18 Correct 99 ms 67660 KB Output is correct
19 Correct 164 ms 73848 KB Output is correct
20 Correct 201 ms 75972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 11 ms 18588 KB Output is correct
12 Correct 11 ms 18524 KB Output is correct
13 Correct 11 ms 18524 KB Output is correct
14 Correct 11 ms 18360 KB Output is correct
15 Correct 67 ms 29780 KB Output is correct
16 Correct 64 ms 29052 KB Output is correct
17 Correct 66 ms 29228 KB Output is correct
18 Correct 66 ms 29400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 228 ms 77760 KB Output is correct
6 Correct 148 ms 73916 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 11 ms 18760 KB Output is correct
10 Correct 12 ms 18524 KB Output is correct
11 Correct 178 ms 50508 KB Output is correct
12 Correct 196 ms 45264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 436 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 2 ms 856 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 1 ms 860 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 12 ms 18844 KB Output is correct
43 Correct 12 ms 18780 KB Output is correct
44 Correct 14 ms 18868 KB Output is correct
45 Correct 13 ms 19008 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 11 ms 18588 KB Output is correct
57 Correct 11 ms 18524 KB Output is correct
58 Correct 11 ms 18524 KB Output is correct
59 Correct 11 ms 18360 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 11 ms 18760 KB Output is correct
63 Correct 12 ms 18524 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 436 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 1 ms 860 KB Output is correct
76 Correct 2 ms 856 KB Output is correct
77 Correct 1 ms 860 KB Output is correct
78 Correct 1 ms 860 KB Output is correct
79 Correct 1 ms 860 KB Output is correct
80 Correct 1 ms 604 KB Output is correct
81 Correct 1 ms 604 KB Output is correct
82 Correct 1 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 2 ms 604 KB Output is correct
86 Correct 1 ms 604 KB Output is correct
87 Correct 1 ms 604 KB Output is correct
88 Correct 1 ms 604 KB Output is correct
89 Correct 12 ms 18780 KB Output is correct
90 Correct 11 ms 18700 KB Output is correct
91 Correct 13 ms 18524 KB Output is correct
92 Correct 14 ms 18524 KB Output is correct
93 Correct 12 ms 18524 KB Output is correct
94 Correct 11 ms 18524 KB Output is correct
95 Correct 13 ms 18684 KB Output is correct
96 Correct 11 ms 18524 KB Output is correct
97 Correct 12 ms 18772 KB Output is correct
98 Correct 13 ms 18780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 2 ms 856 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 1 ms 860 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 79 ms 49588 KB Output is correct
40 Correct 84 ms 49740 KB Output is correct
41 Correct 83 ms 49704 KB Output is correct
42 Correct 93 ms 49620 KB Output is correct
43 Correct 80 ms 42476 KB Output is correct
44 Correct 93 ms 32580 KB Output is correct
45 Correct 174 ms 26564 KB Output is correct
46 Correct 133 ms 25988 KB Output is correct
47 Correct 114 ms 25956 KB Output is correct
48 Correct 103 ms 25920 KB Output is correct
49 Correct 87 ms 25472 KB Output is correct
50 Correct 156 ms 23868 KB Output is correct
51 Correct 137 ms 23872 KB Output is correct
52 Correct 118 ms 23976 KB Output is correct
53 Correct 105 ms 23920 KB Output is correct
54 Correct 80 ms 22844 KB Output is correct
55 Correct 70 ms 30808 KB Output is correct
56 Correct 71 ms 31044 KB Output is correct
57 Correct 83 ms 24632 KB Output is correct
58 Correct 82 ms 23988 KB Output is correct
59 Correct 78 ms 24004 KB Output is correct
60 Correct 74 ms 23868 KB Output is correct
61 Correct 77 ms 23696 KB Output is correct
62 Correct 77 ms 23876 KB Output is correct
63 Correct 76 ms 28872 KB Output is correct
64 Correct 89 ms 31032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 228 ms 77760 KB Output is correct
39 Correct 148 ms 73916 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 12 ms 18844 KB Output is correct
45 Correct 12 ms 18780 KB Output is correct
46 Correct 14 ms 18868 KB Output is correct
47 Correct 13 ms 19008 KB Output is correct
48 Correct 132 ms 67772 KB Output is correct
49 Correct 99 ms 67660 KB Output is correct
50 Correct 164 ms 73848 KB Output is correct
51 Correct 201 ms 75972 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 11 ms 18588 KB Output is correct
63 Correct 11 ms 18524 KB Output is correct
64 Correct 11 ms 18524 KB Output is correct
65 Correct 11 ms 18360 KB Output is correct
66 Correct 67 ms 29780 KB Output is correct
67 Correct 64 ms 29052 KB Output is correct
68 Correct 66 ms 29228 KB Output is correct
69 Correct 66 ms 29400 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 11 ms 18760 KB Output is correct
73 Correct 12 ms 18524 KB Output is correct
74 Correct 178 ms 50508 KB Output is correct
75 Correct 196 ms 45264 KB Output is correct
76 Correct 0 ms 344 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 436 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 1 ms 860 KB Output is correct
88 Correct 2 ms 856 KB Output is correct
89 Correct 1 ms 860 KB Output is correct
90 Correct 1 ms 860 KB Output is correct
91 Correct 1 ms 860 KB Output is correct
92 Correct 1 ms 604 KB Output is correct
93 Correct 1 ms 604 KB Output is correct
94 Correct 1 ms 604 KB Output is correct
95 Correct 1 ms 604 KB Output is correct
96 Correct 1 ms 604 KB Output is correct
97 Correct 2 ms 604 KB Output is correct
98 Correct 1 ms 604 KB Output is correct
99 Correct 1 ms 604 KB Output is correct
100 Correct 1 ms 604 KB Output is correct
101 Correct 12 ms 18780 KB Output is correct
102 Correct 11 ms 18700 KB Output is correct
103 Correct 13 ms 18524 KB Output is correct
104 Correct 14 ms 18524 KB Output is correct
105 Correct 12 ms 18524 KB Output is correct
106 Correct 11 ms 18524 KB Output is correct
107 Correct 13 ms 18684 KB Output is correct
108 Correct 11 ms 18524 KB Output is correct
109 Correct 12 ms 18772 KB Output is correct
110 Correct 13 ms 18780 KB Output is correct
111 Correct 79 ms 49588 KB Output is correct
112 Correct 84 ms 49740 KB Output is correct
113 Correct 83 ms 49704 KB Output is correct
114 Correct 93 ms 49620 KB Output is correct
115 Correct 80 ms 42476 KB Output is correct
116 Correct 93 ms 32580 KB Output is correct
117 Correct 174 ms 26564 KB Output is correct
118 Correct 133 ms 25988 KB Output is correct
119 Correct 114 ms 25956 KB Output is correct
120 Correct 103 ms 25920 KB Output is correct
121 Correct 87 ms 25472 KB Output is correct
122 Correct 156 ms 23868 KB Output is correct
123 Correct 137 ms 23872 KB Output is correct
124 Correct 118 ms 23976 KB Output is correct
125 Correct 105 ms 23920 KB Output is correct
126 Correct 80 ms 22844 KB Output is correct
127 Correct 70 ms 30808 KB Output is correct
128 Correct 71 ms 31044 KB Output is correct
129 Correct 83 ms 24632 KB Output is correct
130 Correct 82 ms 23988 KB Output is correct
131 Correct 78 ms 24004 KB Output is correct
132 Correct 74 ms 23868 KB Output is correct
133 Correct 77 ms 23696 KB Output is correct
134 Correct 77 ms 23876 KB Output is correct
135 Correct 76 ms 28872 KB Output is correct
136 Correct 89 ms 31032 KB Output is correct
137 Correct 106 ms 59332 KB Output is correct
138 Correct 110 ms 53952 KB Output is correct
139 Correct 173 ms 46484 KB Output is correct
140 Correct 155 ms 46796 KB Output is correct
141 Correct 142 ms 46892 KB Output is correct
142 Correct 142 ms 47296 KB Output is correct
143 Correct 146 ms 47852 KB Output is correct
144 Correct 148 ms 41724 KB Output is correct
145 Correct 153 ms 41696 KB Output is correct
146 Correct 135 ms 42952 KB Output is correct
147 Correct 128 ms 44836 KB Output is correct
148 Correct 130 ms 44348 KB Output is correct
149 Correct 92 ms 51008 KB Output is correct
150 Correct 86 ms 51132 KB Output is correct
151 Correct 91 ms 45060 KB Output is correct
152 Correct 93 ms 44612 KB Output is correct
153 Correct 95 ms 44448 KB Output is correct
154 Correct 91 ms 45380 KB Output is correct
155 Correct 95 ms 44324 KB Output is correct
156 Correct 98 ms 44348 KB Output is correct
157 Correct 99 ms 49352 KB Output is correct
158 Correct 122 ms 51772 KB Output is correct