Submission #702347

# Submission time Handle Problem Language Result Execution time Memory
702347 2023-02-23T15:53:23 Z dykw Radio Towers (IOI22_towers) C++17
100 / 100
1087 ms 35604 KB
#include "towers.h"

#include <bits/stdc++.h>

using namespace std;

constexpr int MaxN = 100000;
constexpr int LogN = 16;
constexpr int Inf = 1E9;

namespace RMQ {
  int st[LogN + 1][MaxN];
  
  void build(vector<int> &H) {
    int N = H.size();
    for (int i = 0; i < N; ++i) {
      st[0][i] = H[i];
    }
    for (int i = 1; (1 << i) <= N; ++i) {
      for (int j = 0; j + (1 << i) - 1 < N; ++j) {
        st[i][j] = max(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
      }
    }
  }
  
  int ask(int l, int r) {
    if (l > r) {
      return -1;
    }
    int k = __lg(r - l + 1);
    return max(st[k][l], st[k][r - (1 << k) + 1]);
  }
}

namespace T {
  int val_l[MaxN * 4], val_r[MaxN * 4];
  
  void build(int l, int r, int x, const vector<int> &vl, const vector<int> &vr) {
    if (l == r) {
      val_l[x] = vl[l];
      val_r[x] = vr[l];
      return;
    }
    int mid = (l + r) / 2;
    build(l, mid, x * 2, vl, vr);
    build(mid + 1, r, x * 2 + 1, vl, vr);
    val_l[x] = max(val_l[x * 2], val_l[x * 2 + 1]);
    val_r[x] = max(val_r[x * 2], val_r[x * 2 + 1]);
  }
  
  int find_l(int l, int r, int ql, int qr, int delta, int x) {
    if (val_r[x] < delta) {
      return MaxN;
    }
    if (l == r) {
      return l;
    }
    int mid = (l + r) / 2;
    if (ql <= l && r <= qr) {
      if (val_r[x * 2] >= delta) {
        return find_l(l, mid, ql, qr, delta, x * 2);
      } else {
        return find_l(mid + 1, r, ql, qr, delta, x * 2 + 1);
      }
    }
    if (ql <= mid) {
      int res = find_l(l, mid, ql, qr, delta, x * 2);
      if (res != MaxN) {
        return res;
      }
    }
    return find_l(mid + 1, r, ql, qr, delta, x * 2 + 1);
  }
  
  int find_r(int l, int r, int ql, int qr, int delta, int x) {
    if (val_l[x] < delta) {
      return -1;
    }
    if (l == r) {
      return l;
    }
    int mid = (l + r) / 2;
    if (ql <= l && r <= qr) {
      if (val_l[x * 2 + 1] >= delta) {
        return find_r(mid + 1, r, ql, qr, delta, x * 2 + 1);
      } else {
        return find_r(l, mid, ql, qr, delta, x * 2);
      }
    }
    if (qr > mid) {
      int res = find_r(mid + 1, r, ql, qr, delta, x * 2 + 1);
      if (res != -1) {
        return res;
      }
    }
    return find_r(l, mid, ql, qr, delta, x * 2);
  }
}

namespace PerT {
  struct Node {
    int l, r;
    int v;
    Node() : l(), r(), v() {}
  };
  vector<Node> t(1);
  
  int insert(int l, int r, int p, int x) {
    int y = t.size();
    t.push_back(t[x]);
    ++t[y].v;
    if (l == r) {
      return y;
    }
    int mid = (l + r) / 2;
    if (p <= mid) {
      t[y].l = insert(l, mid, p, t[x].l);
    } else {
      t[y].r = insert(mid + 1, r, p, t[x].r);
    }
    return y;
  }
  
