Submission #626516

# Submission time Handle Problem Language Result Execution time Memory
626516 2022-08-11T13:44:51 Z ITO Radio Towers (IOI22_towers) C++17
100 / 100
1451 ms 30040 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;
int n, h[100005], hi[100005], mama[100005];
vector<pair<int, int>> pv;

int av[400000], bv[400000];
vector<int> aa[400000];

int build(int id, int ll, int rr) {
  if (ll == rr) {
    av[id] = h[ll];
    bv[id] = mama[ll];
    if (bv[id] == 2000000001) bv[id] = -1000000001;
    aa[id].push_back(mama[ll]);
  } else {
    int m = (ll + rr) / 2, i = 0, j = 0;
    av[id] = min(build(id * 2, ll, m), build(id * 2 + 1, m + 1, rr));
    bv[id] = max(bv[id * 2], bv[id * 2 + 1]);
    while (i < aa[id * 2].size() && j < aa[id * 2 + 1].size()) {
      if (aa[id * 2][i] <= aa[id * 2 + 1][j]) {
        aa[id].push_back(aa[id * 2][i]);
        i++;
      } else {
        aa[id].push_back(aa[id * 2 + 1][j]);
        j++;
      }
    }
    while (i < aa[id * 2].size()) {
      aa[id].push_back(aa[id * 2][i]);
      i++;
    }
    while (j < aa[id * 2 + 1].size()) {
      aa[id].push_back(aa[id * 2 + 1][j]);
      j++;
    }
  }
  return av[id];
}
int mi(int id, int l, int r, int ll, int rr) {
  if (r < ll || l > rr) return 2000000001;
  if (ll >= l && rr <= r) return av[id];
  int m = (ll + rr) / 2;
  return min(mi(id * 2, l, r, ll, m), mi(id * 2 + 1, l, r, m + 1, rr));
}
int lar(int id, int va, int l, int r, int ll, int rr) {
  if (r < ll || l > rr || bv[id] < va) return -1;
  if (ll == rr) return ll;
  int m = (ll + rr) / 2;
  int te = lar(id * 2 + 1, va, l, r, m + 1, rr);
  if (te >= 0) return te;
  return lar(id * 2, va, l, r, ll, m);
}
int lal(int id, int va, int l, int r, int ll, int rr) {
  if (r < ll || l > rr || bv[id] < va) return -1;
  if (ll == rr) return ll;
  int m = (ll + rr) / 2;
  int te = lal(id * 2, va, l, r, ll, m);
  if (te >= 0) return te;
  return lal(id * 2 + 1, va, l, r, m + 1, rr);
}
int bel(int id, int va, int l, int r, int ll, int rr) {
  if (r < ll || l > rr) return 0;
  if (ll >= l && r >= rr) {
    return upper_bound(aa[id].begin(), aa[id].end(), va) - aa[id].begin();
  }
  int m = (ll + rr) / 2;
  return bel(id * 2, va, l, r, ll, m) + bel(id * 2 + 1, va, l, r, m + 1, rr);
}

