Submission #631078

# Submission time Handle Problem Language Result Execution time Memory
631078 2022-08-17T16:38:35 Z abeker Radio Towers (IOI22_towers) C++17
100 / 100
2583 ms 69480 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;

const int INF = INT_MAX;

class Orthogonal {
  int offset;
  vector <vector <int>> tour;
public:
  Orthogonal(vector <int> vals) {
    for (offset = 1; offset < vals.size(); offset *= 2);
    tour.resize(2 * offset);
    for (int i = 1; i < vals.size(); i++)
      tour[i + offset].push_back(vals[i]);
    for (int i = offset - 1; i; i--) {
      tour[i].resize(tour[2 * i].size() + tour[2 * i + 1].size());
      merge(tour[2 * i].begin(), tour[2 * i].end(), tour[2 * i + 1].begin(), tour[2 * i + 1].end(), tour[i].begin());
    }
  }
  Orthogonal() {}
  int query(int x, int lo, int hi, int from, int to, int val) {
    if (lo >= to || hi <= from)
      return 0;
    if (lo >= from && hi <= to)
      return lower_bound(tour[x].begin(), tour[x].end(), val) - tour[x].begin();
    int mid = (lo + hi) / 2;
    return query(2 * x, lo, mid, from, to, val) + query(2 * x + 1, mid, hi, from, to, val);
  }
  int query(int from, int to, int val) {
    return query(1, 0, offset, from, to, val);
  }
};

int N, lg;
vector <int> H;
vector <int> ex;
vector <int> lb, ub;
vector <vector <int>> mini;
vector <vector <int>> lft, rig;
Orthogonal count_lb, count_ub;

int query(int from, int to) {
  if (from >= to)
    return INF;
  int tmp = ex[to - from];
  return min(mini[from][tmp], mini[to - (1 << tmp)][tmp]);
}

void init_sparse() {
  mini.resize(N + 1, vector <int> (lg + 1));
  for (int i = 1; i <= N; i++)
    mini[i][0] = H[i];
  for (int j = 1; j <= lg; j++)
    for (int i = 1; i <= N; i++)
      mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
  ex.resize(N + 1);
  for (int i = 2; i <= N; i++)
    ex[i] = ex[i / 2] + 1;
}

void init_lft_rig() {
  lft.resize(N + 2, vector <int> (lg + 1));
  rig.resize(N + 2, vector <int> (lg + 1));
  stack <int> s;
  s.push(0);
  for (int i = 1; i <= N; i++) {
    while (H[s.top()] < H[i])
      s.pop();
    lft[i][0] = s.top();
    s.push(i);
  }
  s = stack <int> ();
  s.push(N + 1);
  for (int i = N; i; i--) {
    while (H[s.top()] < H[i])
      s.pop();
    rig[i][0] = s.top();
    s.push(i);
  }
  rig[N + 1] = vector <int> (lg + 1, N + 1);
  for (int j = 1; j <= lg; j++)
    for (int i = 1; i <= N; i++) {
      lft[i][j] = lft[lft[i][j - 1]][j - 1];
      rig[i][j] = rig[rig[i][j - 1]][j - 1];
    }
}

void init_lb_ub() {
  lb.resize(N + 1);
  ub.resize(N + 1);
  for (int i = 1; i <= N; i++) {
    int tmp = query(lft[i][0] + 1, rig[i][0]);
    lb[i] = H[i] - tmp;
    ub[i] = min(H[lft[i][0]], H[rig[i][0]]) - tmp;
  }
  count_lb = Orthogonal(lb);
  count_ub = Orthogonal(ub);
}

void init(int n, vector <int> h) {
  N = n;
  H.resize(N + 2);
  H[0] = H[N + 1] = INF;
  for (int i = 1; i <= N; i++)
    H[i] = h[i - 1];
  while (1 << lg < N)
    lg++;
  init_sparse();
  init_lft_rig();
  init_lb_ub();
}

