답안 #736289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
736289 2023-05-05T12:00:12 Z math_rabbit_1028 송신탑 (IOI22_towers) C++17
100 / 100
2941 ms 39728 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
 
int n;
vector<int> arr;
vector<int> upidx, downidx;
 
struct localmax {
  int idx, d, l, r;
  bool operator<(const localmax &other) const {
    if (d == other.d) return idx < other.idx;
    return d < other.d;
  }
  void update() {
    d = arr[upidx[idx]] - max(arr[l], arr[r]);
  } 
} local_value[101010];
int adj[101010][2];
set<localmax> local;
 
vector< pair<int, int> > Dlist;
 
struct Node {
  Node *lt, *rt;
  int val;
  Node() {
    lt = rt = NULL;
    val = 0;
  }
};
Node *root[101010];
int first[101010];
 
void build(Node *node, int st, int ed) {
  if (st == ed) {
    node->val = first[st];
    return;
  }
  int mid = (st + ed) / 2;
  node->lt = new Node();
  node->rt = new Node();
  build(node->lt, st, mid);
  build(node->rt, mid + 1, ed);
  node->val = node->lt->val + node->rt->val;
}
 
void update(Node *prev, Node *now, int st, int ed, int idx, int value) {
  if (st == ed) {
    now->val = value;
    return;
  }
  int mid = (st + ed) / 2;
  if (idx <= mid) {
    now->lt = new Node();
    now->rt = prev->rt;
    update(prev->lt, now->lt, st, mid, idx, value);
  }
  else {
    now->lt = prev->lt;
    now->rt = new Node();
    update(prev->rt, now->rt, mid + 1, ed, idx, value);
  }
  now->val = now->lt->val + now->rt->val;
}
 
int get(Node *node, int st, int ed, int gs, int ge) {
  if (st > ge || ed < gs) return 0;
  if (gs <= st && ed <= ge) return node->val;
  int mid = (st + ed) / 2;
  return get(node->lt, st, mid, gs, ge) + get(node->rt, mid + 1, ed, gs, ge);
}


struct minseg {
  int tree[404040];
  vector<int> initarr;
  void init(int v, int st, int ed) {
    if (st == ed) {
      tree[v] = initarr[st];
      return;
    }
    int mid = (st + ed) / 2;
    init(2 * v, st, mid);
    init(2 * v + 1, mid + 1, ed);
    tree[v] = min(tree[2 * v], tree[2 * v + 1]);
  }
  int get(int v, int st, int ed, int gs, int ge) {
    if (st > ge || ed < gs) return 2e9;
    if (gs <= st && ed <= ge) return tree[v];
    int mid = (st + ed) / 2;
    return min(get(2 * v, st, mid, gs, ge), get(2 * v + 1, mid + 1, ed, gs, ge));
  }
} mintree;
 
void init(int N, vector<int> H) {
  n = N;
  for (int i = 0; i < n; i++) arr.push_back(H[i]);
  
  if (arr[0] < arr[1]) downidx.push_back(0);
  for (int i = 1; i < n - 1; i++) {
    if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) upidx.push_back(i);
    if (arr[i] < arr[i - 1] && arr[i] < arr[i + 1]) downidx.push_back(i);
  }
  if (arr[n - 1] < arr[n - 2]) downidx.push_back(n - 1);
 
  for (int i = 0; i < upidx.size(); i++) {
    local_value[i] = {i, 0, downidx[i], downidx[i + 1]};
    local_value[i].update();
    local.insert(local_value[i]);
    adj[i][0] = i - 1;
    adj[i][1] = i + 1;
  }
 
  while (!local.empty()) {
    localmax now = *local.begin();
    Dlist.push_back({now.d, upidx[now.idx]});
    int next = (arr[now.l] < arr[now.r] ? now.l : now.r);
    local.erase(local.begin());
    if (adj[now.idx][0] >= 0) {
      set<localmax>::iterator iter = local.find(local_value[adj[now.idx][0]]);
      if (iter != local.end()) {
        local.erase(iter);
        local_value[adj[now.idx][0]].r = next;
        local_value[adj[now.idx][0]].update();
        local.insert(local_value[adj[now.idx][0]]);
        adj[adj[now.idx][0]][1] = adj[now.idx][1];
      }
    }
    if (adj[now.idx][1] < upidx.size()) {
      set<localmax>::iterator iter = local.find(local_value[adj[now.idx][1]]);
      if (iter != local.end()) {
        local.erase(iter);
        local_value[adj[now.idx][1]].l = next;
        local_value[adj[now.idx][1]].update();
        local.insert(local_value[adj[now.idx][1]]);
        adj[adj[now.idx][1]][0] = adj[now.idx][0];
      }
    }
  }
 
  for (int i = 0; i < upidx.size(); i++) first[upidx[i]] = 1;
 
  root[0] = new Node();
  build(root[0], 0, n - 1);
  for (int i = 0; i < Dlist.size(); i++) {
    root[i + 1] = new Node();
    update(root[i], root[i + 1], 0, n - 1, Dlist[i].second, 0);
  }

  mintree.initarr = arr;
  mintree.init(1, 0, n - 1);
}

