Submission #625444

# Submission time Handle Problem Language Result Execution time Memory
625444 2022-08-10T11:53:19 Z model_code Radio Towers (IOI22_towers) C++17
100 / 100
1413 ms 105860 KB
#ifndef ATCODER_INTERNAL_BITOP_HPP
#define ATCODER_INTERNAL_BITOP_HPP 1

#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
constexpr int bsf_constexpr(unsigned int n) {
    int x = 0;
    while (!(n & (1 << x))) x++;
    return x;
}

// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
int bsf(unsigned int n) {
#ifdef _MSC_VER
    unsigned long index;
    _BitScanForward(&index, n);
    return index;
#else
    return __builtin_ctz(n);
#endif
}

}  // namespace internal

}  // namespace atcoder

#endif  // ATCODER_INTERNAL_BITOP_HPP

#ifndef ATCODER_SEGTREE_HPP
#define ATCODER_SEGTREE_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

template <class S, S (*op)(S, S), S (*e)()> struct segtree {
  public:
    segtree() : segtree(0) {}
    explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}
    explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {
        log = internal::ceil_pow2(_n);
        size = 1 << log;
        d = std::vector<S>(2 * size, e());
        for (int i = 0; i < _n; i++) d[size + i] = v[i];
        for (int i = size - 1; i >= 1; i--) {
            update(i);
        }
    }

    void set(int p, S x) {
        assert(0 <= p && p < _n);
        p += size;
        d[p] = x;
        for (int i = 1; i <= log; i++) update(p >> i);
    }

    S get(int p) const {
        assert(0 <= p && p < _n);
        return d[p + size];
    }

    S prod(int l, int r) const {
        assert(0 <= l && l <= r && r <= _n);
        S sml = e(), smr = e();
        l += size;
        r += size;

        while (l < r) {
            if (l & 1) sml = op(sml, d[l++]);
            if (r & 1) smr = op(d[--r], smr);
            l >>= 1;
            r >>= 1;
        }
        return op(sml, smr);
    }

    S all_prod() const { return d[1]; }

    template <bool (*f)(S)> int max_right(int l) const {
        return max_right(l, [](S x) { return f(x); });
    }
    template <class F> int max_right(int l, F f) const {
        assert(0 <= l && l <= _n);
        assert(f(e()));
        if (l == _n) return _n;
        l += size;
        S sm = e();
        do {
            while (l % 2 == 0) l >>= 1;
            if (!f(op(sm, d[l]))) {
                while (l < size) {
                    l = (2 * l);
                    if (f(op(sm, d[l]))) {
                        sm = op(sm, d[l]);
                        l++;
                    }
                }
                return l - size;
            }
            sm = op(sm, d[l]);
            l++;
        } while ((l & -l) != l);
        return _n;
    }

    template <bool (*f)(S)> int min_left(int r) const {
        return min_left(r, [](S x) { return f(x); });
    }
    template <class F> int min_left(int r, F f) const {
        assert(0 <= r && r <= _n);
        assert(f(e()));
        if (r == 0) return 0;
        r += size;
        S sm = e();
        do {
            r--;
            while (r > 1 && (r % 2)) r >>= 1;
            if (!f(op(d[r], sm))) {
                while (r < size) {
                    r = (2 * r + 1);
                    if (f(op(d[r], sm))) {
                        sm = op(d[r], sm);
                        r--;
                    }
                }
                return r + 1 - size;
            }
            sm = op(d[r], sm);
        } while ((r & -r) != r);
        return 0;
    }

  private:
    int _n, size, log;
    std::vector<S> d;

    void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};

}  // namespace atcoder

#endif  // ATCODER_SEGTREE_HPP

#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

struct Node {
  int max;
  int min;
  int max_right_min_left;
  int max_left_min_right;
};

typedef optional<Node> OptionalNode;

OptionalNode Empty() {
  return {};
}

OptionalNode Merge(OptionalNode l, OptionalNode r) {
  if (!l.has_value()) {
    return r;
  }
  if (!r.has_value()) {
    return l;
  }
  return (Node) {
    max(l.value().max, r.value().max),
    min(l.value().min, r.value().min),
    max(max(l.value().max_right_min_left, r.value().max_right_min_left),
        r.value().max - l.value().min),
    max(max(l.value().max_left_min_right, r.value().max_left_min_right),
        l.value().max - r.value().min)
  };
}

