Submission #631223

# Submission time Handle Problem Language Result Execution time Memory
631223 2022-08-17T21:00:52 Z abeker Radio Towers (IOI22_towers) C++17
100 / 100
2315 ms 229444 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;

const int INF = 2e9;

struct Node {
  int cnt;
  Node *l, *r;
  Node(int cnt, Node* l, Node* r) : cnt(cnt), l(l), r(r) {}
  Node() : cnt(0), l(nullptr), r(nullptr) {}
};

class Persistent {
  int offset;
  vector <Node*> root;
  Node* NIL;
public:
  Node* update(Node* x, int lo, int hi, int pos) {
    if (pos < lo || pos >= hi)
      return x;
    if (hi - lo == 1)
      return new Node(x -> cnt + 1, NIL, NIL);
    int mid = lo + (hi - lo) / 2;
    Node* lft = update(x -> l, lo, mid, pos);
    Node* rig = update(x -> r, mid, hi, pos);
    return new Node(lft -> cnt + rig -> cnt, lft, rig);
  }
  Persistent(vector <int> vals) {
    NIL = new Node();
    NIL -> l = NIL -> r = NIL;
    root.push_back(NIL);
    for (auto &it : vals)
      it = min(it, INF / 2);
    int mx = *max_element(vals.begin(), vals.end());
    for (offset = 1; offset < mx; offset *= 2);
    for (int i = 1; i < vals.size(); i++)
      root.push_back(update(root.back(), 0, offset, vals[i]));
  }
  Persistent() {}
  int query(Node* x, int lo, int hi, int from, int to) const {
    if (lo >= to || hi <= from)
      return 0;
    if (lo >= from && hi <= to)
      return x -> cnt;
    int mid = lo + (hi - lo) / 2;
    return query(x -> l, lo, mid, from, to) + query(x -> r, mid, hi, from, to);
  }
  int query(Node* x, int to) const {
    return query(x, 0, offset, 0, to);
  }
  int get(int from, int to, int val) const {
    return query(root[to - 1], val) - query(root[from - 1], val);
  }
};