int max_towers(int L, int R, int D) {
  int d = lower_bound(Dlist.begin(), Dlist.end(), make_pair(D, 0)) - Dlist.begin();
  int ans = get(root[d], 0, n - 1, L, R) + 1;
  if (ans > 1) {
    int st = L, ed = R;
    while (st < ed) {
      int mid = (st + ed) / 2;
      if (get(root[d], 0, n - 1, L, mid) > 0) ed = mid;
      else st = mid + 1;
    }
    //cout << st << " " << mintree.get(1, 0, n - 1, L, st - 1) << "\n";
    if (mintree.get(1, 0, n - 1, L, st) + D > arr[st]) ans--;

    st = L, ed = R;
    while (st < ed) {
      int mid = (st + ed + 1) / 2;
      if (get(root[d], 0, n - 1, mid, R) > 0) st = mid;
      else ed = mid - 1;
    }
    //cout << st << " " << mintree.get(1, 0, n - 1, st + 1, R) << "\n";
    if (mintree.get(1, 0, n - 1, st, R) + D > arr[st]) ans--;
  }
  return max(1, ans);
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:107:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  107 |   for (int i = 0; i < upidx.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~
towers.cpp:130:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  130 |     if (adj[now.idx][1] < upidx.size()) {
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
towers.cpp:142:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  142 |   for (int i = 0; i < upidx.size(); i++) first[upidx[i]] = 1;
      |                   ~~^~~~~~~~~~~~~~
towers.cpp:146:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  146 |   for (int i = 0; i < Dlist.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 518 ms 5452 KB Output is correct
2 Correct 1014 ms 9144 KB Output is correct
3 Correct 1081 ms 9152 KB Output is correct
4 Correct 972 ms 9136 KB Output is correct
5 Correct 1018 ms 9136 KB Output is correct
6 Correct 913 ms 9152 KB Output is correct
7 Correct 857 ms 9132 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 2 ms 720 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 2 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 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 848 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 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 464 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 2 ms 720 KB Output is correct
28 Correct 2 ms 848 KB Output is correct
29 Correct 3 ms 848 KB Output is correct
30 Correct 2 ms 848 KB Output is correct
31 Correct 2 ms 848 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 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 2 ms 720 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 2 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 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 848 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 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 464 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 2 ms 720 KB Output is correct
28 Correct 2 ms 848 KB Output is correct
29 Correct 3 ms 848 KB Output is correct
30 Correct 2 ms 848 KB Output is correct
31 Correct 2 ms 848 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 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 55 ms 18720 KB Output is correct
37 Correct 107 ms 29616 KB Output is correct
38 Correct 82 ms 29488 KB Output is correct
39 Correct 128 ms 39616 KB Output is correct
40 Correct 138 ms 39516 KB Output is correct
41 Correct 150 ms 39508 KB Output is correct
42 Correct 138 ms 39580 KB Output is correct
43 Correct 22 ms 9160 KB Output is correct
44 Correct 21 ms 9124 KB Output is correct
45 Correct 23 ms 9140 KB Output is correct
46 Correct 20 ms 9128 KB Output is correct
47 Correct 89 ms 29500 KB Output is correct
48 Correct 138 ms 39524 KB Output is correct
49 Correct 142 ms 39616 KB Output is correct
50 Correct 20 ms 9132 KB Output is correct
51 Correct 21 ms 9132 KB Output is correct
52 Correct 84 ms 29504 KB Output is correct
53 Correct 125 ms 39624 KB Output is correct
54 Correct 142 ms 39628 KB Output is correct
55 Correct 27 ms 9132 KB Output is correct
56 Correct 21 ms 9136 KB Output is correct
57 Correct 89 ms 28580 KB Output is correct
58 Correct 85 ms 29560 KB Output is correct
59 Correct 88 ms 29624 KB Output is correct
60 Correct 122 ms 39612 KB Output is correct
61 Correct 126 ms 39568 KB Output is correct
62 Correct 125 ms 39596 KB Output is correct
63 Correct 128 ms 39564 KB Output is correct
64 Correct 21 ms 9132 KB Output is correct
65 Correct 21 ms 9136 KB Output is correct
66 Correct 25 ms 9092 KB Output is correct
67 Correct 27 ms 9152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1487 ms 29224 KB Output is correct
2 Correct 1741 ms 29616 KB Output is correct
3 Correct 1978 ms 29600 KB Output is correct
4 Correct 2009 ms 39556 KB Output is correct
5 Correct 2085 ms 39608 KB Output is correct
6 Correct 2039 ms 39576 KB Output is correct
7 Correct 2016 ms 39584 KB Output is correct
8 Correct 1091 ms 9112 KB Output is correct
9 Correct 939 ms 9132 KB Output is correct
10 Correct 1696 ms 9144 KB Output is correct
11 Correct 1821 ms 9136 KB Output is correct
12 Correct 950 ms 9152 KB Output is correct
13 Correct 1016 ms 9152 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 1 ms 464 KB Output is correct
17 Correct 102 ms 29472 KB Output is correct
18 Correct 137 ms 39592 KB Output is correct
19 Correct 143 ms 39604 KB Output is correct
20 Correct 21 ms 9140 KB Output is correct
21 Correct 21 ms 9152 KB Output is correct
22 Correct 91 ms 29496 KB Output is correct
23 Correct 118 ms 39596 KB Output is correct
24 Correct 149 ms 39720 KB Output is correct
25 Correct 21 ms 9172 KB Output is correct
26 Correct 20 ms 9148 KB Output is correct
27 Correct 1 ms 720 KB Output is correct
28 Correct 2 ms 848 KB Output is correct
29 Correct 2 ms 848 KB Output is correct
30 Correct 1 ms 464 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 2 ms 720 KB Output is correct
33 Correct 2 ms 848 KB Output is correct
34 Correct 2 ms 848 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 418 ms 6848 KB Output is correct
2 Correct 1112 ms 29596 KB Output is correct
3 Correct 1233 ms 29580 KB Output is correct
4 Correct 1350 ms 39712 KB Output is correct
5 Correct 1219 ms 39644 KB Output is correct
6 Correct 1454 ms 39576 KB Output is correct
7 Correct 1394 ms 39492 KB Output is correct
8 Correct 1032 ms 9156 KB Output is correct
9 Correct 890 ms 9132 KB Output is correct
10 Correct 1107 ms 9160 KB Output is correct
11 Correct 1144 ms 9156 KB Output is correct
12 Correct 88 ms 29464 KB Output is correct
13 Correct 141 ms 39612 KB Output is correct
14 Correct 133 ms 39728 KB Output is correct
15 Correct 28 ms 9136 KB Output is correct
16 Correct 26 ms 9132 KB Output is correct
17 Correct 92 ms 28588 KB Output is correct
18 Correct 99 ms 29688 KB Output is correct
19 Correct 83 ms 29628 KB Output is correct
20 Correct 124 ms 39616 KB Output is correct
21 Correct 167 ms 39600 KB Output is correct
22 Correct 128 ms 39520 KB Output is correct
23 Correct 143 ms 39680 KB Output is correct
24 Correct 28 ms 9136 KB Output is correct
25 Correct 26 ms 9140 KB Output is correct
26 Correct 23 ms 9148 KB Output is correct
27 Correct 21 ms 9136 KB Output is correct
28 Correct 1 ms 720 KB Output is correct
29 Correct 2 ms 848 KB Output is correct
30 Correct 2 ms 848 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 464 KB Output is correct
34 Correct 2 ms 732 KB Output is correct
35 Correct 2 ms 720 KB Output is correct
36 Correct 2 ms 848 KB Output is correct
37 Correct 2 ms 848 KB Output is correct
38 Correct 2 ms 848 KB Output is correct
39 Correct 2 ms 848 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 2 ms 720 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 2 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 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 848 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 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 464 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 2 ms 720 KB Output is correct
28 Correct 2 ms 848 KB Output is correct
29 Correct 3 ms 848 KB Output is correct
30 Correct 2 ms 848 KB Output is correct
31 Correct 2 ms 848 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 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 55 ms 18720 KB Output is correct
37 Correct 107 ms 29616 KB Output is correct
38 Correct 82 ms 29488 KB Output is correct
39 Correct 128 ms 39616 KB Output is correct
40 Correct 138 ms 39516 KB Output is correct
41 Correct 150 ms 39508 KB Output is correct
42 Correct 138 ms 39580 KB Output is correct
43 Correct 22 ms 9160 KB Output is correct
44 Correct 21 ms 9124 KB Output is correct
45 Correct 23 ms 9140 KB Output is correct
46 Correct 20 ms 9128 KB Output is correct
47 Correct 89 ms 29500 KB Output is correct
48 Correct 138 ms 39524 KB Output is correct
49 Correct 142 ms 39616 KB Output is correct
50 Correct 20 ms 9132 KB Output is correct
51 Correct 21 ms 9132 KB Output is correct
52 Correct 84 ms 29504 KB Output is correct
53 Correct 125 ms 39624 KB Output is correct
54 Correct 142 ms 39628 KB Output is correct
55 Correct 27 ms 9132 KB Output is correct
56 Correct 21 ms 9136 KB Output is correct
57 Correct 89 ms 28580 KB Output is correct
58 Correct 85 ms 29560 KB Output is correct
59 Correct 88 ms 29624 KB Output is correct
60 Correct 122 ms 39612 KB Output is correct
61 Correct 126 ms 39568 KB Output is correct
62 Correct 125 ms 39596 KB Output is correct
63 Correct 128 ms 39564 KB Output is correct
64 Correct 21 ms 9132 KB Output is correct
65 Correct 21 ms 9136 KB Output is correct
66 Correct 25 ms 9092 KB Output is correct
67 Correct 27 ms 9152 KB Output is correct
68 Correct 1487 ms 29224 KB Output is correct
69 Correct 1741 ms 29616 KB Output is correct
70 Correct 1978 ms 29600 KB Output is correct
71 Correct 2009 ms 39556 KB Output is correct
72 Correct 2085 ms 39608 KB Output is correct
73 Correct 2039 ms 39576 KB Output is correct
74 Correct 2016 ms 39584 KB Output is correct
75 Correct 1091 ms 9112 KB Output is correct
76 Correct 939 ms 9132 KB Output is correct
77 Correct 1696 ms 9144 KB Output is correct
78 Correct 1821 ms 9136 KB Output is correct
79 Correct 950 ms 9152 KB Output is correct
80 Correct 1016 ms 9152 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 1 ms 464 KB Output is correct
83 Correct 1 ms 464 KB Output is correct
84 Correct 102 ms 29472 KB Output is correct
85 Correct 137 ms 39592 KB Output is correct
86 Correct 143 ms 39604 KB Output is correct
87 Correct 21 ms 9140 KB Output is correct
88 Correct 21 ms 9152 KB Output is correct
89 Correct 91 ms 29496 KB Output is correct
90 Correct 118 ms 39596 KB Output is correct
91 Correct 149 ms 39720 KB Output is correct
92 Correct 21 ms 9172 KB Output is correct
93 Correct 20 ms 9148 KB Output is correct
94 Correct 1 ms 720 KB Output is correct
95 Correct 2 ms 848 KB Output is correct
96 Correct 2 ms 848 KB Output is correct
97 Correct 1 ms 464 KB Output is correct
98 Correct 1 ms 464 KB Output is correct
99 Correct 2 ms 720 KB Output is correct
100 Correct 2 ms 848 KB Output is correct
101 Correct 2 ms 848 KB Output is correct
102 Correct 1 ms 464 KB Output is correct
103 Correct 1 ms 464 KB Output is correct
104 Correct 1562 ms 26248 KB Output is correct
105 Correct 2015 ms 29504 KB Output is correct
106 Correct 1796 ms 29624 KB Output is correct
107 Correct 2132 ms 39612 KB Output is correct
108 Correct 2072 ms 39532 KB Output is correct
109 Correct 1931 ms 39596 KB Output is correct
110 Correct 2070 ms 39572 KB Output is correct
111 Correct 1010 ms 9140 KB Output is correct
112 Correct 955 ms 9140 KB Output is correct
113 Correct 1288 ms 9148 KB Output is correct
114 Correct 1329 ms 9140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 518 ms 5452 KB Output is correct
2 Correct 1014 ms 9144 KB Output is correct
3 Correct 1081 ms 9152 KB Output is correct
4 Correct 972 ms 9136 KB Output is correct
5 Correct 1018 ms 9136 KB Output is correct
6 Correct 913 ms 9152 KB Output is correct
7 Correct 857 ms 9132 KB Output is correct
8 Correct 0 ms 336 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 336 KB Output is correct
12 Correct 1 ms 720 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 2 ms 848 KB Output is correct
16 Correct 2 ms 848 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 2 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 208 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 2 ms 720 KB Output is correct
26 Correct 2 ms 848 KB Output is correct
27 Correct 2 ms 848 KB Output is correct
28 Correct 1 ms 464 KB Output is correct
29 Correct 1 ms 464 KB Output is correct
30 Correct 2 ms 720 KB Output is correct
31 Correct 2 ms 848 KB Output is correct
32 Correct 2 ms 848 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 464 KB Output is correct
36 Correct 1 ms 720 KB Output is correct
37 Correct 2 ms 720 KB Output is correct
38 Correct 2 ms 848 KB Output is correct
39 Correct 3 ms 848 KB Output is correct
40 Correct 2 ms 848 KB Output is correct
41 Correct 2 ms 848 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 464 KB Output is correct
45 Correct 1 ms 464 KB Output is correct
46 Correct 55 ms 18720 KB Output is correct
47 Correct 107 ms 29616 KB Output is correct
48 Correct 82 ms 29488 KB Output is correct
49 Correct 128 ms 39616 KB Output is correct
50 Correct 138 ms 39516 KB Output is correct
51 Correct 150 ms 39508 KB Output is correct
52 Correct 138 ms 39580 KB Output is correct
53 Correct 22 ms 9160 KB Output is correct
54 Correct 21 ms 9124 KB Output is correct
55 Correct 23 ms 9140 KB Output is correct
56 Correct 20 ms 9128 KB Output is correct
57 Correct 89 ms 29500 KB Output is correct
58 Correct 138 ms 39524 KB Output is correct
59 Correct 142 ms 39616 KB Output is correct
60 Correct 20 ms 9132 KB Output is correct
61 Correct 21 ms 9132 KB Output is correct
62 Correct 84 ms 29504 KB Output is correct
63 Correct 125 ms 39624 KB Output is correct
64 Correct 142 ms 39628 KB Output is correct
65 Correct 27 ms 9132 KB Output is correct
66 Correct 21 ms 9136 KB Output is correct
67 Correct 89 ms 28580 KB Output is correct
68 Correct 85 ms 29560 KB Output is correct
69 Correct 88 ms 29624 KB Output is correct
70 Correct 122 ms 39612 KB Output is correct
71 Correct 126 ms 39568 KB Output is correct
72 Correct 125 ms 39596 KB Output is correct
73 Correct 128 ms 39564 KB Output is correct
74 Correct 21 ms 9132 KB Output is correct
75 Correct 21 ms 9136 KB Output is correct
76 Correct 25 ms 9092 KB Output is correct
77 Correct 27 ms 9152 KB Output is correct
78 Correct 1487 ms 29224 KB Output is correct
79 Correct 1741 ms 29616 KB Output is correct
80 Correct 1978 ms 29600 KB Output is correct
81 Correct 2009 ms 39556 KB Output is correct
82 Correct 2085 ms 39608 KB Output is correct
83 Correct 2039 ms 39576 KB Output is correct
84 Correct 2016 ms 39584 KB Output is correct
85 Correct 1091 ms 9112 KB Output is correct
86 Correct 939 ms 9132 KB Output is correct
87 Correct 1696 ms 9144 KB Output is correct
88 Correct 1821 ms 9136 KB Output is correct
89 Correct 950 ms 9152 KB Output is correct
90 Correct 1016 ms 9152 KB Output is correct
91 Correct 1 ms 208 KB Output is correct
92 Correct 1 ms 464 KB Output is correct
93 Correct 1 ms 464 KB Output is correct
94 Correct 102 ms 29472 KB Output is correct
95 Correct 137 ms 39592 KB Output is correct
96 Correct 143 ms 39604 KB Output is correct
97 Correct 21 ms 9140 KB Output is correct
98 Correct 21 ms 9152 KB Output is correct
99 Correct 91 ms 29496 KB Output is correct
100 Correct 118 ms 39596 KB Output is correct
101 Correct 149 ms 39720 KB Output is correct
102 Correct 21 ms 9172 KB Output is correct
103 Correct 20 ms 9148 KB Output is correct
104 Correct 1 ms 720 KB Output is correct
105 Correct 2 ms 848 KB Output is correct
106 Correct 2 ms 848 KB Output is correct
107 Correct 1 ms 464 KB Output is correct
108 Correct 1 ms 464 KB Output is correct
109 Correct 2 ms 720 KB Output is correct
110 Correct 2 ms 848 KB Output is correct
111 Correct 2 ms 848 KB Output is correct
112 Correct 1 ms 464 KB Output is correct
113 Correct 1 ms 464 KB Output is correct
114 Correct 418 ms 6848 KB Output is correct
115 Correct 1112 ms 29596 KB Output is correct
116 Correct 1233 ms 29580 KB Output is correct
117 Correct 1350 ms 39712 KB Output is correct
118 Correct 1219 ms 39644 KB Output is correct
119 Correct 1454 ms 39576 KB Output is correct
120 Correct 1394 ms 39492 KB Output is correct
121 Correct 1032 ms 9156 KB Output is correct
122 Correct 890 ms 9132 KB Output is correct
123 Correct 1107 ms 9160 KB Output is correct
124 Correct 1144 ms 9156 KB Output is correct
125 Correct 88 ms 29464 KB Output is correct
126 Correct 141 ms 39612 KB Output is correct
127 Correct 133 ms 39728 KB Output is correct
128 Correct 28 ms 9136 KB Output is correct
129 Correct 26 ms 9132 KB Output is correct
130 Correct 92 ms 28588 KB Output is correct
131 Correct 99 ms 29688 KB Output is correct
132 Correct 83 ms 29628 KB Output is correct
133 Correct 124 ms 39616 KB Output is correct
134 Correct 167 ms 39600 KB Output is correct
135 Correct 128 ms 39520 KB Output is correct
136 Correct 143 ms 39680 KB Output is correct
137 Correct 28 ms 9136 KB Output is correct
138 Correct 26 ms 9140 KB Output is correct
139 Correct 23 ms 9148 KB Output is correct
140 Correct 21 ms 9136 KB Output is correct
141 Correct 1 ms 720 KB Output is correct
142 Correct 2 ms 848 KB Output is correct
143 Correct 2 ms 848 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 464 KB Output is correct
147 Correct 2 ms 732 KB Output is correct
148 Correct 2 ms 720 KB Output is correct
149 Correct 2 ms 848 KB Output is correct
150 Correct 2 ms 848 KB Output is correct
151 Correct 2 ms 848 KB Output is correct
152 Correct 2 ms 848 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 1562 ms 26248 KB Output is correct
158 Correct 2015 ms 29504 KB Output is correct
159 Correct 1796 ms 29624 KB Output is correct
160 Correct 2132 ms 39612 KB Output is correct
161 Correct 2072 ms 39532 KB Output is correct
162 Correct 1931 ms 39596 KB Output is correct
163 Correct 2070 ms 39572 KB Output is correct
164 Correct 1010 ms 9140 KB Output is correct
165 Correct 955 ms 9140 KB Output is correct
166 Correct 1288 ms 9148 KB Output is correct
167 Correct 1329 ms 9140 KB Output is correct
168 Correct 1 ms 208 KB Output is correct
169 Correct 1284 ms 10016 KB Output is correct
170 Correct 2510 ms 29528 KB Output is correct
171 Correct 2658 ms 29536 KB Output is correct
172 Correct 2791 ms 39632 KB Output is correct
173 Correct 2632 ms 39516 KB Output is correct
174 Correct 2290 ms 39528 KB Output is correct
175 Correct 2941 ms 39644 KB Output is correct
176 Correct 987 ms 9136 KB Output is correct
177 Correct 912 ms 9164 KB Output is correct
178 Correct 1540 ms 9136 KB Output is correct
179 Correct 1420 ms 9136 KB Output is correct