typedef atcoder::segtree<OptionalNode, Merge, Empty> Segtree;

int N;
vector<int> H;
Segtree st;

vector<int> maxD;
vector<int> maxDs;
map<int, int> ixMaxD;
int szMaxD;

struct PersistentNode {
  PersistentNode(
      pair<int, pair<int, int>> _val, PersistentNode* _l, PersistentNode* _r)
      : val(_val), l(_l), r(_r) {}

  pair<int, pair<int, int>> val;
  PersistentNode* l;
  PersistentNode* r;
};

pair<int, pair<int, int>> Merge(pair<int, pair<int, int>> l,
                                pair<int, pair<int, int>> r) {
  return {l.first + r.first, {min(l.second.first, r.second.first),
                              max(l.second.second, r.second.second)}};
}

vector<PersistentNode*> persistent_st;

PersistentNode* empty(int L, int R) {
  if (L == R) {
    return new PersistentNode({0, {INT_MAX, INT_MIN}}, NULL, NULL);
  }
  int M = (L + R) >> 1;
  return new PersistentNode({0, {INT_MAX, INT_MIN}},
                            empty(L, M), empty(M + 1, R));
}

PersistentNode* update(PersistentNode* node, int L, int R, int pos) {
  if (pos < L || pos > R) {
    return node;
  }
  if (L == R) {
    return new PersistentNode(Merge(node->val, {1, {pos, pos}}), NULL, NULL);
  }
  int M = (L + R) >> 1;
  return new PersistentNode(
      Merge(node->val, {1, {pos, pos}}),
      update(node->l, L, M, pos),
      update(node->r, M + 1, R, pos));
}

pair<int, pair<int, int>> query(
    PersistentNode* use, int L, int R, int x, int y) {
  if (x <= L && R <= y) {
    return use->val;
  }
  if (y < L || R < x) {
    return {0, {INT_MAX, INT_MIN}};
  }
  int M = (L + R) >> 1;
  return Merge(query(use->l, L, M, x, y), query(use->r, M + 1, R, x, y));
}

void init(int _N, std::vector<int> _H) {
  N = _N;
  H = _H;
  st = Segtree(N);
  for (int i = 0; i < N; ++i) {
    st.set(i, (Node) {H[i], H[i], INT_MIN, INT_MIN});
  }
  for (int i = 0; i < N; ++i) {
    int lower_height_left = st.min_left(
        i, [&] (OptionalNode node) {
          return !node.has_value() || node.value().min >= H[i];
        }) - 1;
    int lower_height_right = st.max_right(
        i + 1, [&] (OptionalNode node) {
          return !node.has_value() || node.value().min >= H[i];
        });
    int ret = INT_MAX;
    if (lower_height_left >= 0) {
      ret = min(ret, st.prod(lower_height_left + 1, i + 1).value().max - H[i]);
    }
    if (lower_height_right < N) {
      ret = min(ret, st.prod(i, lower_height_right).value().max - H[i]);
    }
    maxD.push_back(ret);
    maxDs.push_back(ret);
  }
  sort(maxDs.begin(), maxDs.end());
  maxDs.erase(unique(maxDs.begin(), maxDs.end()), maxDs.end());
  for (int i = 0; i < static_cast<int>(maxDs.size()); ++i) {
    ixMaxD[maxDs[i]] = i;
  }
  szMaxD = maxDs.size();
  vector<vector<int>> posMaxD(szMaxD);
  for (int i = 0; i < N; ++i) {
    posMaxD[ixMaxD[maxD[i]]].push_back(i);
  }
  persistent_st.resize(szMaxD + 1);
  persistent_st[szMaxD] = empty(0, N - 1);
  for (int i = szMaxD - 1; i >= 0; --i) {
    persistent_st[i] = persistent_st[i + 1];
    for (int j : posMaxD[i]) {
      persistent_st[i] = update(persistent_st[i], 0, N - 1, j);
    }
  }
}