int rii[100005], lee[100005];
void init(int N, std::vector<int> H) {
  n = N;
  pv.push_back({-2000000001, -1});
  for (int i = 0; i < N; i++) {
    mama[i] = 2000000001;
    h[i] = H[i];
    int te = pv.size();
    if (te >= 2 && ((pv[te - 1].first > pv[te - 2].first && h[i] > pv[te - 1].first) || (pv[te - 1].first < pv[te - 2].first && h[i] < pv[te - 1].first))) {
      pv[te - 1] = make_pair(h[i], i);
    } else {
      pv.push_back({h[i], i});
    }
    hi[i] = (pv.size() - 1);
  }
  int te = pv.size();
  if ((pv[te - 1].first > pv[te - 2].first && -1000000001 > pv[te - 1].first) || (pv[te - 1].first < pv[te - 2].first && -1000000001 < pv[te - 1].first)) {
    pv[te - 1] = make_pair(-1000000001, N);
  } else {
    pv.push_back({-1000000001, N});
  }
  te = pv.size();
  priority_queue<pair<int, pair<int, int>>> pq;
  for (int i = 1; i < te; i++) {
    pq.push({-abs(pv[i].first - pv[i - 1].first), {i - 1, i}});
    rii[i - 1] = i;
    lee[i] = i - 1;
  }
  int xx = te / 2;
  while (1) {
    pair<int, pair<int, int>> pin = pq.top();
    pq.pop();
    if (lee[pin.second.first] == -1 || lee[pin.second.second] == -1) continue;
    pq.push({-abs(pv[lee[pin.second.first]].first - pv[rii[pin.second.second]].first), {lee[pin.second.first], rii[pin.second.second]}});
    if (pv[pin.second.first].first > pv[pin.second.second].first) {
      mama[pv[pin.second.first].second] = -pin.first;
    } else {
      mama[pv[pin.second.second].second] = -pin.first;
    }
    xx--;
    if (!xx) break;
    rii[lee[pin.second.first]] = rii[pin.second.second];
    lee[rii[pin.second.second]] = lee[pin.second.first];
    lee[pin.second.first] = -1;
    lee[pin.second.second] = -1;
  }
  build(1, 0, N - 1);
}

int max_towers(int L, int R, int D) {
  int lai = lal(1, D, L, R, 0, n - 1), rai = lar(1, D, L, R, 0, n - 1);
  if (hi[L] == hi[R] || lai == -1) return 1;
  int co = (hi[rai] - hi[lai]) / 2 - bel(1, D - 1, lai, rai, 0, n - 1);
  if (h[lai] - mi(1, L, lai, 0, n - 1) >= D) co++;
  if (h[rai] - mi(1, rai, R, 0, n - 1) >= D) co++;
  return max(1, co);
}

Compilation message