  int ask(int l, int r, int ql, int qr, int x, int y) {
    if (ql <= l && r <= qr) {
      return t[y].v - t[x].v;
    }
    int mid = (l + r) / 2;
    if (ql > mid) {
      return ask(mid + 1, r, ql, qr, t[x].r, t[y].r);
    } else if (qr <= mid) {
      return ask(l, mid, ql, qr, t[x].l, t[y].l);
    } else {
      return ask(l, mid, ql, qr, t[x].l, t[y].l) + ask(mid + 1, r, ql, qr, t[x].r, t[y].r);
    }
  }
}

int N, root[MaxN + 1];

void init(int N_, vector<int> H) {
  N = N_;
  RMQ::build(H);
  
  vector<int> stk(N + 1);
  int top = 0;
  
  vector<int> l(N), r(N);
  for (int i = 0; i < N; ++i) {
    while (top && H[stk[top]] > H[i]) {
      --top;
    }
    l[i] = top ? RMQ::ask(stk[top] + 1, i - 1) : Inf;
    if (top && l[i] > 0) {
      l[i] -= H[i];
    }
    stk[++top] = i;
  }
  top = 0;
  for (int i = N - 1; i >= 0; --i) {
    while (top && H[stk[top]] > H[i]) {
      --top;
    }
    r[i] = top ? RMQ::ask(i + 1, stk[top] - 1) : Inf;
    if (top && r[i] > 0) {
      r[i] -= H[i];
    }
    stk[++top] = i;
  }
  
  T::build(0, N - 1, 1, l, r);
  for (int i = 0; i < N; ++i) {
    if (l[i] == -1 || r[i] == -1) {
      root[i + 1] = root[i];
      continue;
    }
    root[i + 1] = PerT::insert(0, Inf, min(l[i], r[i]), root[i]);
  }
}

int max_towers(int L, int R, int D) {
  int avail_l = T::find_l(0, N - 1, L, R, D, 1);
  int avail_r = T::find_r(0, N - 1, L, R, D, 1);
  if (avail_l > avail_r || avail_r - avail_l <= 1) {
    return 1;
  }
  return PerT::ask(0, Inf, D, Inf, root[avail_l + 1], root[avail_r]) + 2;
}

#ifdef LOCAL_GRADER

int main() {
  int N, Q;
  assert(2 == scanf("%d %d", &N, &Q));
  std::vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    assert(1 == scanf("%d", &H[i]));
  }
  init(N, H);

  for (int i = 0; i < Q; ++i) {
    int L, R, D;
    assert(3 == scanf("%d %d %d", &L, &R, &D));
    printf("%d\n", max_towers(L, R, D));
  }
  return 0;
}