int max_towers(int l, int r, int d) {
  l += 1;
  r += 1;
  int smaller_lb = count_lb.query(l, r + 1, d);
  int smaller_ub = count_ub.query(l, r + 1, d);
  auto binary = [&](int x, const function <bool(int)> &check, const vector <vector <int>> &anc) -> pair <int, int> {
    if (!check(x))
      return {0, x};
    int res = 0;
    for (int i = lg; i >= 0; i--)
      if (check(anc[x][i])) {
        x = anc[x][i];
        res |= 1 << i;
      }
    return {res + 1, anc[x][0]};
  };
  auto lb_lft_plus = [&](int node) {
    return rig[node][0] <= r && H[node] - query(l, rig[node][0]) < d;
  };
  auto lb_rig_plus = [&](int node) {
    return lft[node][0] >= l && H[node] - query(lft[node][0] + 1, r + 1) < d;
  };
  auto lb_lft_minus = [&](int node) {
    return rig[node][0] <= r && lb[node] < d;
  };
  auto lb_rig_minus = [&](int node) {
    return lft[node][0] >= l && lb[node] < d;
  };
  auto ub_lft_plus = [&](int node) {
    return rig[node][0] <= r && H[rig[node][0]] - query(l, rig[node][0]) < d;
  };
  auto ub_rig_plus = [&](int node) {
    return lft[node][0] >= l && H[lft[node][0]] - query(lft[node][0] + 1, r + 1) < d;
  };
  auto ub_lft_minus = [&](int node) {
    return rig[node][0] <= r && ub[node] < d;
  };
  auto ub_rig_minus = [&](int node) {
    return lft[node][0] >= l && ub[node] < d;
  };
  auto check_mx = [&](int node) {
    return rig[node][0] <= r;
  };
  smaller_lb += binary(l, lb_lft_plus, rig).first + binary(r, lb_rig_plus, lft).first - binary(l, lb_lft_minus, rig).first - binary(r, lb_rig_minus, lft).first;
  smaller_ub += binary(l, ub_lft_plus, rig).first + binary(r, ub_rig_plus, lft).first - binary(l, ub_lft_minus, rig).first - binary(r, ub_rig_minus, lft).first;
  int arg_max = binary(l, check_mx, rig).second;
  smaller_lb -= lb[arg_max] < d;
  smaller_lb += H[arg_max] - query(l, r + 1) < d;
  smaller_ub -= ub[arg_max] < d;
  return smaller_lb - smaller_ub;
}

Compilation message

towers.cpp: In constructor 'Orthogonal::Orthogonal(std::vector<int>)':
towers.cpp:12:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (offset = 1; offset < vals.size(); offset *= 2);
      |                      ~~~~~~~^~~~~~~~~~~~~
towers.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 1; i < vals.size(); i++)
      |                     ~~^~~~~~~~~~~~~
towers.cpp: In function 'void init_sparse()':
towers.cpp:56:52: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   56 |       mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
      |                                                  ~~^~~
towers.cpp:56:86: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   56 |       mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
      |                                                                                    ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1127 ms 39744 KB Output is correct