towers.cpp: In function 'int build(int, int, int)':
towers.cpp:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     while (i < aa[id * 2].size() && j < aa[id * 2 + 1].size()) {
      |            ~~^~~~~~~~~~~~~~~~~~~
towers.cpp:21:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     while (i < aa[id * 2].size() && j < aa[id * 2 + 1].size()) {
      |                                     ~~^~~~~~~~~~~~~~~~~~~~~~~
towers.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     while (i < aa[id * 2].size()) {
      |            ~~^~~~~~~~~~~~~~~~~~~
towers.cpp:34:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     while (j < aa[id * 2 + 1].size()) {
      |            ~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 412 ms 19100 KB Output is correct
2 Correct 1041 ms 26988 KB Output is correct
3 Correct 930 ms 27036 KB Output is correct
4 Correct 887 ms 27004 KB Output is correct
5 Correct 843 ms 26948 KB Output is correct
6 Correct 993 ms 26976 KB Output is correct
7 Correct 858 ms 26948 KB Output is correct
8 Correct 5 ms 9680 KB Output is correct
9 Correct 6 ms 9936 KB Output is correct
10 Correct 7 ms 9920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9936 KB Output is correct
3 Correct 7 ms 9936 KB Output is correct
4 Correct 6 ms 9936 KB Output is correct
5 Correct 6 ms 9948 KB Output is correct
6 Correct 7 ms 9944 KB Output is correct
7 Correct 6 ms 9936 KB Output is correct
8 Correct 6 ms 9936 KB Output is correct
9 Correct 6 ms 9872 KB Output is correct
10 Correct 6 ms 9936 KB Output is correct
11 Correct 6 ms 9940 KB Output is correct
12 Correct 5 ms 9692 KB Output is correct
13 Correct 6 ms 9948 KB Output is correct
14 Correct 6 ms 9936 KB Output is correct
15 Correct 6 ms 9936 KB Output is correct
16 Correct 7 ms 9936 KB Output is correct
17 Correct 6 ms 9936 KB Output is correct
18 Correct 8 ms 9944 KB Output is correct
19 Correct 6 ms 9948 KB Output is correct
20 Correct 6 ms 9956 KB Output is correct
21 Correct 7 ms 9948 KB Output is correct
22 Correct 7 ms 10056 KB Output is correct
23 Correct 6 ms 9948 KB Output is correct
24 Correct 6 ms 9952 KB Output is correct
25 Correct 5 ms 9816 KB Output is correct
26 Correct 6 ms 9944 KB Output is correct
27 Correct 7 ms 9948 KB Output is correct
28 Correct 6 ms 9948 KB Output is correct
29 Correct 6 ms 9948 KB Output is correct
30 Correct 8 ms 9948 KB Output is correct
31 Correct 6 ms 9948 KB Output is correct
32 Correct 6 ms 9944 KB Output is correct
33 Correct 7 ms 9948 KB Output is correct
34 Correct 6 ms 9944 KB Output is correct
35 Correct 6 ms 9948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9936 KB Output is correct
3 Correct 7 ms 9936 KB Output is correct
4 Correct 6 ms 9936 KB Output is correct
5 Correct 6 ms 9948 KB Output is correct
6 Correct 7 ms 9944 KB Output is correct
7 Correct 6 ms 9936 KB Output is correct
8 Correct 6 ms 9936 KB Output is correct
9 Correct 6 ms 9872 KB Output is correct
10 Correct 6 ms 9936 KB Output is correct
11 Correct 6 ms 9940 KB Output is correct
12 Correct 5 ms 9692 KB Output is correct
13 Correct 6 ms 9948 KB Output is correct
14 Correct 6 ms 9936 KB Output is correct
15 Correct 6 ms 9936 KB Output is correct
16 Correct 7 ms 9936 KB Output is correct
17 Correct 6 ms 9936 KB Output is correct
18 Correct 8 ms 9944 KB Output is correct
19 Correct 6 ms 9948 KB Output is correct
20 Correct 6 ms 9956 KB Output is correct
21 Correct 7 ms 9948 KB Output is correct
22 Correct 7 ms 10056 KB Output is correct
23 Correct 6 ms 9948 KB Output is correct
24 Correct 6 ms 9952 KB Output is correct
25 Correct 5 ms 9816 KB Output is correct
26 Correct 6 ms 9944 KB Output is correct
27 Correct 7 ms 9948 KB Output is correct
28 Correct 6 ms 9948 KB Output is correct
29 Correct 6 ms 9948 KB Output is correct
30 Correct 8 ms 9948 KB Output is correct
31 Correct 6 ms 9948 KB Output is correct
32 Correct 6 ms 9944 KB Output is correct
33 Correct 7 ms 9948 KB Output is correct
34 Correct 6 ms 9944 KB Output is correct
35 Correct 6 ms 9948 KB Output is correct
36 Correct 44 ms 20776 KB Output is correct
37 Correct 83 ms 29000 KB Output is correct
38 Correct 83 ms 29040 KB Output is correct
39 Correct 82 ms 29856 KB Output is correct
40 Correct 87 ms 29904 KB Output is correct
41 Correct 95 ms 29892 KB Output is correct
42 Correct 87 ms 29948 KB Output is correct
43 Correct 53 ms 26984 KB Output is correct
44 Correct 51 ms 26972 KB Output is correct
45 Correct 51 ms 27008 KB Output is correct
46 Correct 55 ms 27116 KB Output is correct
47 Correct 82 ms 29028 KB Output is correct
48 Correct 92 ms 29888 KB Output is correct
49 Correct 107 ms 29896 KB Output is correct
50 Correct 51 ms 27016 KB Output is correct
51 Correct 57 ms 26952 KB Output is correct
52 Correct 78 ms 29144 KB Output is correct
53 Correct 85 ms 29912 KB Output is correct
54 Correct 84 ms 29908 KB Output is correct
55 Correct 50 ms 26988 KB Output is correct
56 Correct 59 ms 27044 KB Output is correct
57 Correct 73 ms 28564 KB Output is correct
58 Correct 75 ms 28988 KB Output is correct
59 Correct 78 ms 28920 KB Output is correct
60 Correct 83 ms 29920 KB Output is correct
61 Correct 84 ms 29928 KB Output is correct
62 Correct 91 ms 30040 KB Output is correct
63 Correct 94 ms 29880 KB Output is correct
64 Correct 51 ms 26952 KB Output is correct
65 Correct 55 ms 27000 KB Output is correct
66 Correct 51 ms 26984 KB Output is correct
67 Correct 52 ms 26964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 977 ms 28964 KB Output is correct
2 Correct 1235 ms 28996 KB Output is correct
3 Correct 1228 ms 28904 KB Output is correct
4 Correct 1086 ms 29892 KB Output is correct
5 Correct 1092 ms 29840 KB Output is correct
6 Correct 968 ms 29888 KB Output is correct
7 Correct 1044 ms 29884 KB Output is correct
8 Correct 887 ms 26948 KB Output is correct
9 Correct 823 ms 26948 KB Output is correct
10 Correct 930 ms 27000 KB Output is correct
11 Correct 1000 ms 27004 KB Output is correct
12 Correct 871 ms 26988 KB Output is correct
13 Correct 916 ms 26996 KB Output is correct
14 Correct 5 ms 9680 KB Output is correct
15 Correct 6 ms 9936 KB Output is correct
16 Correct 6 ms 9936 KB Output is correct
17 Correct 70 ms 29012 KB Output is correct
18 Correct 88 ms 29908 KB Output is correct
19 Correct 86 ms 29908 KB Output is correct
20 Correct 69 ms 26988 KB Output is correct
21 Correct 55 ms 27020 KB Output is correct
22 Correct 72 ms 28984 KB Output is correct
23 Correct 84 ms 29896 KB Output is correct
24 Correct 83 ms 29920 KB Output is correct
25 Correct 54 ms 26976 KB Output is correct
26 Correct 69 ms 26976 KB Output is correct
27 Correct 6 ms 9936 KB Output is correct
28 Correct 6 ms 9936 KB Output is correct
29 Correct 6 ms 10028 KB Output is correct
30 Correct 6 ms 9936 KB Output is correct
31 Correct 6 ms 9944 KB Output is correct
32 Correct 8 ms 9924 KB Output is correct
33 Correct 8 ms 9936 KB Output is correct
34 Correct 7 ms 9936 KB Output is correct
35 Correct 6 ms 9936 KB Output is correct
36 Correct 6 ms 9868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 349 ms 14132 KB Output is correct
2 Correct 1100 ms 29008 KB Output is correct
3 Correct 1167 ms 28984 KB Output is correct
4 Correct 1186 ms 29936 KB Output is correct
5 Correct 1074 ms 29880 KB Output is correct
6 Correct 1076 ms 29884 KB Output is correct
7 Correct 1010 ms 29928 KB Output is correct
8 Correct 863 ms 26936 KB Output is correct
9 Correct 992 ms 26968 KB Output is correct
10 Correct 986 ms 26988 KB Output is correct
11 Correct 966 ms 27048 KB Output is correct
12 Correct 88 ms 29052 KB Output is correct
13 Correct 82 ms 29880 KB Output is correct
14 Correct 82 ms 29880 KB Output is correct
15 Correct 50 ms 26980 KB Output is correct
16 Correct 51 ms 26972 KB Output is correct
17 Correct 76 ms 28760 KB Output is correct
18 Correct 76 ms 28968 KB Output is correct
19 Correct 79 ms 28988 KB Output is correct
20 Correct 82 ms 29904 KB Output is correct
21 Correct 80 ms 29908 KB Output is correct
22 Correct 83 ms 29880 KB Output is correct
23 Correct 92 ms 29884 KB Output is correct
24 Correct 50 ms 27000 KB Output is correct
25 Correct 55 ms 27016 KB Output is correct
26 Correct 50 ms 26948 KB Output is correct
27 Correct 59 ms 26952 KB Output is correct
28 Correct 6 ms 9920 KB Output is correct
29 Correct 6 ms 9936 KB Output is correct
30 Correct 7 ms 9996 KB Output is correct
31 Correct 5 ms 9936 KB Output is correct
32 Correct 6 ms 9896 KB Output is correct
33 Correct 6 ms 9808 KB Output is correct
34 Correct 6 ms 9928 KB Output is correct
35 Correct 6 ms 9952 KB Output is correct
36 Correct 6 ms 9936 KB Output is correct
37 Correct 7 ms 9936 KB Output is correct
38 Correct 6 ms 10020 KB Output is correct
39 Correct 6 ms 9936 KB Output is correct
40 Correct 6 ms 9936 KB Output is correct
41 Correct 6 ms 9936 KB Output is correct
42 Correct 6 ms 9936 KB Output is correct
43 Correct 6 ms 9936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9936 KB Output is correct
3 Correct 7 ms 9936 KB Output is correct
4 Correct 6 ms 9936 KB Output is correct
5 Correct 6 ms 9948 KB Output is correct
6 Correct 7 ms 9944 KB Output is correct
7 Correct 6 ms 9936 KB Output is correct
8 Correct 6 ms 9936 KB Output is correct
9 Correct 6 ms 9872 KB Output is correct
10 Correct 6 ms 9936 KB Output is correct
11 Correct 6 ms 9940 KB Output is correct
12 Correct 5 ms 9692 KB Output is correct
13 Correct 6 ms 9948 KB Output is correct
14 Correct 6 ms 9936 KB Output is correct
15 Correct 6 ms 9936 KB Output is correct
16 Correct 7 ms 9936 KB Output is correct
17 Correct 6 ms 9936 KB Output is correct
18 Correct 8 ms 9944 KB Output is correct
19 Correct 6 ms 9948 KB Output is correct
20 Correct 6 ms 9956 KB Output is correct
21 Correct 7 ms 9948 KB Output is correct
22 Correct 7 ms 10056 KB Output is correct
23 Correct 6 ms 9948 KB Output is correct
24 Correct 6 ms 9952 KB Output is correct
25 Correct 5 ms 9816 KB Output is correct
26 Correct 6 ms 9944 KB Output is correct
27 Correct 7 ms 9948 KB Output is correct
28 Correct 6 ms 9948 KB Output is correct
29 Correct 6 ms 9948 KB Output is correct
30 Correct 8 ms 9948 KB Output is correct
31 Correct 6 ms 9948 KB Output is correct
32 Correct 6 ms 9944 KB Output is correct
33 Correct 7 ms 9948 KB Output is correct
34 Correct 6 ms 9944 KB Output is correct
35 Correct 6 ms 9948 KB Output is correct
36 Correct 44 ms 20776 KB Output is correct
37 Correct 83 ms 29000 KB Output is correct
38 Correct 83 ms 29040 KB Output is correct
39 Correct 82 ms 29856 KB Output is correct
40 Correct 87 ms 29904 KB Output is correct
41 Correct 95 ms 29892 KB Output is correct
42 Correct 87 ms 29948 KB Output is correct
43 Correct 53 ms 26984 KB Output is correct
44 Correct 51 ms 26972 KB Output is correct
45 Correct 51 ms 27008 KB Output is correct
46 Correct 55 ms 27116 KB Output is correct
47 Correct 82 ms 29028 KB Output is correct
48 Correct 92 ms 29888 KB Output is correct
49 Correct 107 ms 29896 KB Output is correct
50 Correct 51 ms 27016 KB Output is correct
51 Correct 57 ms 26952 KB Output is correct
52 Correct 78 ms 29144 KB Output is correct
53 Correct 85 ms 29912 KB Output is correct
54 Correct 84 ms 29908 KB Output is correct
55 Correct 50 ms 26988 KB Output is correct
56 Correct 59 ms 27044 KB Output is correct
57 Correct 73 ms 28564 KB Output is correct
58 Correct 75 ms 28988 KB Output is correct
59 Correct 78 ms 28920 KB Output is correct
60 Correct 83 ms 29920 KB Output is correct
61 Correct 84 ms 29928 KB Output is correct
62 Correct 91 ms 30040 KB Output is correct
63 Correct 94 ms 29880 KB Output is correct
64 Correct 51 ms 26952 KB Output is correct
65 Correct 55 ms 27000 KB Output is correct
66 Correct 51 ms 26984 KB Output is correct
67 Correct 52 ms 26964 KB Output is correct
68 Correct 977 ms 28964 KB Output is correct
69 Correct 1235 ms 28996 KB Output is correct
70 Correct 1228 ms 28904 KB Output is correct
71 Correct 1086 ms 29892 KB Output is correct
72 Correct 1092 ms 29840 KB Output is correct
73 Correct 968 ms 29888 KB Output is correct
74 Correct 1044 ms 29884 KB Output is correct
75 Correct 887 ms 26948 KB Output is correct
76 Correct 823 ms 26948 KB Output is correct
77 Correct 930 ms 27000 KB Output is correct
78 Correct 1000 ms 27004 KB Output is correct
79 Correct 871 ms 26988 KB Output is correct
80 Correct 916 ms 26996 KB Output is correct
81 Correct 5 ms 9680 KB Output is correct
82 Correct 6 ms 9936 KB Output is correct
83 Correct 6 ms 9936 KB Output is correct
84 Correct 70 ms 29012 KB Output is correct
85 Correct 88 ms 29908 KB Output is correct
86 Correct 86 ms 29908 KB Output is correct
87 Correct 69 ms 26988 KB Output is correct
88 Correct 55 ms 27020 KB Output is correct
89 Correct 72 ms 28984 KB Output is correct
90 Correct 84 ms 29896 KB Output is correct
91 Correct 83 ms 29920 KB Output is correct
92 Correct 54 ms 26976 KB Output is correct
93 Correct 69 ms 26976 KB Output is correct
94 Correct 6 ms 9936 KB Output is correct
95 Correct 6 ms 9936 KB Output is correct
96 Correct 6 ms 10028 KB Output is correct
97 Correct 6 ms 9936 KB Output is correct
98 Correct 6 ms 9944 KB Output is correct
99 Correct 8 ms 9924 KB Output is correct
100 Correct 8 ms 9936 KB Output is correct
101 Correct 7 ms 9936 KB Output is correct
102 Correct 6 ms 9936 KB Output is correct
103 Correct 6 ms 9868 KB Output is correct
104 Correct 998 ms 27732 KB Output is correct
105 Correct 1196 ms 28912 KB Output is correct
106 Correct 1260 ms 29008 KB Output is correct
107 Correct 1268 ms 29888 KB Output is correct
108 Correct 1276 ms 29904 KB Output is correct
109 Correct 1189 ms 29912 KB Output is correct
110 Correct 1135 ms 29908 KB Output is correct
111 Correct 789 ms 26948 KB Output is correct
112 Correct 763 ms 26960 KB Output is correct
113 Correct 1004 ms 26968 KB Output is correct
114 Correct 865 ms 26976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 412 ms 19100 KB Output is correct
2 Correct 1041 ms 26988 KB Output is correct
3 Correct 930 ms 27036 KB Output is correct
4 Correct 887 ms 27004 KB Output is correct
5 Correct 843 ms 26948 KB Output is correct
6 Correct 993 ms 26976 KB Output is correct
7 Correct 858 ms 26948 KB Output is correct
8 Correct 5 ms 9680 KB Output is correct
9 Correct 6 ms 9936 KB Output is correct
10 Correct 7 ms 9920 KB Output is correct
11 Correct 6 ms 9676 KB Output is correct
12 Correct 6 ms 9936 KB Output is correct
13 Correct 7 ms 9936 KB Output is correct
14 Correct 6 ms 9936 KB Output is correct
15 Correct 6 ms 9948 KB Output is correct
16 Correct 7 ms 9944 KB Output is correct
17 Correct 6 ms 9936 KB Output is correct
18 Correct 6 ms 9936 KB Output is correct
19 Correct 6 ms 9872 KB Output is correct
20 Correct 6 ms 9936 KB Output is correct
21 Correct 6 ms 9940 KB Output is correct
22 Correct 5 ms 9692 KB Output is correct
23 Correct 6 ms 9948 KB Output is correct
24 Correct 6 ms 9936 KB Output is correct
25 Correct 6 ms 9936 KB Output is correct
26 Correct 7 ms 9936 KB Output is correct
27 Correct 6 ms 9936 KB Output is correct
28 Correct 8 ms 9944 KB Output is correct
29 Correct 6 ms 9948 KB Output is correct
30 Correct 6 ms 9956 KB Output is correct
31 Correct 7 ms 9948 KB Output is correct
32 Correct 7 ms 10056 KB Output is correct
33 Correct 6 ms 9948 KB Output is correct
34 Correct 6 ms 9952 KB Output is correct
35 Correct 5 ms 9816 KB Output is correct
36 Correct 6 ms 9944 KB Output is correct
37 Correct 7 ms 9948 KB Output is correct
38 Correct 6 ms 9948 KB Output is correct
39 Correct 6 ms 9948 KB Output is correct
40 Correct 8 ms 9948 KB Output is correct
41 Correct 6 ms 9948 KB Output is correct
42 Correct 6 ms 9944 KB Output is correct
43 Correct 7 ms 9948 KB Output is correct
44 Correct 6 ms 9944 KB Output is correct
45 Correct 6 ms 9948 KB Output is correct
46 Correct 44 ms 20776 KB Output is correct
47 Correct 83 ms 29000 KB Output is correct
48 Correct 83 ms 29040 KB Output is correct
49 Correct 82 ms 29856 KB Output is correct
50 Correct 87 ms 29904 KB Output is correct
51 Correct 95 ms 29892 KB Output is correct
52 Correct 87 ms 29948 KB Output is correct
53 Correct 53 ms 26984 KB Output is correct
54 Correct 51 ms 26972 KB Output is correct
55 Correct 51 ms 27008 KB Output is correct
56 Correct 55 ms 27116 KB Output is correct
57 Correct 82 ms 29028 KB Output is correct
58 Correct 92 ms 29888 KB Output is correct
59 Correct 107 ms 29896 KB Output is correct
60 Correct 51 ms 27016 KB Output is correct
61 Correct 57 ms 26952 KB Output is correct
62 Correct 78 ms 29144 KB Output is correct
63 Correct 85 ms 29912 KB Output is correct
64 Correct 84 ms 29908 KB Output is correct
65 Correct 50 ms 26988 KB Output is correct
66 Correct 59 ms 27044 KB Output is correct
67 Correct 73 ms 28564 KB Output is correct
68 Correct 75 ms 28988 KB Output is correct
69 Correct 78 ms 28920 KB Output is correct
70 Correct 83 ms 29920 KB Output is correct
71 Correct 84 ms 29928 KB Output is correct
72 Correct 91 ms 30040 KB Output is correct
73 Correct 94 ms 29880 KB Output is correct
74 Correct 51 ms 26952 KB Output is correct
75 Correct 55 ms 27000 KB Output is correct
76 Correct 51 ms 26984 KB Output is correct
77 Correct 52 ms 26964 KB Output is correct
78 Correct 977 ms 28964 KB Output is correct
79 Correct 1235 ms 28996 KB Output is correct
80 Correct 1228 ms 28904 KB Output is correct
81 Correct 1086 ms 29892 KB Output is correct
82 Correct 1092 ms 29840 KB Output is correct
83 Correct 968 ms 29888 KB Output is correct
84 Correct 1044 ms 29884 KB Output is correct
85 Correct 887 ms 26948 KB Output is correct
86 Correct 823 ms 26948 KB Output is correct
87 Correct 930 ms 27000 KB Output is correct
88 Correct 1000 ms 27004 KB Output is correct
89 Correct 871 ms 26988 KB Output is correct
90 Correct 916 ms 26996 KB Output is correct
91 Correct 5 ms 9680 KB Output is correct
92 Correct 6 ms 9936 KB Output is correct
93 Correct 6 ms 9936 KB Output is correct
94 Correct 70 ms 29012 KB Output is correct
95 Correct 88 ms 29908 KB Output is correct
96 Correct 86 ms 29908 KB Output is correct
97 Correct 69 ms 26988 KB Output is correct
98 Correct 55 ms 27020 KB Output is correct
99 Correct 72 ms 28984 KB Output is correct
100 Correct 84 ms 29896 KB Output is correct
101 Correct 83 ms 29920 KB Output is correct
102 Correct 54 ms 26976 KB Output is correct
103 Correct 69 ms 26976 KB Output is correct
104 Correct 6 ms 9936 KB Output is correct
105 Correct 6 ms 9936 KB Output is correct
106 Correct 6 ms 10028 KB Output is correct
107 Correct 6 ms 9936 KB Output is correct
108 Correct 6 ms 9944 KB Output is correct
109 Correct 8 ms 9924 KB Output is correct
110 Correct 8 ms 9936 KB Output is correct
111 Correct 7 ms 9936 KB Output is correct
112 Correct 6 ms 9936 KB Output is correct
113 Correct 6 ms 9868 KB Output is correct
114 Correct 349 ms 14132 KB Output is correct
115 Correct 1100 ms 29008 KB Output is correct
116 Correct 1167 ms 28984 KB Output is correct
117 Correct 1186 ms 29936 KB Output is correct
118 Correct 1074 ms 29880 KB Output is correct
119 Correct 1076 ms 29884 KB Output is correct
120 Correct 1010 ms 29928 KB Output is correct
121 Correct 863 ms 26936 KB Output is correct
122 Correct 992 ms 26968 KB Output is correct
123 Correct 986 ms 26988 KB Output is correct
124 Correct 966 ms 27048 KB Output is correct
125 Correct 88 ms 29052 KB Output is correct
126 Correct 82 ms 29880 KB Output is correct
127 Correct 82 ms 29880 KB Output is correct
128 Correct 50 ms 26980 KB Output is correct
129 Correct 51 ms 26972 KB Output is correct
130 Correct 76 ms 28760 KB Output is correct
131 Correct 76 ms 28968 KB Output is correct
132 Correct 79 ms 28988 KB Output is correct
133 Correct 82 ms 29904 KB Output is correct
134 Correct 80 ms 29908 KB Output is correct
135 Correct 83 ms 29880 KB Output is correct
136 Correct 92 ms 29884 KB Output is correct
137 Correct 50 ms 27000 KB Output is correct
138 Correct 55 ms 27016 KB Output is correct
139 Correct 50 ms 26948 KB Output is correct
140 Correct 59 ms 26952 KB Output is correct
141 Correct 6 ms 9920 KB Output is correct
142 Correct 6 ms 9936 KB Output is correct
143 Correct 7 ms 9996 KB Output is correct
144 Correct 5 ms 9936 KB Output is correct
145 Correct 6 ms 9896 KB Output is correct
146 Correct 6 ms 9808 KB Output is correct
147 Correct 6 ms 9928 KB Output is correct
148 Correct 6 ms 9952 KB Output is correct
149 Correct 6 ms 9936 KB Output is correct
150 Correct 7 ms 9936 KB Output is correct
151 Correct 6 ms 10020 KB Output is correct
152 Correct 6 ms 9936 KB Output is correct
153 Correct 6 ms 9936 KB Output is correct
154 Correct 6 ms 9936 KB Output is correct
155 Correct 6 ms 9936 KB Output is correct
156 Correct 6 ms 9936 KB Output is correct
157 Correct 998 ms 27732 KB Output is correct
158 Correct 1196 ms 28912 KB Output is correct
159 Correct 1260 ms 29008 KB Output is correct
160 Correct 1268 ms 29888 KB Output is correct
161 Correct 1276 ms 29904 KB Output is correct
162 Correct 1189 ms 29912 KB Output is correct
163 Correct 1135 ms 29908 KB Output is correct
164 Correct 789 ms 26948 KB Output is correct
165 Correct 763 ms 26960 KB Output is correct
166 Correct 1004 ms 26968 KB Output is correct
167 Correct 865 ms 26976 KB Output is correct
168 Correct 5 ms 9680 KB Output is correct
169 Correct 950 ms 17084 KB Output is correct
170 Correct 1451 ms 29016 KB Output is correct
171 Correct 1263 ms 28980 KB Output is correct
172 Correct 1086 ms 29888 KB Output is correct
173 Correct 1300 ms 29888 KB Output is correct
174 Correct 1269 ms 29880 KB Output is correct
175 Correct 1325 ms 29884 KB Output is correct
176 Correct 944 ms 27028 KB Output is correct
177 Correct 743 ms 27044 KB Output is correct
178 Correct 907 ms 26948 KB Output is correct
179 Correct 885 ms 26948 KB Output is correct