#endif
# Verdict Execution time Memory Grader output
1 Correct 446 ms 6184 KB Output is correct
2 Correct 914 ms 10824 KB Output is correct
3 Correct 835 ms 10804 KB Output is correct
4 Correct 1029 ms 10796 KB Output is correct
5 Correct 722 ms 10800 KB Output is correct
6 Correct 686 ms 10820 KB Output is correct
7 Correct 872 ms 10784 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 548 KB Output is correct
2 Correct 2 ms 1040 KB Output is correct
3 Correct 2 ms 1068 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 2 ms 1040 KB Output is correct
6 Correct 2 ms 992 KB Output is correct
7 Correct 2 ms 1040 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 1 ms 1040 KB Output is correct
16 Correct 2 ms 1040 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 2 ms 464 KB Output is correct
20 Correct 2 ms 1040 KB Output is correct
21 Correct 2 ms 1040 KB Output is correct
22 Correct 2 ms 1040 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 1040 KB Output is correct
27 Correct 1 ms 1040 KB Output is correct
28 Correct 2 ms 1040 KB Output is correct
29 Correct 2 ms 1040 KB Output is correct
30 Correct 2 ms 1040 KB Output is correct
31 Correct 1 ms 1040 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 548 KB Output is correct
2 Correct 2 ms 1040 KB Output is correct
3 Correct 2 ms 1068 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 2 ms 1040 KB Output is correct
6 Correct 2 ms 992 KB Output is correct
7 Correct 2 ms 1040 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 1 ms 1040 KB Output is correct
16 Correct 2 ms 1040 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 2 ms 464 KB Output is correct
20 Correct 2 ms 1040 KB Output is correct
21 Correct 2 ms 1040 KB Output is correct
22 Correct 2 ms 1040 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 1040 KB Output is correct
27 Correct 1 ms 1040 KB Output is correct
28 Correct 2 ms 1040 KB Output is correct
29 Correct 2 ms 1040 KB Output is correct
30 Correct 2 ms 1040 KB Output is correct
31 Correct 1 ms 1040 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 31 ms 19152 KB Output is correct
37 Correct 63 ms 23072 KB Output is correct
38 Correct 54 ms 23092 KB Output is correct
39 Correct 61 ms 35416 KB Output is correct
40 Correct 74 ms 35436 KB Output is correct
41 Correct 60 ms 35448 KB Output is correct
42 Correct 58 ms 35472 KB Output is correct
43 Correct 18 ms 10824 KB Output is correct
44 Correct 18 ms 10800 KB Output is correct
45 Correct 26 ms 10780 KB Output is correct
46 Correct 20 ms 10796 KB Output is correct
47 Correct 43 ms 23060 KB Output is correct
48 Correct 64 ms 35476 KB Output is correct
49 Correct 71 ms 35460 KB Output is correct
50 Correct 19 ms 10824 KB Output is correct
51 Correct 18 ms 10796 KB Output is correct
52 Correct 43 ms 23076 KB Output is correct
53 Correct 62 ms 35468 KB Output is correct
54 Correct 62 ms 35472 KB Output is correct
55 Correct 26 ms 10824 KB Output is correct
56 Correct 19 ms 10820 KB Output is correct
57 Correct 42 ms 22804 KB Output is correct
58 Correct 47 ms 23220 KB Output is correct
59 Correct 52 ms 23052 KB Output is correct
60 Correct 61 ms 35480 KB Output is correct
61 Correct 60 ms 35460 KB Output is correct
62 Correct 58 ms 35452 KB Output is correct
63 Correct 66 ms 35416 KB Output is correct
64 Correct 21 ms 10792 KB Output is correct
65 Correct 18 ms 10824 KB Output is correct
66 Correct 27 ms 10804 KB Output is correct
67 Correct 26 ms 10792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 784 ms 23096 KB Output is correct
2 Correct 792 ms 23140 KB Output is correct
3 Correct 820 ms 23076 KB Output is correct
4 Correct 1087 ms 35484 KB Output is correct
5 Correct 967 ms 35420 KB Output is correct
6 Correct 1037 ms 35476 KB Output is correct
7 Correct 804 ms 35500 KB Output is correct
8 Correct 886 ms 10828 KB Output is correct
9 Correct 685 ms 10824 KB Output is correct
10 Correct 925 ms 10824 KB Output is correct
11 Correct 838 ms 10784 KB Output is correct
12 Correct 916 ms 10824 KB Output is correct
13 Correct 859 ms 10784 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 1 ms 464 KB Output is correct
17 Correct 52 ms 23128 KB Output is correct
18 Correct 58 ms 35492 KB Output is correct
19 Correct 58 ms 35448 KB Output is correct
20 Correct 20 ms 10784 KB Output is correct
21 Correct 17 ms 10792 KB Output is correct
22 Correct 41 ms 23100 KB Output is correct
23 Correct 57 ms 35476 KB Output is correct
24 Correct 67 ms 35420 KB Output is correct
25 Correct 26 ms 10780 KB Output is correct
26 Correct 25 ms 10804 KB Output is correct
27 Correct 1 ms 1040 KB Output is correct
28 Correct 2 ms 1040 KB Output is correct
29 Correct 2 ms 1040 KB Output is correct
30 Correct 1 ms 464 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 1040 KB Output is correct
33 Correct 2 ms 1040 KB Output is correct
34 Correct 2 ms 1040 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 5796 KB Output is correct
2 Correct 838 ms 23148 KB Output is correct
3 Correct 1059 ms 23064 KB Output is correct
4 Correct 915 ms 35604 KB Output is correct
5 Correct 1022 ms 35476 KB Output is correct
6 Correct 1008 ms 35492 KB Output is correct
7 Correct 791 ms 35504 KB Output is correct
8 Correct 743 ms 10820 KB Output is correct
9 Correct 1022 ms 10824 KB Output is correct
10 Correct 662 ms 10800 KB Output is correct
11 Correct 674 ms 10800 KB Output is correct
12 Correct 43 ms 23100 KB Output is correct
13 Correct 62 ms 35488 KB Output is correct
14 Correct 57 ms 35456 KB Output is correct
15 Correct 18 ms 10796 KB Output is correct
16 Correct 19 ms 10780 KB Output is correct
17 Correct 42 ms 22800 KB Output is correct
18 Correct 54 ms 23092 KB Output is correct
19 Correct 45 ms 23144 KB Output is correct
20 Correct 61 ms 35476 KB Output is correct
21 Correct 68 ms 35420 KB Output is correct
22 Correct 56 ms 35504 KB Output is correct
23 Correct 55 ms 35476 KB Output is correct
24 Correct 18 ms 10864 KB Output is correct
25 Correct 21 ms 10832 KB Output is correct
26 Correct 25 ms 10808 KB Output is correct
27 Correct 22 ms 10804 KB Output is correct
28 Correct 1 ms 1040 KB Output is correct
29 Correct 1 ms 1040 KB Output is correct
30 Correct 1 ms 1040 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 1 ms 1040 KB Output is correct
35 Correct 1 ms 1040 KB Output is correct
36 Correct 1 ms 1040 KB Output is correct
37 Correct 1 ms 1040 KB Output is correct
38 Correct 2 ms 1040 KB Output is correct
39 Correct 2 ms 1040 KB Output is correct
40 Correct 1 ms 464 KB Output is correct
41 Correct 1 ms 464 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 548 KB Output is correct
2 Correct 2 ms 1040 KB Output is correct
3 Correct 2 ms 1068 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 2 ms 1040 KB Output is correct
6 Correct 2 ms 992 KB Output is correct
7 Correct 2 ms 1040 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 1 ms 1040 KB Output is correct
16 Correct 2 ms 1040 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 2 ms 464 KB Output is correct
20 Correct 2 ms 1040 KB Output is correct
21 Correct 2 ms 1040 KB Output is correct
22 Correct 2 ms 1040 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 1040 KB Output is correct
27 Correct 1 ms 1040 KB Output is correct
28 Correct 2 ms 1040 KB Output is correct
29 Correct 2 ms 1040 KB Output is correct
30 Correct 2 ms 1040 KB Output is correct
31 Correct 1 ms 1040 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 31 ms 19152 KB Output is correct
37 Correct 63 ms 23072 KB Output is correct
38 Correct 54 ms 23092 KB Output is correct
39 Correct 61 ms 35416 KB Output is correct
40 Correct 74 ms 35436 KB Output is correct
41 Correct 60 ms 35448 KB Output is correct
42 Correct 58 ms 35472 KB Output is correct
43 Correct 18 ms 10824 KB Output is correct
44 Correct 18 ms 10800 KB Output is correct
45 Correct 26 ms 10780 KB Output is correct
46 Correct 20 ms 10796 KB Output is correct
47 Correct 43 ms 23060 KB Output is correct
48 Correct 64 ms 35476 KB Output is correct
49 Correct 71 ms 35460 KB Output is correct
50 Correct 19 ms 10824 KB Output is correct
51 Correct 18 ms 10796 KB Output is correct
52 Correct 43 ms 23076 KB Output is correct
53 Correct 62 ms 35468 KB Output is correct
54 Correct 62 ms 35472 KB Output is correct
55 Correct 26 ms 10824 KB Output is correct
56 Correct 19 ms 10820 KB Output is correct
57 Correct 42 ms 22804 KB Output is correct
58 Correct 47 ms 23220 KB Output is correct
59 Correct 52 ms 23052 KB Output is correct
60 Correct 61 ms 35480 KB Output is correct
61 Correct 60 ms 35460 KB Output is correct
62 Correct 58 ms 35452 KB Output is correct
63 Correct 66 ms 35416 KB Output is correct
64 Correct 21 ms 10792 KB Output is correct
65 Correct 18 ms 10824 KB Output is correct
66 Correct 27 ms 10804 KB Output is correct
67 Correct 26 ms 10792 KB Output is correct
68 Correct 784 ms 23096 KB Output is correct
69 Correct 792 ms 23140 KB Output is correct
70 Correct 820 ms 23076 KB Output is correct
71 Correct 1087 ms 35484 KB Output is correct
72 Correct 967 ms 35420 KB Output is correct
73 Correct 1037 ms 35476 KB Output is correct
74 Correct 804 ms 35500 KB Output is correct
75 Correct 886 ms 10828 KB Output is correct
76 Correct 685 ms 10824 KB Output is correct
77 Correct 925 ms 10824 KB Output is correct
78 Correct 838 ms 10784 KB Output is correct
79 Correct 916 ms 10824 KB Output is correct
80 Correct 859 ms 10784 KB Output is correct
81 Correct 1 ms 384 KB Output is correct
82 Correct 1 ms 464 KB Output is correct
83 Correct 1 ms 464 KB Output is correct
84 Correct 52 ms 23128 KB Output is correct
85 Correct 58 ms 35492 KB Output is correct
86 Correct 58 ms 35448 KB Output is correct
87 Correct 20 ms 10784 KB Output is correct
88 Correct 17 ms 10792 KB Output is correct
89 Correct 41 ms 23100 KB Output is correct
90 Correct 57 ms 35476 KB Output is correct
91 Correct 67 ms 35420 KB Output is correct
92 Correct 26 ms 10780 KB Output is correct
93 Correct 25 ms 10804 KB Output is correct
94 Correct 1 ms 1040 KB Output is correct
95 Correct 2 ms 1040 KB Output is correct
96 Correct 2 ms 1040 KB Output is correct
97 Correct 1 ms 464 KB Output is correct
98 Correct 1 ms 464 KB Output is correct
99 Correct 1 ms 1040 KB Output is correct
100 Correct 2 ms 1040 KB Output is correct
101 Correct 2 ms 1040 KB Output is correct
102 Correct 1 ms 464 KB Output is correct
103 Correct 1 ms 464 KB Output is correct
104 Correct 798 ms 22132 KB Output is correct
105 Correct 1079 ms 23080 KB Output is correct
106 Correct 898 ms 23092 KB Output is correct
107 Correct 910 ms 35472 KB Output is correct
108 Correct 1022 ms 35456 KB Output is correct
109 Correct 1083 ms 35424 KB Output is correct
110 Correct 759 ms 35480 KB Output is correct
111 Correct 851 ms 10832 KB Output is correct
112 Correct 799 ms 10804 KB Output is correct
113 Correct 746 ms 10812 KB Output is correct
114 Correct 656 ms 10796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 446 ms 6184 KB Output is correct
2 Correct 914 ms 10824 KB Output is correct
3 Correct 835 ms 10804 KB Output is correct
4 Correct 1029 ms 10796 KB Output is correct
5 Correct 722 ms 10800 KB Output is correct
6 Correct 686 ms 10820 KB Output is correct
7 Correct 872 ms 10784 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 548 KB Output is correct
12 Correct 2 ms 1040 KB Output is correct
13 Correct 2 ms 1068 KB Output is correct
14 Correct 2 ms 1036 KB Output is correct
15 Correct 2 ms 1040 KB Output is correct
16 Correct 2 ms 992 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 1 ms 464 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 1040 KB Output is correct
26 Correct 2 ms 1040 KB Output is correct
27 Correct 2 ms 1040 KB Output is correct
28 Correct 1 ms 464 KB Output is correct
29 Correct 2 ms 464 KB Output is correct
30 Correct 2 ms 1040 KB Output is correct
31 Correct 2 ms 1040 KB Output is correct
32 Correct 2 ms 1040 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 1 ms 1040 KB Output is correct
37 Correct 1 ms 1040 KB Output is correct
38 Correct 2 ms 1040 KB Output is correct
39 Correct 2 ms 1040 KB Output is correct
40 Correct 2 ms 1040 KB Output is correct
41 Correct 1 ms 1040 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
44 Correct 1 ms 512 KB Output is correct
45 Correct 1 ms 464 KB Output is correct
46 Correct 31 ms 19152 KB Output is correct
47 Correct 63 ms 23072 KB Output is correct
48 Correct 54 ms 23092 KB Output is correct
49 Correct 61 ms 35416 KB Output is correct
50 Correct 74 ms 35436 KB Output is correct
51 Correct 60 ms 35448 KB Output is correct
52 Correct 58 ms 35472 KB Output is correct
53 Correct 18 ms 10824 KB Output is correct
54 Correct 18 ms 10800 KB Output is correct
55 Correct 26 ms 10780 KB Output is correct
56 Correct 20 ms 10796 KB Output is correct
57 Correct 43 ms 23060 KB Output is correct
58 Correct 64 ms 35476 KB Output is correct
59 Correct 71 ms 35460 KB Output is correct
60 Correct 19 ms 10824 KB Output is correct
61 Correct 18 ms 10796 KB Output is correct
62 Correct 43 ms 23076 KB Output is correct
63 Correct 62 ms 35468 KB Output is correct
64 Correct 62 ms 35472 KB Output is correct
65 Correct 26 ms 10824 KB Output is correct
66 Correct 19 ms 10820 KB Output is correct
67 Correct 42 ms 22804 KB Output is correct
68 Correct 47 ms 23220 KB Output is correct
69 Correct 52 ms 23052 KB Output is correct
70 Correct 61 ms 35480 KB Output is correct
71 Correct 60 ms 35460 KB Output is correct
72 Correct 58 ms 35452 KB Output is correct
73 Correct 66 ms 35416 KB Output is correct
74 Correct 21 ms 10792 KB Output is correct
75 Correct 18 ms 10824 KB Output is correct
76 Correct 27 ms 10804 KB Output is correct
77 Correct 26 ms 10792 KB Output is correct
78 Correct 784 ms 23096 KB Output is correct
79 Correct 792 ms 23140 KB Output is correct
80 Correct 820 ms 23076 KB Output is correct
81 Correct 1087 ms 35484 KB Output is correct
82 Correct 967 ms 35420 KB Output is correct
83 Correct 1037 ms 35476 KB Output is correct
84 Correct 804 ms 35500 KB Output is correct
85 Correct 886 ms 10828 KB Output is correct
86 Correct 685 ms 10824 KB Output is correct
87 Correct 925 ms 10824 KB Output is correct
88 Correct 838 ms 10784 KB Output is correct
89 Correct 916 ms 10824 KB Output is correct
90 Correct 859 ms 10784 KB Output is correct
91 Correct 1 ms 384 KB Output is correct
92 Correct 1 ms 464 KB Output is correct
93 Correct 1 ms 464 KB Output is correct
94 Correct 52 ms 23128 KB Output is correct
95 Correct 58 ms 35492 KB Output is correct
96 Correct 58 ms 35448 KB Output is correct
97 Correct 20 ms 10784 KB Output is correct
98 Correct 17 ms 10792 KB Output is correct
99 Correct 41 ms 23100 KB Output is correct
100 Correct 57 ms 35476 KB Output is correct
101 Correct 67 ms 35420 KB Output is correct
102 Correct 26 ms 10780 KB Output is correct
103 Correct 25 ms 10804 KB Output is correct
104 Correct 1 ms 1040 KB Output is correct
105 Correct 2 ms 1040 KB Output is correct
106 Correct 2 ms 1040 KB Output is correct
107 Correct 1 ms 464 KB Output is correct
108 Correct 1 ms 464 KB Output is correct
109 Correct 1 ms 1040 KB Output is correct
110 Correct 2 ms 1040 KB Output is correct
111 Correct 2 ms 1040 KB Output is correct
112 Correct 1 ms 464 KB Output is correct
113 Correct 1 ms 464 KB Output is correct
114 Correct 229 ms 5796 KB Output is correct
115 Correct 838 ms 23148 KB Output is correct
116 Correct 1059 ms 23064 KB Output is correct
117 Correct 915 ms 35604 KB Output is correct
118 Correct 1022 ms 35476 KB Output is correct
119 Correct 1008 ms 35492 KB Output is correct
120 Correct 791 ms 35504 KB Output is correct
121 Correct 743 ms 10820 KB Output is correct
122 Correct 1022 ms 10824 KB Output is correct
123 Correct 662 ms 10800 KB Output is correct
124 Correct 674 ms 10800 KB Output is correct
125 Correct 43 ms 23100 KB Output is correct
126 Correct 62 ms 35488 KB Output is correct
127 Correct 57 ms 35456 KB Output is correct
128 Correct 18 ms 10796 KB Output is correct
129 Correct 19 ms 10780 KB Output is correct
130 Correct 42 ms 22800 KB Output is correct
131 Correct 54 ms 23092 KB Output is correct
132 Correct 45 ms 23144 KB Output is correct
133 Correct 61 ms 35476 KB Output is correct
134 Correct 68 ms 35420 KB Output is correct
135 Correct 56 ms 35504 KB Output is correct
136 Correct 55 ms 35476 KB Output is correct
137 Correct 18 ms 10864 KB Output is correct
138 Correct 21 ms 10832 KB Output is correct
139 Correct 25 ms 10808 KB Output is correct
140 Correct 22 ms 10804 KB Output is correct
141 Correct 1 ms 1040 KB Output is correct
142 Correct 1 ms 1040 KB Output is correct
143 Correct 1 ms 1040 KB Output is correct
144 Correct 1 ms 464 KB Output is correct
145 Correct 1 ms 464 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 1 ms 1040 KB Output is correct
148 Correct 1 ms 1040 KB Output is correct
149 Correct 1 ms 1040 KB Output is correct
150 Correct 1 ms 1040 KB Output is correct
151 Correct 2 ms 1040 KB Output is correct
152 Correct 2 ms 1040 KB Output is correct
153 Correct 1 ms 464 KB Output is correct
154 Correct 1 ms 464 KB Output is correct
155 Correct 1 ms 464 KB Output is correct
156 Correct 1 ms 464 KB Output is correct
157 Correct 798 ms 22132 KB Output is correct
158 Correct 1079 ms 23080 KB Output is correct
159 Correct 898 ms 23092 KB Output is correct
160 Correct 910 ms 35472 KB Output is correct
161 Correct 1022 ms 35456 KB Output is correct
162 Correct 1083 ms 35424 KB Output is correct
163 Correct 759 ms 35480 KB Output is correct
164 Correct 851 ms 10832 KB Output is correct
165 Correct 799 ms 10804 KB Output is correct
166 Correct 746 ms 10812 KB Output is correct
167 Correct 656 ms 10796 KB Output is correct
168 Correct 1 ms 336 KB Output is correct
169 Correct 737 ms 10392 KB Output is correct
170 Correct 1045 ms 23060 KB Output is correct
171 Correct 1016 ms 23084 KB Output is correct
172 Correct 1016 ms 35480 KB Output is correct
173 Correct 1063 ms 35468 KB Output is correct
174 Correct 961 ms 35416 KB Output is correct
175 Correct 1031 ms 35468 KB Output is correct
176 Correct 825 ms 10832 KB Output is correct
177 Correct 741 ms 10812 KB Output is correct
178 Correct 800 ms 10792 KB Output is correct
179 Correct 802 ms 10824 KB Output is correct