답안 #630366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
630366 2022-08-16T09:27:47 Z abeker 송신탑 (IOI22_towers) C++17
100 / 100
3602 ms 69556 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 jump(int x, int k, const vector <vector <int>> &anc) {
  for (int i = 0; i <= lg; i++)
    if (k >> i & 1)
      x = anc[x][i];
  return x;
}

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 = [&](const function <bool(int)> &f) {
    int lo = 0, hi = r - l + 1;
    while (lo < hi) {
      int mid = (lo + hi) / 2;
      if (f(mid))
        lo = mid + 1;
      else
        hi = mid;
    }
    return lo;
  };
  auto lb_lft_plus = [&](int k) {
    int node = jump(l, k, rig);
    return rig[node][0] <= r && H[node] - query(l, rig[node][0]) < d;
  };
  auto lb_rig_plus = [&](int k) {
    int node = jump(r, k, lft);
    return lft[node][0] >= l && H[node] - query(lft[node][0] + 1, r + 1) < d;
  };
  auto lb_lft_minus = [&](int k) {
    int node = jump(l, k, rig);
    return rig[node][0] <= r && lb[node] < d;
  };
  auto lb_rig_minus = [&](int k) {
    int node = jump(r, k, lft);
    return lft[node][0] >= l && lb[node] < d;
  };
  auto ub_lft_plus = [&](int k) {
    int node = jump(l, k, rig);
    return rig[node][0] <= r && H[rig[node][0]] - query(l, rig[node][0]) < d;
  };
  auto ub_rig_plus = [&](int k) {
    int node = jump(r, k, lft);
    return lft[node][0] >= l && H[lft[node][0]] - query(lft[node][0] + 1, r + 1) < d;
  };
  auto ub_lft_minus = [&](int k) {
    int node = jump(l, k, rig);
    return rig[node][0] <= r && ub[node] < d;
  };
  auto ub_rig_minus = [&](int k) {
    int node = jump(r, k, lft);
    return lft[node][0] >= l && ub[node] < d;
  };
  auto check_mx = [&](int k) {
    return rig[jump(l, k, rig)][0] <= r;
  };
  smaller_lb += binary(lb_lft_plus) + binary(lb_rig_plus) - binary(lb_lft_minus) - binary(lb_rig_minus);
  smaller_ub += binary(ub_lft_plus) + binary(ub_rig_plus) - binary(ub_lft_minus) - binary(ub_rig_minus);
  int arg_max = jump(l, binary(check_mx), rig);
  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]);
      |                                                                                    ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1485 ms 39820 KB Output is correct