2 Correct 2272 ms 69372 KB Output is correct
3 Correct 2427 ms 69272 KB Output is correct
4 Correct 2380 ms 69332 KB Output is correct
5 Correct 2013 ms 69344 KB Output is correct
6 Correct 1696 ms 69360 KB Output is correct
7 Correct 1514 ms 69320 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1436 KB Output is correct
5 Correct 2 ms 1424 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1372 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 3 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 3 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 2 ms 1360 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 2 ms 1360 KB Output is correct
27 Correct 2 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1384 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1436 KB Output is correct
5 Correct 2 ms 1424 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1372 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 3 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 3 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 2 ms 1360 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 2 ms 1360 KB Output is correct
27 Correct 2 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1384 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 93 ms 42792 KB Output is correct
37 Correct 125 ms 69308 KB Output is correct
38 Correct 123 ms 69356 KB Output is correct
39 Correct 119 ms 69280 KB Output is correct
40 Correct 136 ms 69340 KB Output is correct
41 Correct 125 ms 69372 KB Output is correct
42 Correct 118 ms 69284 KB Output is correct
43 Correct 116 ms 69308 KB Output is correct
44 Correct 123 ms 69384 KB Output is correct
45 Correct 113 ms 69348 KB Output is correct
46 Correct 127 ms 69284 KB Output is correct
47 Correct 129 ms 69320 KB Output is correct
48 Correct 121 ms 69360 KB Output is correct
49 Correct 122 ms 69356 KB Output is correct
50 Correct 122 ms 69376 KB Output is correct
51 Correct 116 ms 69348 KB Output is correct
52 Correct 127 ms 69360 KB Output is correct
53 Correct 119 ms 69340 KB Output is correct
54 Correct 127 ms 69252 KB Output is correct
55 Correct 115 ms 69388 KB Output is correct
56 Correct 110 ms 69460 KB Output is correct
57 Correct 120 ms 67532 KB Output is correct
58 Correct 136 ms 69316 KB Output is correct
59 Correct 134 ms 69352 KB Output is correct
60 Correct 120 ms 69424 KB Output is correct
61 Correct 122 ms 69284 KB Output is correct
62 Correct 124 ms 69368 KB Output is correct
63 Correct 121 ms 69268 KB Output is correct
64 Correct 112 ms 69360 KB Output is correct
65 Correct 126 ms 69264 KB Output is correct
66 Correct 107 ms 69360 KB Output is correct
67 Correct 114 ms 69288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1256 ms 68988 KB Output is correct
2 Correct 1533 ms 69392 KB Output is correct
3 Correct 1621 ms 69348 KB Output is correct
4 Correct 1540 ms 69312 KB Output is correct
5 Correct 1530 ms 69264 KB Output is correct
6 Correct 1640 ms 69392 KB Output is correct
7 Correct 1685 ms 69312 KB Output is correct
8 Correct 1786 ms 69308 KB Output is correct
9 Correct 1603 ms 69364 KB Output is correct
10 Correct 2008 ms 69380 KB Output is correct
11 Correct 1916 ms 69372 KB Output is correct
12 Correct 1924 ms 69280 KB Output is correct
13 Correct 1882 ms 69404 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 3 ms 1360 KB Output is correct
16 Correct 3 ms 1408 KB Output is correct
17 Correct 147 ms 69392 KB Output is correct
18 Correct 149 ms 69268 KB Output is correct
19 Correct 146 ms 69324 KB Output is correct
20 Correct 144 ms 69320 KB Output is correct
21 Correct 131 ms 69428 KB Output is correct
22 Correct 143 ms 69316 KB Output is correct
23 Correct 127 ms 69288 KB Output is correct
24 Correct 132 ms 69320 KB Output is correct
25 Correct 133 ms 69284 KB Output is correct
26 Correct 135 ms 69364 KB Output is correct
27 Correct 3 ms 1360 KB Output is correct
28 Correct 3 ms 1360 KB Output is correct
29 Correct 3 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 3 ms 1356 KB Output is correct
36 Correct 3 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 528 ms 16560 KB Output is correct
2 Correct 1744 ms 69360 KB Output is correct
3 Correct 1658 ms 69372 KB Output is correct
4 Correct 1684 ms 69348 KB Output is correct
5 Correct 1566 ms 69292 KB Output is correct
6 Correct 1499 ms 69284 KB Output is correct
7 Correct 1532 ms 69292 KB Output is correct
8 Correct 1998 ms 69328 KB Output is correct
9 Correct 2036 ms 69392 KB Output is correct
10 Correct 1654 ms 69364 KB Output is correct
11 Correct 1457 ms 69376 KB Output is correct
12 Correct 171 ms 69372 KB Output is correct
13 Correct 153 ms 69288 KB Output is correct
14 Correct 147 ms 69256 KB Output is correct
15 Correct 146 ms 69368 KB Output is correct
16 Correct 154 ms 69312 KB Output is correct
17 Correct 147 ms 67412 KB Output is correct
18 Correct 136 ms 69304 KB Output is correct
19 Correct 141 ms 69364 KB Output is correct
20 Correct 143 ms 69284 KB Output is correct
21 Correct 160 ms 69372 KB Output is correct
22 Correct 164 ms 69256 KB Output is correct
23 Correct 137 ms 69368 KB Output is correct
24 Correct 124 ms 69344 KB Output is correct
25 Correct 163 ms 69272 KB Output is correct
26 Correct 155 ms 69272 KB Output is correct
27 Correct 130 ms 69264 KB Output is correct
28 Correct 2 ms 1380 KB Output is correct
29 Correct 4 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 3 ms 1408 KB Output is correct
32 Correct 3 ms 1408 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 3 ms 1360 KB Output is correct
35 Correct 3 ms 1360 KB Output is correct
36 Correct 3 ms 1360 KB Output is correct
37 Correct 3 ms 1360 KB Output is correct
38 Correct 2 ms 1360 KB Output is correct
39 Correct 3 ms 1408 KB Output is correct
40 Correct 3 ms 1360 KB Output is correct
41 Correct 3 ms 1408 KB Output is correct
42 Correct 3 ms 1396 KB Output is correct
43 Correct 2 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1436 KB Output is correct
5 Correct 2 ms 1424 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1372 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 3 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 3 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 2 ms 1360 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 2 ms 1360 KB Output is correct
27 Correct 2 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1384 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 93 ms 42792 KB Output is correct
37 Correct 125 ms 69308 KB Output is correct
38 Correct 123 ms 69356 KB Output is correct
39 Correct 119 ms 69280 KB Output is correct
40 Correct 136 ms 69340 KB Output is correct
41 Correct 125 ms 69372 KB Output is correct
42 Correct 118 ms 69284 KB Output is correct
43 Correct 116 ms 69308 KB Output is correct
44 Correct 123 ms 69384 KB Output is correct
45 Correct 113 ms 69348 KB Output is correct
46 Correct 127 ms 69284 KB Output is correct
47 Correct 129 ms 69320 KB Output is correct
48 Correct 121 ms 69360 KB Output is correct
49 Correct 122 ms 69356 KB Output is correct
50 Correct 122 ms 69376 KB Output is correct
51 Correct 116 ms 69348 KB Output is correct
52 Correct 127 ms 69360 KB Output is correct
53 Correct 119 ms 69340 KB Output is correct
54 Correct 127 ms 69252 KB Output is correct
55 Correct 115 ms 69388 KB Output is correct
56 Correct 110 ms 69460 KB Output is correct
57 Correct 120 ms 67532 KB Output is correct
58 Correct 136 ms 69316 KB Output is correct
59 Correct 134 ms 69352 KB Output is correct
60 Correct 120 ms 69424 KB Output is correct
61 Correct 122 ms 69284 KB Output is correct
62 Correct 124 ms 69368 KB Output is correct
63 Correct 121 ms 69268 KB Output is correct
64 Correct 112 ms 69360 KB Output is correct
65 Correct 126 ms 69264 KB Output is correct
66 Correct 107 ms 69360 KB Output is correct
67 Correct 114 ms 69288 KB Output is correct
68 Correct 1256 ms 68988 KB Output is correct
69 Correct 1533 ms 69392 KB Output is correct
70 Correct 1621 ms 69348 KB Output is correct
71 Correct 1540 ms 69312 KB Output is correct
72 Correct 1530 ms 69264 KB Output is correct
73 Correct 1640 ms 69392 KB Output is correct
74 Correct 1685 ms 69312 KB Output is correct
75 Correct 1786 ms 69308 KB Output is correct
76 Correct 1603 ms 69364 KB Output is correct
77 Correct 2008 ms 69380 KB Output is correct
78 Correct 1916 ms 69372 KB Output is correct
79 Correct 1924 ms 69280 KB Output is correct
80 Correct 1882 ms 69404 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 3 ms 1360 KB Output is correct
83 Correct 3 ms 1408 KB Output is correct
84 Correct 147 ms 69392 KB Output is correct
85 Correct 149 ms 69268 KB Output is correct
86 Correct 146 ms 69324 KB Output is correct
87 Correct 144 ms 69320 KB Output is correct
88 Correct 131 ms 69428 KB Output is correct
89 Correct 143 ms 69316 KB Output is correct
90 Correct 127 ms 69288 KB Output is correct
91 Correct 132 ms 69320 KB Output is correct
92 Correct 133 ms 69284 KB Output is correct
93 Correct 135 ms 69364 KB Output is correct
94 Correct 3 ms 1360 KB Output is correct
95 Correct 3 ms 1360 KB Output is correct
96 Correct 3 ms 1360 KB Output is correct
97 Correct 2 ms 1360 KB Output is correct
98 Correct 2 ms 1360 KB Output is correct
99 Correct 2 ms 1360 KB Output is correct
100 Correct 2 ms 1360 KB Output is correct
101 Correct 2 ms 1360 KB Output is correct
102 Correct 3 ms 1356 KB Output is correct
103 Correct 3 ms 1360 KB Output is correct
104 Correct 1596 ms 63008 KB Output is correct
105 Correct 2021 ms 69356 KB Output is correct
106 Correct 2437 ms 69364 KB Output is correct
107 Correct 2213 ms 69280 KB Output is correct
108 Correct 2021 ms 69344 KB Output is correct
109 Correct 2055 ms 69364 KB Output is correct
110 Correct 1777 ms 69256 KB Output is correct
111 Correct 2009 ms 69480 KB Output is correct
112 Correct 1863 ms 69348 KB Output is correct
113 Correct 1958 ms 69300 KB Output is correct
114 Correct 1980 ms 69312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1127 ms 39744 KB Output is correct
2 Correct 2272 ms 69372 KB Output is correct
3 Correct 2427 ms 69272 KB Output is correct
4 Correct 2380 ms 69332 KB Output is correct
5 Correct 2013 ms 69344 KB Output is correct
6 Correct 1696 ms 69360 KB Output is correct
7 Correct 1514 ms 69320 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 2 ms 1360 KB Output is correct
13 Correct 2 ms 1360 KB Output is correct
14 Correct 2 ms 1436 KB Output is correct
15 Correct 2 ms 1424 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 2 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 2 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 2 ms 1372 KB Output is correct
24 Correct 2 ms 1360 KB Output is correct
25 Correct 2 ms 1360 KB Output is correct
26 Correct 2 ms 1360 KB Output is correct
27 Correct 3 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 3 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 2 ms 1360 KB Output is correct
37 Correct 2 ms 1360 KB Output is correct
38 Correct 2 ms 1360 KB Output is correct
39 Correct 2 ms 1360 KB Output is correct
40 Correct 2 ms 1360 KB Output is correct
41 Correct 2 ms 1360 KB Output is correct
42 Correct 2 ms 1360 KB Output is correct
43 Correct 2 ms 1384 KB Output is correct
44 Correct 2 ms 1360 KB Output is correct
45 Correct 2 ms 1360 KB Output is correct
46 Correct 93 ms 42792 KB Output is correct
47 Correct 125 ms 69308 KB Output is correct
48 Correct 123 ms 69356 KB Output is correct
49 Correct 119 ms 69280 KB Output is correct
50 Correct 136 ms 69340 KB Output is correct
51 Correct 125 ms 69372 KB Output is correct
52 Correct 118 ms 69284 KB Output is correct
53 Correct 116 ms 69308 KB Output is correct
54 Correct 123 ms 69384 KB Output is correct
55 Correct 113 ms 69348 KB Output is correct
56 Correct 127 ms 69284 KB Output is correct
57 Correct 129 ms 69320 KB Output is correct
58 Correct 121 ms 69360 KB Output is correct
59 Correct 122 ms 69356 KB Output is correct
60 Correct 122 ms 69376 KB Output is correct
61 Correct 116 ms 69348 KB Output is correct
62 Correct 127 ms 69360 KB Output is correct
63 Correct 119 ms 69340 KB Output is correct
64 Correct 127 ms 69252 KB Output is correct
65 Correct 115 ms 69388 KB Output is correct
66 Correct 110 ms 69460 KB Output is correct
67 Correct 120 ms 67532 KB Output is correct
68 Correct 136 ms 69316 KB Output is correct
69 Correct 134 ms 69352 KB Output is correct
70 Correct 120 ms 69424 KB Output is correct
71 Correct 122 ms 69284 KB Output is correct
72 Correct 124 ms 69368 KB Output is correct
73 Correct 121 ms 69268 KB Output is correct
74 Correct 112 ms 69360 KB Output is correct
75 Correct 126 ms 69264 KB Output is correct
76 Correct 107 ms 69360 KB Output is correct
77 Correct 114 ms 69288 KB Output is correct
78 Correct 1256 ms 68988 KB Output is correct
79 Correct 1533 ms 69392 KB Output is correct
80 Correct 1621 ms 69348 KB Output is correct
81 Correct 1540 ms 69312 KB Output is correct
82 Correct 1530 ms 69264 KB Output is correct
83 Correct 1640 ms 69392 KB Output is correct
84 Correct 1685 ms 69312 KB Output is correct
85 Correct 1786 ms 69308 KB Output is correct
86 Correct 1603 ms 69364 KB Output is correct
87 Correct 2008 ms 69380 KB Output is correct
88 Correct 1916 ms 69372 KB Output is correct
89 Correct 1924 ms 69280 KB Output is correct
90 Correct 1882 ms 69404 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 3 ms 1360 KB Output is correct
93 Correct 3 ms 1408 KB Output is correct
94 Correct 147 ms 69392 KB Output is correct
95 Correct 149 ms 69268 KB Output is correct
96 Correct 146 ms 69324 KB Output is correct
97 Correct 144 ms 69320 KB Output is correct
98 Correct 131 ms 69428 KB Output is correct
99 Correct 143 ms 69316 KB Output is correct
100 Correct 127 ms 69288 KB Output is correct
101 Correct 132 ms 69320 KB Output is correct
102 Correct 133 ms 69284 KB Output is correct
103 Correct 135 ms 69364 KB Output is correct
104 Correct 3 ms 1360 KB Output is correct
105 Correct 3 ms 1360 KB Output is correct
106 Correct 3 ms 1360 KB Output is correct
107 Correct 2 ms 1360 KB Output is correct
108 Correct 2 ms 1360 KB Output is correct
109 Correct 2 ms 1360 KB Output is correct
110 Correct 2 ms 1360 KB Output is correct
111 Correct 2 ms 1360 KB Output is correct
112 Correct 3 ms 1356 KB Output is correct
113 Correct 3 ms 1360 KB Output is correct
114 Correct 528 ms 16560 KB Output is correct
115 Correct 1744 ms 69360 KB Output is correct
116 Correct 1658 ms 69372 KB Output is correct
117 Correct 1684 ms 69348 KB Output is correct
118 Correct 1566 ms 69292 KB Output is correct
119 Correct 1499 ms 69284 KB Output is correct
120 Correct 1532 ms 69292 KB Output is correct
121 Correct 1998 ms 69328 KB Output is correct
122 Correct 2036 ms 69392 KB Output is correct
123 Correct 1654 ms 69364 KB Output is correct
124 Correct 1457 ms 69376 KB Output is correct
125 Correct 171 ms 69372 KB Output is correct
126 Correct 153 ms 69288 KB Output is correct
127 Correct 147 ms 69256 KB Output is correct
128 Correct 146 ms 69368 KB Output is correct
129 Correct 154 ms 69312 KB Output is correct
130 Correct 147 ms 67412 KB Output is correct
131 Correct 136 ms 69304 KB Output is correct
132 Correct 141 ms 69364 KB Output is correct
133 Correct 143 ms 69284 KB Output is correct
134 Correct 160 ms 69372 KB Output is correct
135 Correct 164 ms 69256 KB Output is correct
136 Correct 137 ms 69368 KB Output is correct
137 Correct 124 ms 69344 KB Output is correct
138 Correct 163 ms 69272 KB Output is correct
139 Correct 155 ms 69272 KB Output is correct
140 Correct 130 ms 69264 KB Output is correct
141 Correct 2 ms 1380 KB Output is correct
142 Correct 4 ms 1360 KB Output is correct
143 Correct 2 ms 1360 KB Output is correct
144 Correct 3 ms 1408 KB Output is correct
145 Correct 3 ms 1408 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 3 ms 1360 KB Output is correct
148 Correct 3 ms 1360 KB Output is correct
149 Correct 3 ms 1360 KB Output is correct
150 Correct 3 ms 1360 KB Output is correct
151 Correct 2 ms 1360 KB Output is correct
152 Correct 3 ms 1408 KB Output is correct
153 Correct 3 ms 1360 KB Output is correct
154 Correct 3 ms 1408 KB Output is correct
155 Correct 3 ms 1396 KB Output is correct
156 Correct 2 ms 1360 KB Output is correct
157 Correct 1596 ms 63008 KB Output is correct
158 Correct 2021 ms 69356 KB Output is correct
159 Correct 2437 ms 69364 KB Output is correct
160 Correct 2213 ms 69280 KB Output is correct
161 Correct 2021 ms 69344 KB Output is correct
162 Correct 2055 ms 69364 KB Output is correct
163 Correct 1777 ms 69256 KB Output is correct
164 Correct 2009 ms 69480 KB Output is correct
165 Correct 1863 ms 69348 KB Output is correct
166 Correct 1958 ms 69300 KB Output is correct
167 Correct 1980 ms 69312 KB Output is correct
168 Correct 1 ms 208 KB Output is correct
169 Correct 1161 ms 25876 KB Output is correct
170 Correct 2088 ms 69304 KB Output is correct
171 Correct 2098 ms 69296 KB Output is correct
172 Correct 2283 ms 69268 KB Output is correct
173 Correct 1855 ms 69356 KB Output is correct
174 Correct 2185 ms 69360 KB Output is correct
175 Correct 2177 ms 69300 KB Output is correct
176 Correct 2273 ms 69384 KB Output is correct
177 Correct 2583 ms 69304 KB Output is correct
178 Correct 2162 ms 69396 KB Output is correct
179 Correct 2465 ms 69308 KB Output is correct