답안 #1030041

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030041 2024-07-21T17:15:02 Z avighna Progression (NOI20_progression) C++17
100 / 100
2127 ms 112004 KB
#include <bits/stdc++.h>

typedef long long ll;

class Node {
public:
  ll pref, suff, max;
  ll ele;
  ll size;

  Node(ll pref, ll suff, ll max, ll ele, ll size)
      : pref(pref), suff(suff), max(max), ele(ele), size(size) {}
  Node() : pref(0), suff(0), max(0), ele(-1), size(0) {}

  bool operator==(const Node &other) {
    return pref == other.pref and suff == other.suff and max == other.max and
           ele == other.ele and size == other.size;
  }
};

class SegmentTree {
public:
  std::vector<Node> seg;
  std::vector<bool> lazy;
  ll n;

  SegmentTree(ll n) {
    this->n = n;
    seg.resize(4 * n);
    lazy.resize(8 * n);
  }

  Node idt() { return Node(0, 0, 0, -1, 0); }

  Node f(Node a, Node b) {
    if (a == idt()) {
      return b;
    }
    if (b == idt()) {
      return a;
    }
    Node ans;
    ans.pref = a.pref;
    if (a.pref == a.size) {
      ans.pref += b.pref;
    }
    ans.suff = b.suff;
    if (b.suff == b.size) {
      ans.suff += a.suff;
    }
    ans.max = std::max(ans.max, ans.suff);
    ans.max = std::max(ans.max, ans.pref);
    ans.max = std::max(ans.max, a.suff + b.pref);
    ans.max = std::max(ans.max, a.max);
    ans.max = std::max(ans.max, b.max);
    ans.ele = a.ele;
    ans.size = a.size + b.size;
    return ans;
  }

  void construct(std::vector<ll> &a, ll v, ll tl, ll tr) {
    if (tl == tr) {
      if (a[tl] == 0) {
        seg[v] = Node(1, 1, 1, a[tl], 1);
      } else {
        seg[v] = Node(0, 0, 0, a[tl], 1);
      }
      return;
    }
    ll tm = (tl + tr) / 2;
    construct(a, 2 * v, tl, tm);
    construct(a, 2 * v + 1, tm + 1, tr);
    seg[v] = f(seg[2 * v], seg[2 * v + 1]);
  }

  void lazy_update(ll v, ll tl, ll tr) {
    if (lazy[v]) {
      lazy[v] = false;
      ll size = tr - tl + 1;
      seg[v] = Node(size, size, size, 0, size);
      lazy[2 * v] = lazy[2 * v + 1] = true;
    }
  }

  Node query(ll v, ll tl, ll tr, ll l, ll r) {
    lazy_update(v, tl, tr);
    if (tl > tr || l > r || tr < l || r < tl) {
      return idt();
    }
    if (l <= tl && tr <= r) {
      return seg[v];
    }
    ll tm = (tl + tr) / 2;
    return f(query(2 * v, tl, tm, l, r), query(2 * v + 1, tm + 1, tr, l, r));
  }
  Node query(ll l, ll r) { return query(1, 0, n, l, r); }

  void update(ll v, ll tl, ll tr, ll idx, ll del) {
    lazy_update(v, tl, tr);
    if (tl > tr || (!(tl <= idx && idx <= tr))) {
      return;
    }
    if (tl != tr) {
      ll tm = (tl + tr) / 2;
      update(2 * v, tl, tm, idx, del);
      update(2 * v + 1, tm + 1, tr, idx, del);
      seg[v] = f(seg[2 * v], seg[2 * v + 1]);
    } else {
      seg[v].ele += del;
      if (seg[v].ele == 0) {
        seg[v] = Node(1, 1, 1, seg[v].ele, 1);
      } else {
        seg[v] = Node(0, 0, 0, seg[v].ele, 1);
      }
    }
  }
  void update(ll idx, ll del) { update(1, 0, n, idx, del); }