int max_towers(int L, int R, int D) {
  int ixD = lower_bound(maxDs.begin(), maxDs.end(), D) - maxDs.begin();
  pair<int, pair<int, int>> ans = query(persistent_st[ixD], 0, N - 1, L, R);
  int answer = ans.first;
  if (answer == 0) {
    answer = 1;
    int minH = st.prod(L, R + 1).value().min;
    int minH_index = st.max_right(
      L, [&] (OptionalNode node) {
        return !node.has_value() || node.value().min > minH;
      });
    OptionalNode node_left = st.prod(L, minH_index);
    if (node_left.has_value() && node_left.value().max_right_min_left >= D) {
      ++answer;
    }
    OptionalNode node_right = st.prod(minH_index + 1, R + 1);
    if (node_right.has_value() && node_right.value().max_left_min_right >= D) {
      ++answer;
    }
    assert(answer <= 2);
    return answer;
  }
  int leftmost_answer = ans.second.first;
  int rightmost_answer = ans.second.second;
  OptionalNode node_left = st.prod(L, leftmost_answer);
  if (node_left.has_value() && node_left.value().max_right_min_left >= D) {
    ++answer;
  }
  OptionalNode node_right = st.prod(rightmost_answer + 1, R + 1);
  if (node_right.has_value() && node_right.value().max_left_min_right >= D) {
    ++answer;
  }
  return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 581 ms 57196 KB Output is correct
2 Correct 1163 ms 100328 KB Output is correct
3 Correct 1067 ms 100436 KB Output is correct
4 Correct 899 ms 100368 KB Output is correct
5 Correct 1169 ms 100268 KB Output is correct
6 Correct 1229 ms 100328 KB Output is correct
7 Correct 1109 ms 100276 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 3 ms 1616 KB Output is correct
10 Correct 3 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 544 KB Output is correct
2 Correct 3 ms 1744 KB Output is correct
3 Correct 3 ms 1744 KB Output is correct
4 Correct 3 ms 1744 KB Output is correct
5 Correct 3 ms 1828 KB Output is correct
6 Correct 3 ms 1744 KB Output is correct
7 Correct 3 ms 1744 KB Output is correct
8 Correct 3 ms 1696 KB Output is correct
9 Correct 3 ms 1616 KB Output is correct
10 Correct 3 ms 1616 KB Output is correct
11 Correct 5 ms 1688 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 3 ms 1616 KB Output is correct
14 Correct 3 ms 1616 KB Output is correct
15 Correct 5 ms 1744 KB Output is correct
16 Correct 3 ms 1744 KB Output is correct
17 Correct 3 ms 1828 KB Output is correct
18 Correct 3 ms 1616 KB Output is correct
19 Correct 4 ms 1700 KB Output is correct
20 Correct 3 ms 1744 KB Output is correct
21 Correct 3 ms 1744 KB Output is correct
22 Correct 4 ms 1744 KB Output is correct
23 Correct 3 ms 1616 KB Output is correct
24 Correct 3 ms 1700 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 4 ms 1744 KB Output is correct
30 Correct 3 ms 1828 KB Output is correct
31 Correct 3 ms 1744 KB Output is correct
32 Correct 3 ms 1616 KB Output is correct
33 Correct 3 ms 1616 KB Output is correct
34 Correct 3 ms 1616 KB Output is correct
35 Correct 3 ms 1616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 544 KB Output is correct
2 Correct 3 ms 1744 KB Output is correct
3 Correct 3 ms 1744 KB Output is correct
4 Correct 3 ms 1744 KB Output is correct
5 Correct 3 ms 1828 KB Output is correct
6 Correct 3 ms 1744 KB Output is correct
7 Correct 3 ms 1744 KB Output is correct
8 Correct 3 ms 1696 KB Output is correct
9 Correct 3 ms 1616 KB Output is correct
10 Correct 3 ms 1616 KB Output is correct
11 Correct 5 ms 1688 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 3 ms 1616 KB Output is correct
14 Correct 3 ms 1616 KB Output is correct
15 Correct 5 ms 1744 KB Output is correct
16 Correct 3 ms 1744 KB Output is correct
17 Correct 3 ms 1828 KB Output is correct
18 Correct 3 ms 1616 KB Output is correct
19 Correct 4 ms 1700 KB Output is correct
20 Correct 3 ms 1744 KB Output is correct
21 Correct 3 ms 1744 KB Output is correct
22 Correct 4 ms 1744 KB Output is correct
23 Correct 3 ms 1616 KB Output is correct
24 Correct 3 ms 1700 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 4 ms 1744 KB Output is correct
30 Correct 3 ms 1828 KB Output is correct
31 Correct 3 ms 1744 KB Output is correct
32 Correct 3 ms 1616 KB Output is correct
33 Correct 3 ms 1616 KB Output is correct
34 Correct 3 ms 1616 KB Output is correct
35 Correct 3 ms 1616 KB Output is correct
36 Correct 116 ms 64620 KB Output is correct
37 Correct 200 ms 103908 KB Output is correct
38 Correct 204 ms 103836 KB Output is correct
39 Correct 214 ms 105656 KB Output is correct
40 Correct 204 ms 105596 KB Output is correct
41 Correct 211 ms 105636 KB Output is correct
42 Correct 219 ms 105584 KB Output is correct
43 Correct 160 ms 100336 KB Output is correct
44 Correct 154 ms 100296 KB Output is correct
45 Correct 177 ms 100296 KB Output is correct
46 Correct 172 ms 100420 KB Output is correct
47 Correct 212 ms 103904 KB Output is correct
48 Correct 217 ms 105576 KB Output is correct
49 Correct 211 ms 105680 KB Output is correct
50 Correct 159 ms 100348 KB Output is correct
51 Correct 159 ms 100344 KB Output is correct
52 Correct 188 ms 103880 KB Output is correct
53 Correct 207 ms 105552 KB Output is correct
54 Correct 216 ms 105616 KB Output is correct
55 Correct 159 ms 100376 KB Output is correct
56 Correct 175 ms 100296 KB Output is correct
57 Correct 213 ms 100284 KB Output is correct
58 Correct 195 ms 103796 KB Output is correct
59 Correct 206 ms 103800 KB Output is correct
60 Correct 215 ms 105592 KB Output is correct
61 Correct 222 ms 105676 KB Output is correct
62 Correct 226 ms 105708 KB Output is correct
63 Correct 260 ms 105552 KB Output is correct
64 Correct 173 ms 100420 KB Output is correct
65 Correct 160 ms 100352 KB Output is correct
66 Correct 192 ms 100328 KB Output is correct
67 Correct 161 ms 100276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 963 ms 103100 KB Output is correct
2 Correct 1194 ms 103788 KB Output is correct
3 Correct 1277 ms 103900 KB Output is correct
4 Correct 1160 ms 105588 KB Output is correct
5 Correct 1222 ms 105636 KB Output is correct
6 Correct 1139 ms 105860 KB Output is correct
7 Correct 1128 ms 105604 KB Output is correct
8 Correct 1065 ms 100276 KB Output is correct
9 Correct 1146 ms 100296 KB Output is correct
10 Correct 1079 ms 100352 KB Output is correct
11 Correct 1151 ms 100280 KB Output is correct
12 Correct 1054 ms 100328 KB Output is correct
13 Correct 1305 ms 100392 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 4 ms 1616 KB Output is correct
16 Correct 2 ms 1616 KB Output is correct
17 Correct 194 ms 103848 KB Output is correct
18 Correct 236 ms 105608 KB Output is correct
19 Correct 221 ms 105620 KB Output is correct
20 Correct 152 ms 100372 KB Output is correct
21 Correct 156 ms 100372 KB Output is correct
22 Correct 198 ms 103840 KB Output is correct
23 Correct 222 ms 105612 KB Output is correct
24 Correct 232 ms 105640 KB Output is correct
25 Correct 153 ms 100332 KB Output is correct
26 Correct 191 ms 100296 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 1744 KB Output is correct
30 Correct 2 ms 1616 KB Output is correct
31 Correct 2 ms 1616 KB Output is correct
32 Correct 3 ms 1744 KB Output is correct
33 Correct 3 ms 1744 KB Output is correct
34 Correct 3 ms 1744 KB Output is correct
35 Correct 3 ms 1616 KB Output is correct
36 Correct 3 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 293 ms 22676 KB Output is correct
2 Correct 967 ms 103828 KB Output is correct
3 Correct 757 ms 103880 KB Output is correct
4 Correct 1008 ms 105640 KB Output is correct
5 Correct 998 ms 105664 KB Output is correct
6 Correct 862 ms 105620 KB Output is correct
7 Correct 841 ms 105552 KB Output is correct
8 Correct 990 ms 100388 KB Output is correct
9 Correct 1084 ms 100292 KB Output is correct
10 Correct 881 ms 100376 KB Output is correct
11 Correct 931 ms 100332 KB Output is correct
12 Correct 193 ms 103868 KB Output is correct
13 Correct 213 ms 105648 KB Output is correct
14 Correct 225 ms 105604 KB Output is correct
15 Correct 151 ms 100304 KB Output is correct
16 Correct 181 ms 100308 KB Output is correct
17 Correct 190 ms 100268 KB Output is correct
18 Correct 186 ms 103824 KB Output is correct
19 Correct 207 ms 103884 KB Output is correct
20 Correct 243 ms 105628 KB Output is correct
21 Correct 223 ms 105608 KB Output is correct
22 Correct 234 ms 105664 KB Output is correct
23 Correct 233 ms 105664 KB Output is correct
24 Correct 156 ms 100364 KB Output is correct
25 Correct 182 ms 100428 KB Output is correct
26 Correct 184 ms 100292 KB Output is correct
27 Correct 166 ms 100296 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 1744 KB Output is correct
30 Correct 3 ms 1744 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 3 ms 1616 KB Output is correct
33 Correct 1 ms 848 KB Output is correct
34 Correct 4 ms 1728 KB Output is correct
35 Correct 3 ms 1744 KB Output is correct
36 Correct 3 ms 1744 KB Output is correct
37 Correct 3 ms 1744 KB Output is correct
38 Correct 3 ms 1744 KB Output is correct
39 Correct 3 ms 1744 KB Output is correct
40 Correct 3 ms 1616 KB Output is correct
41 Correct 3 ms 1744 KB Output is correct
42 Correct 3 ms 1616 KB Output is correct
43 Correct 3 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 544 KB Output is correct
2 Correct 3 ms 1744 KB Output is correct
3 Correct 3 ms 1744 KB Output is correct
4 Correct 3 ms 1744 KB Output is correct
5 Correct 3 ms 1828 KB Output is correct
6 Correct 3 ms 1744 KB Output is correct
7 Correct 3 ms 1744 KB Output is correct
8 Correct 3 ms 1696 KB Output is correct
9 Correct 3 ms 1616 KB Output is correct
10 Correct 3 ms 1616 KB Output is correct
11 Correct 5 ms 1688 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 3 ms 1616 KB Output is correct
14 Correct 3 ms 1616 KB Output is correct
15 Correct 5 ms 1744 KB Output is correct
16 Correct 3 ms 1744 KB Output is correct
17 Correct 3 ms 1828 KB Output is correct
18 Correct 3 ms 1616 KB Output is correct
19 Correct 4 ms 1700 KB Output is correct
20 Correct 3 ms 1744 KB Output is correct
21 Correct 3 ms 1744 KB Output is correct
22 Correct 4 ms 1744 KB Output is correct
23 Correct 3 ms 1616 KB Output is correct
24 Correct 3 ms 1700 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 4 ms 1744 KB Output is correct
30 Correct 3 ms 1828 KB Output is correct
31 Correct 3 ms 1744 KB Output is correct
32 Correct 3 ms 1616 KB Output is correct
33 Correct 3 ms 1616 KB Output is correct
34 Correct 3 ms 1616 KB Output is correct
35 Correct 3 ms 1616 KB Output is correct
36 Correct 116 ms 64620 KB Output is correct
37 Correct 200 ms 103908 KB Output is correct
38 Correct 204 ms 103836 KB Output is correct
39 Correct 214 ms 105656 KB Output is correct
40 Correct 204 ms 105596 KB Output is correct
41 Correct 211 ms 105636 KB Output is correct
42 Correct 219 ms 105584 KB Output is correct
43 Correct 160 ms 100336 KB Output is correct
44 Correct 154 ms 100296 KB Output is correct
45 Correct 177 ms 100296 KB Output is correct
46 Correct 172 ms 100420 KB Output is correct
47 Correct 212 ms 103904 KB Output is correct
48 Correct 217 ms 105576 KB Output is correct
49 Correct 211 ms 105680 KB Output is correct
50 Correct 159 ms 100348 KB Output is correct
51 Correct 159 ms 100344 KB Output is correct
52 Correct 188 ms 103880 KB Output is correct
53 Correct 207 ms 105552 KB Output is correct
54 Correct 216 ms 105616 KB Output is correct
55 Correct 159 ms 100376 KB Output is correct
56 Correct 175 ms 100296 KB Output is correct
57 Correct 213 ms 100284 KB Output is correct
58 Correct 195 ms 103796 KB Output is correct
59 Correct 206 ms 103800 KB Output is correct
60 Correct 215 ms 105592 KB Output is correct
61 Correct 222 ms 105676 KB Output is correct
62 Correct 226 ms 105708 KB Output is correct
63 Correct 260 ms 105552 KB Output is correct
64 Correct 173 ms 100420 KB Output is correct
65 Correct 160 ms 100352 KB Output is correct
66 Correct 192 ms 100328 KB Output is correct
67 Correct 161 ms 100276 KB Output is correct
68 Correct 963 ms 103100 KB Output is correct
69 Correct 1194 ms 103788 KB Output is correct
70 Correct 1277 ms 103900 KB Output is correct
71 Correct 1160 ms 105588 KB Output is correct
72 Correct 1222 ms 105636 KB Output is correct
73 Correct 1139 ms 105860 KB Output is correct
74 Correct 1128 ms 105604 KB Output is correct
75 Correct 1065 ms 100276 KB Output is correct
76 Correct 1146 ms 100296 KB Output is correct
77 Correct 1079 ms 100352 KB Output is correct
78 Correct 1151 ms 100280 KB Output is correct
79 Correct 1054 ms 100328 KB Output is correct
80 Correct 1305 ms 100392 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 4 ms 1616 KB Output is correct
83 Correct 2 ms 1616 KB Output is correct
84 Correct 194 ms 103848 KB Output is correct
85 Correct 236 ms 105608 KB Output is correct
86 Correct 221 ms 105620 KB Output is correct
87 Correct 152 ms 100372 KB Output is correct
88 Correct 156 ms 100372 KB Output is correct
89 Correct 198 ms 103840 KB Output is correct
90 Correct 222 ms 105612 KB Output is correct
91 Correct 232 ms 105640 KB Output is correct
92 Correct 153 ms 100332 KB Output is correct
93 Correct 191 ms 100296 KB Output is correct
94 Correct 3 ms 1744 KB Output is correct
95 Correct 3 ms 1744 KB Output is correct
96 Correct 3 ms 1744 KB Output is correct
97 Correct 2 ms 1616 KB Output is correct
98 Correct 2 ms 1616 KB Output is correct
99 Correct 3 ms 1744 KB Output is correct
100 Correct 3 ms 1744 KB Output is correct
101 Correct 3 ms 1744 KB Output is correct
102 Correct 3 ms 1616 KB Output is correct
103 Correct 3 ms 1720 KB Output is correct
104 Correct 937 ms 92108 KB Output is correct
105 Correct 1193 ms 103808 KB Output is correct
106 Correct 1213 ms 103840 KB Output is correct
107 Correct 1025 ms 105616 KB Output is correct
108 Correct 1199 ms 105564 KB Output is correct
109 Correct 1135 ms 105556 KB Output is correct
110 Correct 1162 ms 105552 KB Output is correct
111 Correct 1243 ms 100336 KB Output is correct
112 Correct 1195 ms 100376 KB Output is correct
113 Correct 1202 ms 100360 KB Output is correct
114 Correct 1181 ms 100328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 581 ms 57196 KB Output is correct
2 Correct 1163 ms 100328 KB Output is correct
3 Correct 1067 ms 100436 KB Output is correct
4 Correct 899 ms 100368 KB Output is correct
5 Correct 1169 ms 100268 KB Output is correct
6 Correct 1229 ms 100328 KB Output is correct
7 Correct 1109 ms 100276 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 3 ms 1616 KB Output is correct
10 Correct 3 ms 1744 KB Output is correct
11 Correct 2 ms 544 KB Output is correct
12 Correct 3 ms 1744 KB Output is correct
13 Correct 3 ms 1744 KB Output is correct
14 Correct 3 ms 1744 KB Output is correct
15 Correct 3 ms 1828 KB Output is correct
16 Correct 3 ms 1744 KB Output is correct
17 Correct 3 ms 1744 KB Output is correct
18 Correct 3 ms 1696 KB Output is correct
19 Correct 3 ms 1616 KB Output is correct
20 Correct 3 ms 1616 KB Output is correct
21 Correct 5 ms 1688 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 3 ms 1616 KB Output is correct
24 Correct 3 ms 1616 KB Output is correct
25 Correct 5 ms 1744 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1828 KB Output is correct
28 Correct 3 ms 1616 KB Output is correct
29 Correct 4 ms 1700 KB Output is correct
30 Correct 3 ms 1744 KB Output is correct
31 Correct 3 ms 1744 KB Output is correct
32 Correct 4 ms 1744 KB Output is correct
33 Correct 3 ms 1616 KB Output is correct
34 Correct 3 ms 1700 KB Output is correct
35 Correct 1 ms 848 KB Output is correct
36 Correct 3 ms 1744 KB Output is correct
37 Correct 3 ms 1744 KB Output is correct
38 Correct 3 ms 1744 KB Output is correct
39 Correct 4 ms 1744 KB Output is correct
40 Correct 3 ms 1828 KB Output is correct
41 Correct 3 ms 1744 KB Output is correct
42 Correct 3 ms 1616 KB Output is correct
43 Correct 3 ms 1616 KB Output is correct
44 Correct 3 ms 1616 KB Output is correct
45 Correct 3 ms 1616 KB Output is correct
46 Correct 116 ms 64620 KB Output is correct
47 Correct 200 ms 103908 KB Output is correct
48 Correct 204 ms 103836 KB Output is correct
49 Correct 214 ms 105656 KB Output is correct
50 Correct 204 ms 105596 KB Output is correct
51 Correct 211 ms 105636 KB Output is correct
52 Correct 219 ms 105584 KB Output is correct
53 Correct 160 ms 100336 KB Output is correct
54 Correct 154 ms 100296 KB Output is correct
55 Correct 177 ms 100296 KB Output is correct
56 Correct 172 ms 100420 KB Output is correct
57 Correct 212 ms 103904 KB Output is correct
58 Correct 217 ms 105576 KB Output is correct
59 Correct 211 ms 105680 KB Output is correct
60 Correct 159 ms 100348 KB Output is correct
61 Correct 159 ms 100344 KB Output is correct
62 Correct 188 ms 103880 KB Output is correct
63 Correct 207 ms 105552 KB Output is correct
64 Correct 216 ms 105616 KB Output is correct
65 Correct 159 ms 100376 KB Output is correct
66 Correct 175 ms 100296 KB Output is correct
67 Correct 213 ms 100284 KB Output is correct
68 Correct 195 ms 103796 KB Output is correct
69 Correct 206 ms 103800 KB Output is correct
70 Correct 215 ms 105592 KB Output is correct
71 Correct 222 ms 105676 KB Output is correct
72 Correct 226 ms 105708 KB Output is correct
73 Correct 260 ms 105552 KB Output is correct
74 Correct 173 ms 100420 KB Output is correct
75 Correct 160 ms 100352 KB Output is correct
76 Correct 192 ms 100328 KB Output is correct
77 Correct 161 ms 100276 KB Output is correct
78 Correct 963 ms 103100 KB Output is correct
79 Correct 1194 ms 103788 KB Output is correct
80 Correct 1277 ms 103900 KB Output is correct
81 Correct 1160 ms 105588 KB Output is correct
82 Correct 1222 ms 105636 KB Output is correct
83 Correct 1139 ms 105860 KB Output is correct
84 Correct 1128 ms 105604 KB Output is correct
85 Correct 1065 ms 100276 KB Output is correct
86 Correct 1146 ms 100296 KB Output is correct
87 Correct 1079 ms 100352 KB Output is correct
88 Correct 1151 ms 100280 KB Output is correct
89 Correct 1054 ms 100328 KB Output is correct
90 Correct 1305 ms 100392 KB Output is correct
91 Correct 1 ms 208 KB Output is correct
92 Correct 4 ms 1616 KB Output is correct
93 Correct 2 ms 1616 KB Output is correct
94 Correct 194 ms 103848 KB Output is correct
95 Correct 236 ms 105608 KB Output is correct
96 Correct 221 ms 105620 KB Output is correct
97 Correct 152 ms 100372 KB Output is correct
98 Correct 156 ms 100372 KB Output is correct
99 Correct 198 ms 103840 KB Output is correct
100 Correct 222 ms 105612 KB Output is correct
101 Correct 232 ms 105640 KB Output is correct
102 Correct 153 ms 100332 KB Output is correct
103 Correct 191 ms 100296 KB Output is correct
104 Correct 3 ms 1744 KB Output is correct
105 Correct 3 ms 1744 KB Output is correct
106 Correct 3 ms 1744 KB Output is correct
107 Correct 2 ms 1616 KB Output is correct
108 Correct 2 ms 1616 KB Output is correct
109 Correct 3 ms 1744 KB Output is correct
110 Correct 3 ms 1744 KB Output is correct
111 Correct 3 ms 1744 KB Output is correct
112 Correct 3 ms 1616 KB Output is correct
113 Correct 3 ms 1720 KB Output is correct
114 Correct 293 ms 22676 KB Output is correct
115 Correct 967 ms 103828 KB Output is correct
116 Correct 757 ms 103880 KB Output is correct
117 Correct 1008 ms 105640 KB Output is correct
118 Correct 998 ms 105664 KB Output is correct
119 Correct 862 ms 105620 KB Output is correct
120 Correct 841 ms 105552 KB Output is correct
121 Correct 990 ms 100388 KB Output is correct
122 Correct 1084 ms 100292 KB Output is correct
123 Correct 881 ms 100376 KB Output is correct
124 Correct 931 ms 100332 KB Output is correct
125 Correct 193 ms 103868 KB Output is correct
126 Correct 213 ms 105648 KB Output is correct
127 Correct 225 ms 105604 KB Output is correct
128 Correct 151 ms 100304 KB Output is correct
129 Correct 181 ms 100308 KB Output is correct
130 Correct 190 ms 100268 KB Output is correct
131 Correct 186 ms 103824 KB Output is correct
132 Correct 207 ms 103884 KB Output is correct
133 Correct 243 ms 105628 KB Output is correct
134 Correct 223 ms 105608 KB Output is correct
135 Correct 234 ms 105664 KB Output is correct
136 Correct 233 ms 105664 KB Output is correct
137 Correct 156 ms 100364 KB Output is correct
138 Correct 182 ms 100428 KB Output is correct
139 Correct 184 ms 100292 KB Output is correct
140 Correct 166 ms 100296 KB Output is correct
141 Correct 3 ms 1744 KB Output is correct
142 Correct 3 ms 1744 KB Output is correct
143 Correct 3 ms 1744 KB Output is correct
144 Correct 3 ms 1616 KB Output is correct
145 Correct 3 ms 1616 KB Output is correct
146 Correct 1 ms 848 KB Output is correct
147 Correct 4 ms 1728 KB Output is correct
148 Correct 3 ms 1744 KB Output is correct
149 Correct 3 ms 1744 KB Output is correct
150 Correct 3 ms 1744 KB Output is correct
151 Correct 3 ms 1744 KB Output is correct
152 Correct 3 ms 1744 KB Output is correct
153 Correct 3 ms 1616 KB Output is correct
154 Correct 3 ms 1744 KB Output is correct
155 Correct 3 ms 1616 KB Output is correct
156 Correct 3 ms 1620 KB Output is correct
157 Correct 937 ms 92108 KB Output is correct
158 Correct 1193 ms 103808 KB Output is correct
159 Correct 1213 ms 103840 KB Output is correct
160 Correct 1025 ms 105616 KB Output is correct
161 Correct 1199 ms 105564 KB Output is correct
162 Correct 1135 ms 105556 KB Output is correct
163 Correct 1162 ms 105552 KB Output is correct
164 Correct 1243 ms 100336 KB Output is correct
165 Correct 1195 ms 100376 KB Output is correct
166 Correct 1202 ms 100360 KB Output is correct
167 Correct 1181 ms 100328 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 768 ms 34312 KB Output is correct
170 Correct 1193 ms 103784 KB Output is correct
171 Correct 1277 ms 103800 KB Output is correct
172 Correct 1237 ms 105564 KB Output is correct
173 Correct 1301 ms 105588 KB Output is correct
174 Correct 1335 ms 105580 KB Output is correct
175 Correct 1413 ms 105672 KB Output is correct
176 Correct 1110 ms 100344 KB Output is correct
177 Correct 1095 ms 100376 KB Output is correct
178 Correct 1235 ms 100272 KB Output is correct
179 Correct 1347 ms 100272 KB Output is correct