int N, lg;
vector <int> H;
vector <int> ex;
vector <int> lb, ub;
vector <vector <int>> mini;
vector <vector <int>> lft, rig;
Persistent 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 = Persistent(lb);
  count_ub = Persistent(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.get(l, r + 1, d);
  int smaller_ub = count_ub.get(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 'Persistent::Persistent(std::vector<int>)':
towers.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for (int i = 1; i < vals.size(); i++)
      |                     ~~^~~~~~~~~~~~~
towers.cpp: In function 'void init_sparse()':
towers.cpp:78:52: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   78 |       mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
      |                                                  ~~^~~
towers.cpp:78:86: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   78 |       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 1096 ms 136752 KB Output is correct
2 Correct 2315 ms 229232 KB Output is correct
3 Correct 1793 ms 229244 KB Output is correct
4 Correct 2033 ms 229240 KB Output is correct
5 Correct 2071 ms 229184 KB Output is correct
6 Correct 1556 ms 229388 KB Output is correct
7 Correct 1723 ms 229240 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 4688 KB Output is correct
10 Correct 6 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1232 KB Output is correct
2 Correct 6 ms 4688 KB Output is correct
3 Correct 9 ms 4772 KB Output is correct
4 Correct 8 ms 4688 KB Output is correct
5 Correct 7 ms 4688 KB Output is correct
6 Correct 9 ms 4688 KB Output is correct
7 Correct 6 ms 4720 KB Output is correct
8 Correct 8 ms 4688 KB Output is correct
9 Correct 6 ms 4688 KB Output is correct
10 Correct 6 ms 4732 KB Output is correct
11 Correct 6 ms 4688 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 9 ms 4688 KB Output is correct
14 Correct 7 ms 4688 KB Output is correct
15 Correct 6 ms 4688 KB Output is correct
16 Correct 6 ms 4732 KB Output is correct
17 Correct 7 ms 4676 KB Output is correct
18 Correct 7 ms 4672 KB Output is correct
19 Correct 6 ms 4748 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 6 ms 4688 KB Output is correct
22 Correct 6 ms 4688 KB Output is correct
23 Correct 6 ms 4688 KB Output is correct
24 Correct 6 ms 4784 KB Output is correct
25 Correct 3 ms 2256 KB Output is correct
26 Correct 6 ms 4688 KB Output is correct
27 Correct 6 ms 4688 KB Output is correct
28 Correct 8 ms 4688 KB Output is correct
29 Correct 6 ms 4688 KB Output is correct
30 Correct 6 ms 4688 KB Output is correct
31 Correct 7 ms 4776 KB Output is correct
32 Correct 6 ms 4688 KB Output is correct
33 Correct 6 ms 4688 KB Output is correct
34 Correct 7 ms 4688 KB Output is correct
35 Correct 6 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1232 KB Output is correct
2 Correct 6 ms 4688 KB Output is correct
3 Correct 9 ms 4772 KB Output is correct
4 Correct 8 ms 4688 KB Output is correct
5 Correct 7 ms 4688 KB Output is correct
6 Correct 9 ms 4688 KB Output is correct
7 Correct 6 ms 4720 KB Output is correct
8 Correct 8 ms 4688 KB Output is correct
9 Correct 6 ms 4688 KB Output is correct
10 Correct 6 ms 4732 KB Output is correct
11 Correct 6 ms 4688 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 9 ms 4688 KB Output is correct
14 Correct 7 ms 4688 KB Output is correct
15 Correct 6 ms 4688 KB Output is correct
16 Correct 6 ms 4732 KB Output is correct
17 Correct 7 ms 4676 KB Output is correct
18 Correct 7 ms 4672 KB Output is correct
19 Correct 6 ms 4748 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 6 ms 4688 KB Output is correct
22 Correct 6 ms 4688 KB Output is correct
23 Correct 6 ms 4688 KB Output is correct
24 Correct 6 ms 4784 KB Output is correct
25 Correct 3 ms 2256 KB Output is correct
26 Correct 6 ms 4688 KB Output is correct
27 Correct 6 ms 4688 KB Output is correct
28 Correct 8 ms 4688 KB Output is correct
29 Correct 6 ms 4688 KB Output is correct
30 Correct 6 ms 4688 KB Output is correct
31 Correct 7 ms 4776 KB Output is correct
32 Correct 6 ms 4688 KB Output is correct
33 Correct 6 ms 4688 KB Output is correct
34 Correct 7 ms 4688 KB Output is correct
35 Correct 6 ms 4688 KB Output is correct
36 Correct 233 ms 149288 KB Output is correct
37 Correct 374 ms 229152 KB Output is correct
38 Correct 467 ms 229256 KB Output is correct
39 Correct 353 ms 229220 KB Output is correct
40 Correct 348 ms 229160 KB Output is correct
41 Correct 379 ms 229172 KB Output is correct
42 Correct 352 ms 229252 KB Output is correct
43 Correct 301 ms 229204 KB Output is correct
44 Correct 302 ms 229160 KB Output is correct
45 Correct 303 ms 229264 KB Output is correct
46 Correct 308 ms 229220 KB Output is correct
47 Correct 384 ms 229172 KB Output is correct
48 Correct 361 ms 229212 KB Output is correct
49 Correct 348 ms 229196 KB Output is correct
50 Correct 301 ms 229156 KB Output is correct
51 Correct 298 ms 229260 KB Output is correct
52 Correct 377 ms 229256 KB Output is correct
53 Correct 365 ms 229300 KB Output is correct
54 Correct 359 ms 229256 KB Output is correct
55 Correct 300 ms 229444 KB Output is correct
56 Correct 300 ms 229240 KB Output is correct
57 Correct 358 ms 221592 KB Output is correct
58 Correct 369 ms 229208 KB Output is correct
59 Correct 380 ms 229216 KB Output is correct
60 Correct 352 ms 229152 KB Output is correct
61 Correct 374 ms 229196 KB Output is correct
62 Correct 355 ms 229172 KB Output is correct
63 Correct 355 ms 229272 KB Output is correct
64 Correct 301 ms 229244 KB Output is correct
65 Correct 293 ms 229224 KB Output is correct
66 Correct 319 ms 229160 KB Output is correct
67 Correct 293 ms 229260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1458 ms 227568 KB Output is correct
2 Correct 1898 ms 229224 KB Output is correct
3 Correct 1819 ms 229244 KB Output is correct
4 Correct 1757 ms 229224 KB Output is correct
5 Correct 1691 ms 229172 KB Output is correct
6 Correct 1675 ms 229216 KB Output is correct
7 Correct 1783 ms 229272 KB Output is correct
8 Correct 1787 ms 229192 KB Output is correct
9 Correct 1665 ms 229244 KB Output is correct
10 Correct 1617 ms 229320 KB Output is correct
11 Correct 1561 ms 229232 KB Output is correct
12 Correct 1654 ms 229340 KB Output is correct
13 Correct 1642 ms 229236 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 6 ms 4688 KB Output is correct
16 Correct 6 ms 4688 KB Output is correct
17 Correct 362 ms 229172 KB Output is correct
18 Correct 350 ms 229252 KB Output is correct
19 Correct 352 ms 229276 KB Output is correct
20 Correct 291 ms 229216 KB Output is correct
21 Correct 297 ms 229212 KB Output is correct
22 Correct 353 ms 229172 KB Output is correct
23 Correct 337 ms 229264 KB Output is correct
24 Correct 358 ms 229268 KB Output is correct
25 Correct 296 ms 229240 KB Output is correct
26 Correct 299 ms 229272 KB Output is correct
27 Correct 6 ms 4688 KB Output is correct
28 Correct 6 ms 4688 KB Output is correct
29 Correct 6 ms 4688 KB Output is correct
30 Correct 6 ms 4688 KB Output is correct
31 Correct 6 ms 4688 KB Output is correct
32 Correct 6 ms 4700 KB Output is correct
33 Correct 6 ms 4688 KB Output is correct
34 Correct 6 ms 4688 KB Output is correct
35 Correct 6 ms 4688 KB Output is correct
36 Correct 6 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 434 ms 54980 KB Output is correct
2 Correct 1557 ms 229172 KB Output is correct
3 Correct 1520 ms 229172 KB Output is correct
4 Correct 1655 ms 229196 KB Output is correct
5 Correct 1488 ms 229144 KB Output is correct
6 Correct 1523 ms 229252 KB Output is correct
7 Correct 1378 ms 229300 KB Output is correct
8 Correct 1777 ms 229204 KB Output is correct
9 Correct 1797 ms 229236 KB Output is correct
10 Correct 1526 ms 229232 KB Output is correct
11 Correct 1462 ms 229264 KB Output is correct
12 Correct 368 ms 229304 KB Output is correct
13 Correct 341 ms 229172 KB Output is correct
14 Correct 360 ms 229256 KB Output is correct
15 Correct 299 ms 229248 KB Output is correct
16 Correct 301 ms 229164 KB Output is correct
17 Correct 349 ms 221504 KB Output is correct
18 Correct 353 ms 229248 KB Output is correct
19 Correct 356 ms 229240 KB Output is correct
20 Correct 347 ms 229172 KB Output is correct
21 Correct 355 ms 229224 KB Output is correct
22 Correct 337 ms 229228 KB Output is correct
23 Correct 350 ms 229400 KB Output is correct
24 Correct 293 ms 229248 KB Output is correct
25 Correct 312 ms 229324 KB Output is correct
26 Correct 303 ms 229264 KB Output is correct
27 Correct 299 ms 229264 KB Output is correct
28 Correct 6 ms 4688 KB Output is correct
29 Correct 6 ms 4688 KB Output is correct
30 Correct 6 ms 4764 KB Output is correct
31 Correct 6 ms 4688 KB Output is correct
32 Correct 5 ms 4688 KB Output is correct
33 Correct 5 ms 2256 KB Output is correct
34 Correct 9 ms 4688 KB Output is correct
35 Correct 6 ms 4704 KB Output is correct
36 Correct 6 ms 4700 KB Output is correct
37 Correct 6 ms 4688 KB Output is correct
38 Correct 6 ms 4664 KB Output is correct
39 Correct 5 ms 4724 KB Output is correct
40 Correct 6 ms 4688 KB Output is correct
41 Correct 6 ms 4688 KB Output is correct
42 Correct 6 ms 4688 KB Output is correct
43 Correct 6 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1232 KB Output is correct
2 Correct 6 ms 4688 KB Output is correct
3 Correct 9 ms 4772 KB Output is correct
4 Correct 8 ms 4688 KB Output is correct
5 Correct 7 ms 4688 KB Output is correct
6 Correct 9 ms 4688 KB Output is correct
7 Correct 6 ms 4720 KB Output is correct
8 Correct 8 ms 4688 KB Output is correct
9 Correct 6 ms 4688 KB Output is correct
10 Correct 6 ms 4732 KB Output is correct
11 Correct 6 ms 4688 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 9 ms 4688 KB Output is correct
14 Correct 7 ms 4688 KB Output is correct
15 Correct 6 ms 4688 KB Output is correct
16 Correct 6 ms 4732 KB Output is correct
17 Correct 7 ms 4676 KB Output is correct
18 Correct 7 ms 4672 KB Output is correct
19 Correct 6 ms 4748 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 6 ms 4688 KB Output is correct
22 Correct 6 ms 4688 KB Output is correct
23 Correct 6 ms 4688 KB Output is correct
24 Correct 6 ms 4784 KB Output is correct
25 Correct 3 ms 2256 KB Output is correct
26 Correct 6 ms 4688 KB Output is correct
27 Correct 6 ms 4688 KB Output is correct
28 Correct 8 ms 4688 KB Output is correct
29 Correct 6 ms 4688 KB Output is correct
30 Correct 6 ms 4688 KB Output is correct
31 Correct 7 ms 4776 KB Output is correct
32 Correct 6 ms 4688 KB Output is correct
33 Correct 6 ms 4688 KB Output is correct
34 Correct 7 ms 4688 KB Output is correct
35 Correct 6 ms 4688 KB Output is correct
36 Correct 233 ms 149288 KB Output is correct
37 Correct 374 ms 229152 KB Output is correct
38 Correct 467 ms 229256 KB Output is correct
39 Correct 353 ms 229220 KB Output is correct
40 Correct 348 ms 229160 KB Output is correct
41 Correct 379 ms 229172 KB Output is correct
42 Correct 352 ms 229252 KB Output is correct
43 Correct 301 ms 229204 KB Output is correct
44 Correct 302 ms 229160 KB Output is correct
45 Correct 303 ms 229264 KB Output is correct
46 Correct 308 ms 229220 KB Output is correct
47 Correct 384 ms 229172 KB Output is correct
48 Correct 361 ms 229212 KB Output is correct
49 Correct 348 ms 229196 KB Output is correct
50 Correct 301 ms 229156 KB Output is correct
51 Correct 298 ms 229260 KB Output is correct
52 Correct 377 ms 229256 KB Output is correct
53 Correct 365 ms 229300 KB Output is correct
54 Correct 359 ms 229256 KB Output is correct
55 Correct 300 ms 229444 KB Output is correct
56 Correct 300 ms 229240 KB Output is correct
57 Correct 358 ms 221592 KB Output is correct
58 Correct 369 ms 229208 KB Output is correct
59 Correct 380 ms 229216 KB Output is correct
60 Correct 352 ms 229152 KB Output is correct
61 Correct 374 ms 229196 KB Output is correct
62 Correct 355 ms 229172 KB Output is correct
63 Correct 355 ms 229272 KB Output is correct
64 Correct 301 ms 229244 KB Output is correct
65 Correct 293 ms 229224 KB Output is correct
66 Correct 319 ms 229160 KB Output is correct
67 Correct 293 ms 229260 KB Output is correct
68 Correct 1458 ms 227568 KB Output is correct
69 Correct 1898 ms 229224 KB Output is correct
70 Correct 1819 ms 229244 KB Output is correct
71 Correct 1757 ms 229224 KB Output is correct
72 Correct 1691 ms 229172 KB Output is correct
73 Correct 1675 ms 229216 KB Output is correct
74 Correct 1783 ms 229272 KB Output is correct
75 Correct 1787 ms 229192 KB Output is correct
76 Correct 1665 ms 229244 KB Output is correct
77 Correct 1617 ms 229320 KB Output is correct
78 Correct 1561 ms 229232 KB Output is correct
79 Correct 1654 ms 229340 KB Output is correct
80 Correct 1642 ms 229236 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 6 ms 4688 KB Output is correct
83 Correct 6 ms 4688 KB Output is correct
84 Correct 362 ms 229172 KB Output is correct
85 Correct 350 ms 229252 KB Output is correct
86 Correct 352 ms 229276 KB Output is correct
87 Correct 291 ms 229216 KB Output is correct
88 Correct 297 ms 229212 KB Output is correct
89 Correct 353 ms 229172 KB Output is correct
90 Correct 337 ms 229264 KB Output is correct
91 Correct 358 ms 229268 KB Output is correct
92 Correct 296 ms 229240 KB Output is correct
93 Correct 299 ms 229272 KB Output is correct
94 Correct 6 ms 4688 KB Output is correct
95 Correct 6 ms 4688 KB Output is correct
96 Correct 6 ms 4688 KB Output is correct
97 Correct 6 ms 4688 KB Output is correct
98 Correct 6 ms 4688 KB Output is correct
99 Correct 6 ms 4700 KB Output is correct
100 Correct 6 ms 4688 KB Output is correct
101 Correct 6 ms 4688 KB Output is correct
102 Correct 6 ms 4688 KB Output is correct
103 Correct 6 ms 4688 KB Output is correct
104 Correct 1464 ms 203432 KB Output is correct
105 Correct 2061 ms 229232 KB Output is correct
106 Correct 2144 ms 229424 KB Output is correct
107 Correct 1794 ms 229248 KB Output is correct
108 Correct 1814 ms 229172 KB Output is correct
109 Correct 1785 ms 229256 KB Output is correct
110 Correct 1612 ms 229212 KB Output is correct
111 Correct 1863 ms 229232 KB Output is correct
112 Correct 1736 ms 229252 KB Output is correct
113 Correct 1722 ms 229220 KB Output is correct
114 Correct 1783 ms 229236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1096 ms 136752 KB Output is correct
2 Correct 2315 ms 229232 KB Output is correct
3 Correct 1793 ms 229244 KB Output is correct
4 Correct 2033 ms 229240 KB Output is correct
5 Correct 2071 ms 229184 KB Output is correct
6 Correct 1556 ms 229388 KB Output is correct
7 Correct 1723 ms 229240 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 4688 KB Output is correct
10 Correct 6 ms 4688 KB Output is correct
11 Correct 2 ms 1232 KB Output is correct
12 Correct 6 ms 4688 KB Output is correct
13 Correct 9 ms 4772 KB Output is correct
14 Correct 8 ms 4688 KB Output is correct
15 Correct 7 ms 4688 KB Output is correct
16 Correct 9 ms 4688 KB Output is correct
17 Correct 6 ms 4720 KB Output is correct
18 Correct 8 ms 4688 KB Output is correct
19 Correct 6 ms 4688 KB Output is correct
20 Correct 6 ms 4732 KB Output is correct
21 Correct 6 ms 4688 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 9 ms 4688 KB Output is correct
24 Correct 7 ms 4688 KB Output is correct
25 Correct 6 ms 4688 KB Output is correct
26 Correct 6 ms 4732 KB Output is correct
27 Correct 7 ms 4676 KB Output is correct
28 Correct 7 ms 4672 KB Output is correct
29 Correct 6 ms 4748 KB Output is correct
30 Correct 6 ms 4688 KB Output is correct
31 Correct 6 ms 4688 KB Output is correct
32 Correct 6 ms 4688 KB Output is correct
33 Correct 6 ms 4688 KB Output is correct
34 Correct 6 ms 4784 KB Output is correct
35 Correct 3 ms 2256 KB Output is correct
36 Correct 6 ms 4688 KB Output is correct
37 Correct 6 ms 4688 KB Output is correct
38 Correct 8 ms 4688 KB Output is correct
39 Correct 6 ms 4688 KB Output is correct
40 Correct 6 ms 4688 KB Output is correct
41 Correct 7 ms 4776 KB Output is correct
42 Correct 6 ms 4688 KB Output is correct
43 Correct 6 ms 4688 KB Output is correct
44 Correct 7 ms 4688 KB Output is correct
45 Correct 6 ms 4688 KB Output is correct
46 Correct 233 ms 149288 KB Output is correct
47 Correct 374 ms 229152 KB Output is correct
48 Correct 467 ms 229256 KB Output is correct
49 Correct 353 ms 229220 KB Output is correct
50 Correct 348 ms 229160 KB Output is correct
51 Correct 379 ms 229172 KB Output is correct
52 Correct 352 ms 229252 KB Output is correct
53 Correct 301 ms 229204 KB Output is correct
54 Correct 302 ms 229160 KB Output is correct
55 Correct 303 ms 229264 KB Output is correct
56 Correct 308 ms 229220 KB Output is correct
57 Correct 384 ms 229172 KB Output is correct
58 Correct 361 ms 229212 KB Output is correct
59 Correct 348 ms 229196 KB Output is correct
60 Correct 301 ms 229156 KB Output is correct
61 Correct 298 ms 229260 KB Output is correct
62 Correct 377 ms 229256 KB Output is correct
63 Correct 365 ms 229300 KB Output is correct
64 Correct 359 ms 229256 KB Output is correct
65 Correct 300 ms 229444 KB Output is correct
66 Correct 300 ms 229240 KB Output is correct
67 Correct 358 ms 221592 KB Output is correct
68 Correct 369 ms 229208 KB Output is correct
69 Correct 380 ms 229216 KB Output is correct
70 Correct 352 ms 229152 KB Output is correct
71 Correct 374 ms 229196 KB Output is correct
72 Correct 355 ms 229172 KB Output is correct
73 Correct 355 ms 229272 KB Output is correct
74 Correct 301 ms 229244 KB Output is correct
75 Correct 293 ms 229224 KB Output is correct
76 Correct 319 ms 229160 KB Output is correct
77 Correct 293 ms 229260 KB Output is correct
78 Correct 1458 ms 227568 KB Output is correct
79 Correct 1898 ms 229224 KB Output is correct
80 Correct 1819 ms 229244 KB Output is correct
81 Correct 1757 ms 229224 KB Output is correct
82 Correct 1691 ms 229172 KB Output is correct
83 Correct 1675 ms 229216 KB Output is correct
84 Correct 1783 ms 229272 KB Output is correct
85 Correct 1787 ms 229192 KB Output is correct
86 Correct 1665 ms 229244 KB Output is correct
87 Correct 1617 ms 229320 KB Output is correct
88 Correct 1561 ms 229232 KB Output is correct
89 Correct 1654 ms 229340 KB Output is correct
90 Correct 1642 ms 229236 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 6 ms 4688 KB Output is correct
93 Correct 6 ms 4688 KB Output is correct
94 Correct 362 ms 229172 KB Output is correct
95 Correct 350 ms 229252 KB Output is correct
96 Correct 352 ms 229276 KB Output is correct
97 Correct 291 ms 229216 KB Output is correct
98 Correct 297 ms 229212 KB Output is correct
99 Correct 353 ms 229172 KB Output is correct
100 Correct 337 ms 229264 KB Output is correct
101 Correct 358 ms 229268 KB Output is correct
102 Correct 296 ms 229240 KB Output is correct
103 Correct 299 ms 229272 KB Output is correct
104 Correct 6 ms 4688 KB Output is correct
105 Correct 6 ms 4688 KB Output is correct
106 Correct 6 ms 4688 KB Output is correct
107 Correct 6 ms 4688 KB Output is correct
108 Correct 6 ms 4688 KB Output is correct
109 Correct 6 ms 4700 KB Output is correct
110 Correct 6 ms 4688 KB Output is correct
111 Correct 6 ms 4688 KB Output is correct
112 Correct 6 ms 4688 KB Output is correct
113 Correct 6 ms 4688 KB Output is correct
114 Correct 434 ms 54980 KB Output is correct
115 Correct 1557 ms 229172 KB Output is correct
116 Correct 1520 ms 229172 KB Output is correct
117 Correct 1655 ms 229196 KB Output is correct
118 Correct 1488 ms 229144 KB Output is correct
119 Correct 1523 ms 229252 KB Output is correct
120 Correct 1378 ms 229300 KB Output is correct
121 Correct 1777 ms 229204 KB Output is correct
122 Correct 1797 ms 229236 KB Output is correct
123 Correct 1526 ms 229232 KB Output is correct
124 Correct 1462 ms 229264 KB Output is correct
125 Correct 368 ms 229304 KB Output is correct
126 Correct 341 ms 229172 KB Output is correct
127 Correct 360 ms 229256 KB Output is correct
128 Correct 299 ms 229248 KB Output is correct
129 Correct 301 ms 229164 KB Output is correct
130 Correct 349 ms 221504 KB Output is correct
131 Correct 353 ms 229248 KB Output is correct
132 Correct 356 ms 229240 KB Output is correct
133 Correct 347 ms 229172 KB Output is correct
134 Correct 355 ms 229224 KB Output is correct
135 Correct 337 ms 229228 KB Output is correct
136 Correct 350 ms 229400 KB Output is correct
137 Correct 293 ms 229248 KB Output is correct
138 Correct 312 ms 229324 KB Output is correct
139 Correct 303 ms 229264 KB Output is correct
140 Correct 299 ms 229264 KB Output is correct
141 Correct 6 ms 4688 KB Output is correct
142 Correct 6 ms 4688 KB Output is correct
143 Correct 6 ms 4764 KB Output is correct
144 Correct 6 ms 4688 KB Output is correct
145 Correct 5 ms 4688 KB Output is correct
146 Correct 5 ms 2256 KB Output is correct
147 Correct 9 ms 4688 KB Output is correct
148 Correct 6 ms 4704 KB Output is correct
149 Correct 6 ms 4700 KB Output is correct
150 Correct 6 ms 4688 KB Output is correct
151 Correct 6 ms 4664 KB Output is correct
152 Correct 5 ms 4724 KB Output is correct
153 Correct 6 ms 4688 KB Output is correct
154 Correct 6 ms 4688 KB Output is correct
155 Correct 6 ms 4688 KB Output is correct
156 Correct 6 ms 4688 KB Output is correct
157 Correct 1464 ms 203432 KB Output is correct
158 Correct 2061 ms 229232 KB Output is correct
159 Correct 2144 ms 229424 KB Output is correct
160 Correct 1794 ms 229248 KB Output is correct
161 Correct 1814 ms 229172 KB Output is correct
162 Correct 1785 ms 229256 KB Output is correct
163 Correct 1612 ms 229212 KB Output is correct
164 Correct 1863 ms 229232 KB Output is correct
165 Correct 1736 ms 229252 KB Output is correct
166 Correct 1722 ms 229220 KB Output is correct
167 Correct 1783 ms 229236 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 1238 ms 79628 KB Output is correct
170 Correct 2194 ms 229212 KB Output is correct
171 Correct 2119 ms 229148 KB Output is correct
172 Correct 1905 ms 229196 KB Output is correct
173 Correct 1996 ms 229232 KB Output is correct
174 Correct 1983 ms 229312 KB Output is correct
175 Correct 1623 ms 229172 KB Output is correct
176 Correct 2043 ms 229284 KB Output is correct
177 Correct 2028 ms 229196 KB Output is correct
178 Correct 1824 ms 229260 KB Output is correct
179 Correct 1943 ms 229160 KB Output is correct