  void zero_range(ll v, ll tl, ll tr, ll l, ll r) {
    lazy_update(v, tl, tr);
    if (tl > tr || l > r || tr < l || r < tl) {
      return;
    }
    if (l <= tl && tr <= r) {
      ll size = tr - tl + 1;
      seg[v] = Node(size, size, size, 0, size);
      lazy[2 * v] = lazy[2 * v + 1] = true;
      return;
    }
    ll tm = (tl + tr) / 2;
    zero_range(2 * v, tl, tm, l, r);
    zero_range(2 * v + 1, tm + 1, tr, l, r);
  }
  void zero_range(ll l, ll r) { zero_range(1, 0, n, l, r); }
};

class LazySegmentTree {
private:
  enum type { ADD, SET };
  std::vector<std::array<ll, 2>> lazy;

public:
  std::vector<ll> seg;
  ll n;

  ll f(ll a, ll b) { return a + b; }
  // For a bitwise AND, this would be 1, since x AND x = x (and not 2x)
  ll f_update_range(ll size) { return size; }
  ll idt() { return 0; }

  LazySegmentTree(ll n) {
    this->n = n;
    seg.resize(4 * n, idt());
    lazy.resize(8 * n);
    for (ll i = 0; i < 8 * n; ++i) {
      lazy[i][SET] = -1;
    }
  }

  void do_lazy_update(ll v, ll size) {
    if (lazy[v][SET] != -1) {
      seg[v] = lazy[v][SET] * size;
      lazy[2 * v][SET] = lazy[2 * v + 1][SET] = lazy[v][SET];
      lazy[2 * v][ADD] = lazy[2 * v + 1][ADD] = 0;
      lazy[v][SET] = -1;
    }
    if (lazy[v][ADD] != 0) {
      seg[v] += lazy[v][ADD] * size;
      lazy[2 * v][ADD] += lazy[v][ADD];
      lazy[2 * v + 1][ADD] += lazy[v][ADD];
      lazy[v][ADD] = 0;
    }
  }

  void add(ll v, ll tl, ll tr, ll l, ll r, ll delta) {
    ll size = f_update_range(tr - tl + 1);
    do_lazy_update(v, size);
    // [tl, tr] ... [l, r] or [l, r] ... [tl, tr]
    if (tr < l || r < tl || l > r || tl > tr) {
      return;
    }
    // [l, [tl, tr], r]
    if (l <= tl && tr <= r) {
      seg[v] += delta * size;
      lazy[2 * v][ADD] += delta;
      lazy[2 * v + 1][ADD] += delta;
      return;
    }
    ll tm = (tl + tr) / 2;
    add(2 * v, tl, tm, l, r, delta);
    add(2 * v + 1, tm + 1, tr, l, r, delta);
    seg[v] = f(seg[2 * v], seg[2 * v + 1]);
  }
  void add(ll l, ll r, ll delta) { add(1, 0, n, l, r, delta); }
  void add(ll idx, ll delta) { add(idx, idx, delta); }

  void set(ll v, ll tl, ll tr, ll l, ll r, ll x) {
    ll size = f_update_range(tr - tl + 1);
    do_lazy_update(v, size);
    // [tl, tr] ... [l, r] or [l, r] ... [tl, tr]
    if (tr < l || r < tl || l > r || tl > tr) {
      return;
    }
    // [l, [tl, tr], r]
    if (l <= tl && tr <= r) {
      seg[v] = x * size;
      lazy[2 * v][SET] = lazy[2 * v + 1][SET] = x;
      lazy[2 * v][ADD] = lazy[2 * v + 1][ADD] = 0;
      return;
    }
    ll tm = (tl + tr) / 2;
    set(2 * v, tl, tm, l, r, x);
    set(2 * v + 1, tm + 1, tr, l, r, x);
    seg[v] = f(seg[2 * v], seg[2 * v + 1]);
  }
  void set(ll l, ll r, ll x) { set(1, 0, n, l, r, x); }
  void set(ll idx, ll x) { set(idx, idx, x); }