2 Correct 3516 ms 69296 KB Output is correct
3 Correct 3545 ms 69260 KB Output is correct
4 Correct 3602 ms 69256 KB Output is correct
5 Correct 3453 ms 69364 KB Output is correct
6 Correct 3066 ms 69344 KB Output is correct
7 Correct 2660 ms 69376 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1380 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1360 KB Output is correct
5 Correct 2 ms 1360 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 3 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 1360 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 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 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 3 ms 1380 KB Output is correct
25 Correct 1 ms 720 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 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 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1380 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1360 KB Output is correct
5 Correct 2 ms 1360 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 3 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 1360 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 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 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 3 ms 1380 KB Output is correct
25 Correct 1 ms 720 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 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 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 73 ms 42824 KB Output is correct
37 Correct 142 ms 69268 KB Output is correct
38 Correct 124 ms 69360 KB Output is correct
39 Correct 119 ms 69368 KB Output is correct
40 Correct 117 ms 69372 KB Output is correct
41 Correct 129 ms 69304 KB Output is correct
42 Correct 127 ms 69376 KB Output is correct
43 Correct 107 ms 69340 KB Output is correct
44 Correct 106 ms 69344 KB Output is correct
45 Correct 124 ms 69316 KB Output is correct
46 Correct 107 ms 69320 KB Output is correct
47 Correct 120 ms 69380 KB Output is correct
48 Correct 117 ms 69268 KB Output is correct
49 Correct 127 ms 69268 KB Output is correct
50 Correct 106 ms 69280 KB Output is correct
51 Correct 115 ms 69320 KB Output is correct
52 Correct 126 ms 69264 KB Output is correct
53 Correct 125 ms 69272 KB Output is correct
54 Correct 120 ms 69312 KB Output is correct
55 Correct 109 ms 69548 KB Output is correct
56 Correct 105 ms 69388 KB Output is correct
57 Correct 121 ms 67460 KB Output is correct
58 Correct 118 ms 69352 KB Output is correct
59 Correct 148 ms 69340 KB Output is correct
60 Correct 132 ms 69272 KB Output is correct
61 Correct 117 ms 69312 KB Output is correct
62 Correct 133 ms 69372 KB Output is correct
63 Correct 121 ms 69388 KB Output is correct
64 Correct 104 ms 69336 KB Output is correct
65 Correct 105 ms 69356 KB Output is correct
66 Correct 113 ms 69336 KB Output is correct
67 Correct 116 ms 69368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2008 ms 68892 KB Output is correct
2 Correct 2736 ms 69372 KB Output is correct
3 Correct 2699 ms 69288 KB Output is correct
4 Correct 2501 ms 69368 KB Output is correct
5 Correct 2538 ms 69272 KB Output is correct
6 Correct 2408 ms 69292 KB Output is correct
7 Correct 2140 ms 69360 KB Output is correct
8 Correct 3042 ms 69380 KB Output is correct
9 Correct 2776 ms 69340 KB Output is correct
10 Correct 3390 ms 69368 KB Output is correct
11 Correct 2975 ms 69264 KB Output is correct
12 Correct 3513 ms 69348 KB Output is correct
13 Correct 3170 ms 69340 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 3 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 129 ms 69380 KB Output is correct
18 Correct 124 ms 69352 KB Output is correct
19 Correct 143 ms 69364 KB Output is correct
20 Correct 139 ms 69368 KB Output is correct
21 Correct 137 ms 69356 KB Output is correct
22 Correct 187 ms 69336 KB Output is correct
23 Correct 116 ms 69360 KB Output is correct
24 Correct 122 ms 69356 KB Output is correct
25 Correct 166 ms 69376 KB Output is correct
26 Correct 156 ms 69384 KB Output is correct
27 Correct 4 ms 1360 KB Output is correct
28 Correct 3 ms 1328 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 3 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 3 ms 1360 KB Output is correct
34 Correct 4 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 4 ms 1312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 840 ms 16560 KB Output is correct
2 Correct 2491 ms 69376 KB Output is correct
3 Correct 2567 ms 69372 KB Output is correct
4 Correct 2588 ms 69280 KB Output is correct
5 Correct 2157 ms 69252 KB Output is correct
6 Correct 1958 ms 69268 KB Output is correct
7 Correct 2043 ms 69364 KB Output is correct
8 Correct 2634 ms 69348 KB Output is correct
9 Correct 2539 ms 69384 KB Output is correct
10 Correct 2110 ms 69380 KB Output is correct
11 Correct 1881 ms 69380 KB Output is correct
12 Correct 127 ms 69280 KB Output is correct
13 Correct 117 ms 69324 KB Output is correct
14 Correct 117 ms 69372 KB Output is correct
15 Correct 117 ms 69556 KB Output is correct
16 Correct 119 ms 69328 KB Output is correct
17 Correct 117 ms 67420 KB Output is correct
18 Correct 121 ms 69312 KB Output is correct
19 Correct 133 ms 69288 KB Output is correct
20 Correct 125 ms 69252 KB Output is correct
21 Correct 127 ms 69268 KB Output is correct
22 Correct 117 ms 69332 KB Output is correct
23 Correct 125 ms 69324 KB Output is correct
24 Correct 112 ms 69264 KB Output is correct
25 Correct 117 ms 69376 KB Output is correct
26 Correct 110 ms 69388 KB Output is correct
27 Correct 114 ms 69276 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 1 ms 720 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 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 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1380 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 2 ms 1360 KB Output is correct
5 Correct 2 ms 1360 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 3 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 1360 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 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 2 ms 1360 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 3 ms 1380 KB Output is correct
25 Correct 1 ms 720 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 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 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 73 ms 42824 KB Output is correct
37 Correct 142 ms 69268 KB Output is correct
38 Correct 124 ms 69360 KB Output is correct
39 Correct 119 ms 69368 KB Output is correct
40 Correct 117 ms 69372 KB Output is correct
41 Correct 129 ms 69304 KB Output is correct
42 Correct 127 ms 69376 KB Output is correct
43 Correct 107 ms 69340 KB Output is correct
44 Correct 106 ms 69344 KB Output is correct
45 Correct 124 ms 69316 KB Output is correct
46 Correct 107 ms 69320 KB Output is correct
47 Correct 120 ms 69380 KB Output is correct
48 Correct 117 ms 69268 KB Output is correct
49 Correct 127 ms 69268 KB Output is correct
50 Correct 106 ms 69280 KB Output is correct
51 Correct 115 ms 69320 KB Output is correct
52 Correct 126 ms 69264 KB Output is correct
53 Correct 125 ms 69272 KB Output is correct
54 Correct 120 ms 69312 KB Output is correct
55 Correct 109 ms 69548 KB Output is correct
56 Correct 105 ms 69388 KB Output is correct
57 Correct 121 ms 67460 KB Output is correct
58 Correct 118 ms 69352 KB Output is correct
59 Correct 148 ms 69340 KB Output is correct
60 Correct 132 ms 69272 KB Output is correct
61 Correct 117 ms 69312 KB Output is correct
62 Correct 133 ms 69372 KB Output is correct
63 Correct 121 ms 69388 KB Output is correct
64 Correct 104 ms 69336 KB Output is correct
65 Correct 105 ms 69356 KB Output is correct
66 Correct 113 ms 69336 KB Output is correct
67 Correct 116 ms 69368 KB Output is correct
68 Correct 2008 ms 68892 KB Output is correct
69 Correct 2736 ms 69372 KB Output is correct
70 Correct 2699 ms 69288 KB Output is correct
71 Correct 2501 ms 69368 KB Output is correct
72 Correct 2538 ms 69272 KB Output is correct
73 Correct 2408 ms 69292 KB Output is correct
74 Correct 2140 ms 69360 KB Output is correct
75 Correct 3042 ms 69380 KB Output is correct
76 Correct 2776 ms 69340 KB Output is correct
77 Correct 3390 ms 69368 KB Output is correct
78 Correct 2975 ms 69264 KB Output is correct
79 Correct 3513 ms 69348 KB Output is correct
80 Correct 3170 ms 69340 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 3 ms 1360 KB Output is correct
83 Correct 2 ms 1360 KB Output is correct
84 Correct 129 ms 69380 KB Output is correct
85 Correct 124 ms 69352 KB Output is correct
86 Correct 143 ms 69364 KB Output is correct
87 Correct 139 ms 69368 KB Output is correct
88 Correct 137 ms 69356 KB Output is correct
89 Correct 187 ms 69336 KB Output is correct
90 Correct 116 ms 69360 KB Output is correct
91 Correct 122 ms 69356 KB Output is correct
92 Correct 166 ms 69376 KB Output is correct
93 Correct 156 ms 69384 KB Output is correct
94 Correct 4 ms 1360 KB Output is correct
95 Correct 3 ms 1328 KB Output is correct
96 Correct 2 ms 1360 KB Output is correct
97 Correct 3 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 3 ms 1360 KB Output is correct
101 Correct 4 ms 1360 KB Output is correct
102 Correct 2 ms 1360 KB Output is correct
103 Correct 4 ms 1312 KB Output is correct
104 Correct 2116 ms 63008 KB Output is correct
105 Correct 2427 ms 69312 KB Output is correct
106 Correct 2348 ms 69276 KB Output is correct
107 Correct 2460 ms 69300 KB Output is correct
108 Correct 2421 ms 69292 KB Output is correct
109 Correct 2467 ms 69288 KB Output is correct
110 Correct 2296 ms 69312 KB Output is correct
111 Correct 3049 ms 69296 KB Output is correct
112 Correct 3086 ms 69300 KB Output is correct
113 Correct 3031 ms 69376 KB Output is correct
114 Correct 3122 ms 69440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1485 ms 39820 KB Output is correct
2 Correct 3516 ms 69296 KB Output is correct
3 Correct 3545 ms 69260 KB Output is correct
4 Correct 3602 ms 69256 KB Output is correct
5 Correct 3453 ms 69364 KB Output is correct
6 Correct 3066 ms 69344 KB Output is correct
7 Correct 2660 ms 69376 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 3 ms 1380 KB Output is correct
13 Correct 2 ms 1360 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 2 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 0 ms 208 KB Output is correct
23 Correct 2 ms 1360 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 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 1360 KB Output is correct
34 Correct 3 ms 1380 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 2 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 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 1360 KB Output is correct
44 Correct 2 ms 1360 KB Output is correct
45 Correct 2 ms 1360 KB Output is correct
46 Correct 73 ms 42824 KB Output is correct
47 Correct 142 ms 69268 KB Output is correct
48 Correct 124 ms 69360 KB Output is correct
49 Correct 119 ms 69368 KB Output is correct
50 Correct 117 ms 69372 KB Output is correct
51 Correct 129 ms 69304 KB Output is correct
52 Correct 127 ms 69376 KB Output is correct
53 Correct 107 ms 69340 KB Output is correct
54 Correct 106 ms 69344 KB Output is correct
55 Correct 124 ms 69316 KB Output is correct
56 Correct 107 ms 69320 KB Output is correct
57 Correct 120 ms 69380 KB Output is correct
58 Correct 117 ms 69268 KB Output is correct
59 Correct 127 ms 69268 KB Output is correct
60 Correct 106 ms 69280 KB Output is correct
61 Correct 115 ms 69320 KB Output is correct
62 Correct 126 ms 69264 KB Output is correct
63 Correct 125 ms 69272 KB Output is correct
64 Correct 120 ms 69312 KB Output is correct
65 Correct 109 ms 69548 KB Output is correct
66 Correct 105 ms 69388 KB Output is correct
67 Correct 121 ms 67460 KB Output is correct
68 Correct 118 ms 69352 KB Output is correct
69 Correct 148 ms 69340 KB Output is correct
70 Correct 132 ms 69272 KB Output is correct
71 Correct 117 ms 69312 KB Output is correct
72 Correct 133 ms 69372 KB Output is correct
73 Correct 121 ms 69388 KB Output is correct
74 Correct 104 ms 69336 KB Output is correct
75 Correct 105 ms 69356 KB Output is correct
76 Correct 113 ms 69336 KB Output is correct
77 Correct 116 ms 69368 KB Output is correct
78 Correct 2008 ms 68892 KB Output is correct
79 Correct 2736 ms 69372 KB Output is correct
80 Correct 2699 ms 69288 KB Output is correct
81 Correct 2501 ms 69368 KB Output is correct
82 Correct 2538 ms 69272 KB Output is correct
83 Correct 2408 ms 69292 KB Output is correct
84 Correct 2140 ms 69360 KB Output is correct
85 Correct 3042 ms 69380 KB Output is correct
86 Correct 2776 ms 69340 KB Output is correct
87 Correct 3390 ms 69368 KB Output is correct
88 Correct 2975 ms 69264 KB Output is correct
89 Correct 3513 ms 69348 KB Output is correct
90 Correct 3170 ms 69340 KB Output is correct
91 Correct 1 ms 208 KB Output is correct
92 Correct 3 ms 1360 KB Output is correct
93 Correct 2 ms 1360 KB Output is correct
94 Correct 129 ms 69380 KB Output is correct
95 Correct 124 ms 69352 KB Output is correct
96 Correct 143 ms 69364 KB Output is correct
97 Correct 139 ms 69368 KB Output is correct
98 Correct 137 ms 69356 KB Output is correct
99 Correct 187 ms 69336 KB Output is correct
100 Correct 116 ms 69360 KB Output is correct
101 Correct 122 ms 69356 KB Output is correct
102 Correct 166 ms 69376 KB Output is correct
103 Correct 156 ms 69384 KB Output is correct
104 Correct 4 ms 1360 KB Output is correct
105 Correct 3 ms 1328 KB Output is correct
106 Correct 2 ms 1360 KB Output is correct
107 Correct 3 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 3 ms 1360 KB Output is correct
111 Correct 4 ms 1360 KB Output is correct
112 Correct 2 ms 1360 KB Output is correct
113 Correct 4 ms 1312 KB Output is correct
114 Correct 840 ms 16560 KB Output is correct
115 Correct 2491 ms 69376 KB Output is correct
116 Correct 2567 ms 69372 KB Output is correct
117 Correct 2588 ms 69280 KB Output is correct
118 Correct 2157 ms 69252 KB Output is correct
119 Correct 1958 ms 69268 KB Output is correct
120 Correct 2043 ms 69364 KB Output is correct
121 Correct 2634 ms 69348 KB Output is correct
122 Correct 2539 ms 69384 KB Output is correct
123 Correct 2110 ms 69380 KB Output is correct
124 Correct 1881 ms 69380 KB Output is correct
125 Correct 127 ms 69280 KB Output is correct
126 Correct 117 ms 69324 KB Output is correct
127 Correct 117 ms 69372 KB Output is correct
128 Correct 117 ms 69556 KB Output is correct
129 Correct 119 ms 69328 KB Output is correct
130 Correct 117 ms 67420 KB Output is correct
131 Correct 121 ms 69312 KB Output is correct
132 Correct 133 ms 69288 KB Output is correct
133 Correct 125 ms 69252 KB Output is correct
134 Correct 127 ms 69268 KB Output is correct
135 Correct 117 ms 69332 KB Output is correct
136 Correct 125 ms 69324 KB Output is correct
137 Correct 112 ms 69264 KB Output is correct
138 Correct 117 ms 69376 KB Output is correct
139 Correct 110 ms 69388 KB Output is correct
140 Correct 114 ms 69276 KB Output is correct
141 Correct 2 ms 1360 KB Output is correct
142 Correct 2 ms 1360 KB Output is correct
143 Correct 2 ms 1360 KB Output is correct
144 Correct 2 ms 1360 KB Output is correct
145 Correct 2 ms 1360 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 2 ms 1360 KB Output is correct
148 Correct 2 ms 1360 KB Output is correct
149 Correct 2 ms 1360 KB Output is correct
150 Correct 2 ms 1360 KB Output is correct
151 Correct 2 ms 1360 KB Output is correct
152 Correct 2 ms 1360 KB Output is correct
153 Correct 2 ms 1360 KB Output is correct
154 Correct 2 ms 1360 KB Output is correct
155 Correct 2 ms 1360 KB Output is correct
156 Correct 2 ms 1360 KB Output is correct
157 Correct 2116 ms 63008 KB Output is correct
158 Correct 2427 ms 69312 KB Output is correct
159 Correct 2348 ms 69276 KB Output is correct
160 Correct 2460 ms 69300 KB Output is correct
161 Correct 2421 ms 69292 KB Output is correct
162 Correct 2467 ms 69288 KB Output is correct
163 Correct 2296 ms 69312 KB Output is correct
164 Correct 3049 ms 69296 KB Output is correct
165 Correct 3086 ms 69300 KB Output is correct
166 Correct 3031 ms 69376 KB Output is correct
167 Correct 3122 ms 69440 KB Output is correct
168 Correct 1 ms 208 KB Output is correct
169 Correct 1424 ms 25876 KB Output is correct
170 Correct 2792 ms 69268 KB Output is correct
171 Correct 2562 ms 69368 KB Output is correct
172 Correct 2511 ms 69356 KB Output is correct
173 Correct 2546 ms 69284 KB Output is correct
174 Correct 2617 ms 69332 KB Output is correct
175 Correct 2693 ms 69360 KB Output is correct
176 Correct 3529 ms 69332 KB Output is correct
177 Correct 3252 ms 69296 KB Output is correct
178 Correct 3342 ms 69348 KB Output is correct
179 Correct 3312 ms 69464 KB Output is correct