  ll query(ll v, ll tl, ll tr, ll l, ll r) {
    do_lazy_update(v, f_update_range(tr - tl + 1));
    // [tl, tr] ... [l, r] or [l, r] ... [tl, tr]
    if (tr < l || r < tl || l > r || tl > tr) {
      return idt();
    }
    // [l, [tl, tr], r]
    if (l <= tl && tr <= r) {
      return seg[v];
    }
    ll tm = (tl + tr) / 2;
    return f(query(2 * v, tl, tm, l, r), query(2 * v + 1, tm + 1, tr, l, r));
  }
  ll query(ll l, ll r) { return query(1, 0, n, l, r); }
};

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  ll n, q;
  std::cin >> n >> q;
  std::vector<ll> d(n + 1);
  for (ll i = 0; i < n; ++i) {
    std::cin >> d[i];
  }
  std::vector<ll> diff(n + 1);
  std::adjacent_difference(d.begin(), d.end(), diff.begin());
  std::vector<ll> diff_diff(n + 1);
  std::adjacent_difference(diff.begin(), diff.end(), diff_diff.begin());

  SegmentTree tree(n);
  LazySegmentTree diff_tree(n);
  tree.construct(diff_diff, 1, 0, n);
  for (ll i = 0; i < n; ++i) {
    diff_tree.add(i, diff[i]);
  }

  auto diff_update = [&](ll l, ll r, ll s, ll c) {
    diff_tree.add(l, s);
    diff_tree.add(r + 1, -s - (r - l) * c);
    if (l + 1 <= r) {
      diff_tree.add(l + 1, r, c);
    }
  };

  auto update = [&](ll l, ll r, ll s, ll c) {
    tree.update(l, s);
    tree.update(l + 1, -s);
    tree.update(r + 1, -s);
    if (r + 2 <= n) {
      tree.update(r + 2, s);
    }
    if (l != r) {
      tree.update(l + 1, c);
      tree.update(r + 1, -c - (r - l) * c);
      if (r + 2 <= n) {
        tree.update(r + 2, (r - l) * c);
      }
    }
  };

  auto set_to_zero = [&](ll l) {
    ll pref_1 = diff_tree.query(0, l);
    diff_tree.add(l, -pref_1);
    diff_tree.add(l + 1, pref_1);
    tree.update(l, -pref_1);
    tree.update(l + 1, 2 * pref_1);
    tree.update(l + 2, -pref_1);
  };

  auto recalculate = [&](ll i) {
    tree.update(i, -tree.query(i, i).ele + diff_tree.query(i, i) -
                       diff_tree.query(i - 1, i - 1));
  };

  while (q--) {
    ll t;
    std::cin >> t;
    ll l, r;
    std::cin >> l >> r;
    --l, --r;
    if (t == 1) {
      ll s, c;
      std::cin >> s >> c;
      update(l, r, s, c);
      diff_update(l, r, s, c);
    } else if (t == 2) {
      ll s, c;
      std::cin >> s >> c;
      if (r - l <= 2) {
        for (ll i = l; i <= r; ++i) {
          set_to_zero(i);
        }
      } else {
        ll pref_1 = diff_tree.query(0, l);
        ll pref_2 = diff_tree.query(0, r);
        diff_tree.add(l, -pref_1);
        diff_tree.set(l + 1, r, 0);
        diff_tree.add(r + 1, pref_2);
        recalculate(l);
        recalculate(l + 1);
        tree.zero_range(l + 2, r);
        recalculate(r + 1);
        recalculate(r + 2);
      }
      update(l, r, s, c);
      diff_update(l, r, s, c);
    } else {
      if (l + 2 > r) {
        std::cout << r - l + 1 << '\n';
      } else {
        std::cout << tree.query(l + 2, r).max + 2 << '\n';
      }
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1143 ms 110160 KB Output is correct
2 Correct 265 ms 3580 KB Output is correct
3 Correct 274 ms 3524 KB Output is correct
4 Correct 267 ms 3664 KB Output is correct
5 Correct 277 ms 3540 KB Output is correct
6 Correct 231 ms 3664 KB Output is correct
7 Correct 229 ms 3548 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 356 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1138 ms 110268 KB Output is correct
12 Correct 1077 ms 110220 KB Output is correct
13 Correct 1118 ms 110552 KB Output is correct
14 Correct 1142 ms 110468 KB Output is correct
15 Correct 1059 ms 110416 KB Output is correct
16 Correct 1076 ms 110164 KB Output is correct
17 Correct 1127 ms 110036 KB Output is correct
18 Correct 1080 ms 110180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 5 ms 600 KB Output is correct
9 Correct 3 ms 600 KB Output is correct
10 Correct 5 ms 604 KB Output is correct
11 Correct 2 ms 720 KB Output is correct
12 Correct 4 ms 720 KB Output is correct
13 Correct 2 ms 824 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 4 ms 604 KB Output is correct
16 Correct 6 ms 604 KB Output is correct
17 Correct 4 ms 604 KB Output is correct
18 Correct 4 ms 860 KB Output is correct
19 Correct 2 ms 464 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 370 ms 108748 KB Output is correct
2 Correct 60 ms 3004 KB Output is correct
3 Correct 73 ms 3008 KB Output is correct
4 Correct 61 ms 2912 KB Output is correct
5 Correct 61 ms 3160 KB Output is correct
6 Correct 78 ms 3288 KB Output is correct
7 Correct 63 ms 3068 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 460 KB Output is correct
11 Correct 367 ms 107196 KB Output is correct
12 Correct 365 ms 108712 KB Output is correct
13 Correct 357 ms 107352 KB Output is correct
14 Correct 384 ms 107284 KB Output is correct
15 Correct 392 ms 108712 KB Output is correct
16 Correct 420 ms 109392 KB Output is correct
17 Correct 386 ms 109228 KB Output is correct
18 Correct 427 ms 109392 KB Output is correct
19 Correct 348 ms 108624 KB Output is correct
20 Correct 376 ms 108700 KB Output is correct
21 Correct 354 ms 108596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1149 ms 111548 KB Output is correct
2 Correct 195 ms 3664 KB Output is correct
3 Correct 223 ms 3664 KB Output is correct
4 Correct 215 ms 3740 KB Output is correct
5 Correct 211 ms 3668 KB Output is correct
6 Correct 251 ms 3664 KB Output is correct
7 Correct 201 ms 3672 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1068 ms 108104 KB Output is correct
12 Correct 1035 ms 111584 KB Output is correct
13 Correct 1004 ms 108168 KB Output is correct
14 Correct 1109 ms 108100 KB Output is correct
15 Correct 1082 ms 111456 KB Output is correct
16 Correct 1103 ms 111512 KB Output is correct
17 Correct 1065 ms 111464 KB Output is correct
18 Correct 1032 ms 111592 KB Output is correct
19 Correct 1038 ms 111468 KB Output is correct
20 Correct 1022 ms 111440 KB Output is correct
21 Correct 991 ms 111364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 370 ms 108748 KB Output is correct
2 Correct 60 ms 3004 KB Output is correct
3 Correct 73 ms 3008 KB Output is correct
4 Correct 61 ms 2912 KB Output is correct
5 Correct 61 ms 3160 KB Output is correct
6 Correct 78 ms 3288 KB Output is correct
7 Correct 63 ms 3068 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 460 KB Output is correct
11 Correct 367 ms 107196 KB Output is correct
12 Correct 365 ms 108712 KB Output is correct
13 Correct 357 ms 107352 KB Output is correct
14 Correct 384 ms 107284 KB Output is correct
15 Correct 392 ms 108712 KB Output is correct
16 Correct 420 ms 109392 KB Output is correct
17 Correct 386 ms 109228 KB Output is correct
18 Correct 427 ms 109392 KB Output is correct
19 Correct 348 ms 108624 KB Output is correct
20 Correct 376 ms 108700 KB Output is correct
21 Correct 354 ms 108596 KB Output is correct
22 Correct 1018 ms 110948 KB Output is correct
23 Correct 221 ms 3512 KB Output is correct
24 Correct 215 ms 3528 KB Output is correct
25 Correct 204 ms 3668 KB Output is correct
26 Correct 208 ms 3608 KB Output is correct
27 Correct 187 ms 3580 KB Output is correct
28 Correct 176 ms 3664 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1181 ms 108196 KB Output is correct
33 Correct 1125 ms 110748 KB Output is correct
34 Correct 1157 ms 108016 KB Output is correct
35 Correct 1159 ms 108136 KB Output is correct
36 Correct 871 ms 108104 KB Output is correct
37 Correct 907 ms 108024 KB Output is correct
38 Correct 837 ms 108076 KB Output is correct
39 Correct 1183 ms 110808 KB Output is correct
40 Correct 1184 ms 111180 KB Output is correct
41 Correct 1169 ms 111092 KB Output is correct
42 Correct 1099 ms 110932 KB Output is correct
43 Correct 1090 ms 110752 KB Output is correct
44 Correct 1133 ms 110912 KB Output is correct
45 Correct 1118 ms 110952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1143 ms 110160 KB Output is correct
2 Correct 265 ms 3580 KB Output is correct
3 Correct 274 ms 3524 KB Output is correct
4 Correct 267 ms 3664 KB Output is correct
5 Correct 277 ms 3540 KB Output is correct
6 Correct 231 ms 3664 KB Output is correct
7 Correct 229 ms 3548 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 356 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1138 ms 110268 KB Output is correct
12 Correct 1077 ms 110220 KB Output is correct
13 Correct 1118 ms 110552 KB Output is correct
14 Correct 1142 ms 110468 KB Output is correct
15 Correct 1059 ms 110416 KB Output is correct
16 Correct 1076 ms 110164 KB Output is correct
17 Correct 1127 ms 110036 KB Output is correct
18 Correct 1080 ms 110180 KB Output is correct
19 Correct 4 ms 600 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 3 ms 600 KB Output is correct
28 Correct 5 ms 604 KB Output is correct
29 Correct 2 ms 720 KB Output is correct
30 Correct 4 ms 720 KB Output is correct
31 Correct 2 ms 824 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 4 ms 604 KB Output is correct
34 Correct 6 ms 604 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 4 ms 860 KB Output is correct
37 Correct 2 ms 464 KB Output is correct
38 Correct 3 ms 348 KB Output is correct
39 Correct 3 ms 348 KB Output is correct
40 Correct 370 ms 108748 KB Output is correct
41 Correct 60 ms 3004 KB Output is correct
42 Correct 73 ms 3008 KB Output is correct
43 Correct 61 ms 2912 KB Output is correct
44 Correct 61 ms 3160 KB Output is correct
45 Correct 78 ms 3288 KB Output is correct
46 Correct 63 ms 3068 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 460 KB Output is correct
50 Correct 367 ms 107196 KB Output is correct
51 Correct 365 ms 108712 KB Output is correct
52 Correct 357 ms 107352 KB Output is correct
53 Correct 384 ms 107284 KB Output is correct
54 Correct 392 ms 108712 KB Output is correct
55 Correct 420 ms 109392 KB Output is correct
56 Correct 386 ms 109228 KB Output is correct
57 Correct 427 ms 109392 KB Output is correct
58 Correct 348 ms 108624 KB Output is correct
59 Correct 376 ms 108700 KB Output is correct
60 Correct 354 ms 108596 KB Output is correct
61 Correct 1149 ms 111548 KB Output is correct
62 Correct 195 ms 3664 KB Output is correct
63 Correct 223 ms 3664 KB Output is correct
64 Correct 215 ms 3740 KB Output is correct
65 Correct 211 ms 3668 KB Output is correct
66 Correct 251 ms 3664 KB Output is correct
67 Correct 201 ms 3672 KB Output is correct
68 Correct 1 ms 344 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 1068 ms 108104 KB Output is correct
72 Correct 1035 ms 111584 KB Output is correct
73 Correct 1004 ms 108168 KB Output is correct
74 Correct 1109 ms 108100 KB Output is correct
75 Correct 1082 ms 111456 KB Output is correct
76 Correct 1103 ms 111512 KB Output is correct
77 Correct 1065 ms 111464 KB Output is correct
78 Correct 1032 ms 111592 KB Output is correct
79 Correct 1038 ms 111468 KB Output is correct
80 Correct 1022 ms 111440 KB Output is correct
81 Correct 991 ms 111364 KB Output is correct
82 Correct 1018 ms 110948 KB Output is correct
83 Correct 221 ms 3512 KB Output is correct
84 Correct 215 ms 3528 KB Output is correct
85 Correct 204 ms 3668 KB Output is correct
86 Correct 208 ms 3608 KB Output is correct
87 Correct 187 ms 3580 KB Output is correct
88 Correct 176 ms 3664 KB Output is correct
89 Correct 1 ms 604 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 1 ms 344 KB Output is correct
92 Correct 1181 ms 108196 KB Output is correct
93 Correct 1125 ms 110748 KB Output is correct
94 Correct 1157 ms 108016 KB Output is correct
95 Correct 1159 ms 108136 KB Output is correct
96 Correct 871 ms 108104 KB Output is correct
97 Correct 907 ms 108024 KB Output is correct
98 Correct 837 ms 108076 KB Output is correct
99 Correct 1183 ms 110808 KB Output is correct
100 Correct 1184 ms 111180 KB Output is correct
101 Correct 1169 ms 111092 KB Output is correct
102 Correct 1099 ms 110932 KB Output is correct
103 Correct 1090 ms 110752 KB Output is correct
104 Correct 1133 ms 110912 KB Output is correct
105 Correct 1118 ms 110952 KB Output is correct
106 Correct 2109 ms 111884 KB Output is correct
107 Correct 427 ms 3668 KB Output is correct
108 Correct 422 ms 3776 KB Output is correct
109 Correct 403 ms 3796 KB Output is correct
110 Correct 1 ms 344 KB Output is correct
111 Correct 1 ms 508 KB Output is correct
112 Correct 1 ms 348 KB Output is correct
113 Correct 1178 ms 110940 KB Output is correct
114 Correct 1027 ms 110936 KB Output is correct
115 Correct 1054 ms 110908 KB Output is correct
116 Correct 1078 ms 111012 KB Output is correct
117 Correct 2127 ms 111748 KB Output is correct
118 Correct 1115 ms 110936 KB Output is correct
119 Correct 1081 ms 110816 KB Output is correct
120 Correct 375 ms 109596 KB Output is correct
121 Correct 371 ms 109396 KB Output is correct
122 Correct 350 ms 109400 KB Output is correct
123 Correct 329 ms 108628 KB Output is correct
124 Correct 324 ms 108516 KB Output is correct
125 Correct 298 ms 108760 KB Output is correct
126 Correct 1938 ms 108628 KB Output is correct
127 Correct 1851 ms 108520 KB Output is correct
128 Correct 1902 ms 111852 KB Output is correct
129 Correct 1813 ms 108552 KB Output is correct
130 Correct 912 ms 108628 KB Output is correct
131 Correct 1018 ms 108492 KB Output is correct
132 Correct 1020 ms 108572 KB Output is correct
133 Correct 2091 ms 111956 KB Output is correct
134 Correct 2049 ms 111956 KB Output is correct
135 Correct 2017 ms 112004 KB Output is correct
136 Correct 382 ms 3772 KB Output is correct
137 Correct 403 ms 3772 KB Output is correct
138 Correct 416 ms 3876 KB Output is correct