Submission #1026796

# Submission time Handle Problem Language Result Execution time Memory
1026796 2024-07-18T11:24:09 Z NeroZein Food Court (JOI21_foodcourt) C++17
100 / 100
454 ms 62904 KB
#include "bits/stdc++.h"
using namespace std;
#define int long long

#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif

const int N = 250003;
const long long INF = 1e15 + 15; 

struct node {
  long long sum, lazy, mn, mn2;
  int mnc;
};

int ptr[N];
long long tree[N];
node beats[N * 2];
long long seg[N * 2];
long long lazy[N * 2]; 

node combine(node lx, node rx) {
  node ret;
  ret.lazy = 0;
  ret.sum = lx.sum + rx.sum;
  if (lx.mn == rx.mn) {
    ret.mn = lx.mn;
    ret.mnc = lx.mnc + rx.mnc;
    ret.mn2 = min(lx.mn2, rx.mn2);
  } else if (lx.mn < rx.mn) {
    ret.mn = lx.mn;
    ret.mnc = lx.mnc;
    ret.mn2 = min(lx.mn2, rx.mn);
  } else {
    ret.mn = rx.mn;
    ret.mnc = rx.mnc;
    ret.mn2 = min(lx.mn, rx.mn2);
  }
  return ret;
}

void build_beats(int nd, int l, int r) {
  if (l == r) {
    beats[nd].mnc = 1; 
    beats[nd].mn2 = INF;
    beats[nd].lazy = beats[nd].sum = beats[nd].mn = 0;
    return;
  }
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  build_beats(nd + 1, l, mid);
  build_beats(rs, mid + 1, r); 
  beats[nd] = combine(beats[nd + 1], beats[rs]);
}

void apply_add(int nd, int l, int r, int v) {
  beats[nd].sum += (long long) (r - l + 1) * v; 
  beats[nd].mn += v; 
  if (beats[nd].mn2 != INF) {
    beats[nd].mn2 += v; 
  }
  beats[nd].lazy += v; 
}

void apply_maximize(int nd, int l, int r, int v) {
  if (beats[nd].mn >= v) {
    return;
  }
  beats[nd].sum -= (long long) beats[nd].mn * beats[nd].mnc;
  beats[nd].mn = v; 
  beats[nd].sum += (long long) beats[nd].mn * beats[nd].mnc;
}

void push_down(int nd, int l, int r) {
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  apply_add(nd + 1, l, mid, beats[nd].lazy);
  apply_add(rs, mid + 1, r, beats[nd].lazy);
  beats[nd].lazy = 0;
  apply_maximize(nd + 1, l, mid, beats[nd].mn);
  apply_maximize(rs, mid + 1, r, beats[nd].mn); 
}

void add_beats(int nd, int l, int r, int s, int e, int v) {
  if (l >= s && r <= e) {
    apply_add(nd, l, r, v);
    return; 
  }
  push_down(nd, l, r); 
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  if (mid >= e) {
    add_beats(nd + 1, l, mid, s, e, v); 
  } else {
    if (mid < s) {
      add_beats(rs, mid + 1, r, s, e, v);       
    } else {
      add_beats(nd + 1, l, mid, s, e, v); 
      add_beats(rs, mid + 1, r, s, e, v); 
    }
  }
  beats[nd] = combine(beats[nd + 1], beats[rs]);
}

void maximize(int nd, int l, int r, int s, int e, int v) {
  if (beats[nd].mn >= v) {
    return; 
  }
  if (l >= s && r <= e && beats[nd].mn2 > v) {
    apply_maximize(nd, l, r, v);
    return; 
  }
  push_down(nd, l, r);
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  if (mid >= e) {
    maximize(nd + 1, l, mid, s, e, v);
  } else {
    if (mid < s) {
      maximize(rs, mid + 1, r, s, e, v);
    } else {
      maximize(nd + 1, l, mid, s, e, v);
      maximize(rs, mid + 1, r, s, e, v);
    }
  }
  beats[nd] = combine(beats[nd + 1], beats[rs]);
}

long long qry_beats(int nd, int l, int r, int p) {
  if (l == r) {
    return beats[nd].sum;
  }
  push_down(nd, l, r); 
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  if (p <= mid) {
    return qry_beats(nd + 1, l, mid, p);
  } else {
    return qry_beats(rs, mid + 1, r, p);
  }
}

void upd(int ind, int v) {
  while (ind < N) {
    tree[ind] += v;
    ind += ind & -ind;
  }
}

void upd(int l, int r, int v) {
  upd(l, v);
  upd(r + 1, -v);
}

long long qry(int ind) {
  long long ret = 0;
  while (ind) {
    ret += tree[ind];
    ind -= ind & -ind;
  }
  return ret; 
}

void build(int nd, int l, int r, vector<vector<pair<long long, int>>>& qs) {
  if (l == r) {
    if (!qs[l].empty()) {
      seg[nd] = qs[l][0].first; 
    } else {
      seg[nd] = INF;
    }
    return; 
  }
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  build(nd + 1, l, mid, qs);
  build(rs, mid + 1, r, qs);
  seg[nd] = min(seg[nd + 1], seg[rs]);
}

void push(int nd, int l, int r) {
  seg[nd] += lazy[nd];
  if (l != r) {
    int mid = (l + r) >> 1;
    int rs = nd + ((mid - l + 1) << 1);
    lazy[nd + 1] += lazy[nd];
    lazy[rs] += lazy[nd]; 
  }
  lazy[nd] = 0; 
}

void upd(int nd, int l, int r, int s, int e, long long v) {
  push(nd, l, r); 
  if (l >= s && r <= e) {
    lazy[nd] = v; 
    push(nd, l, r);
    return; 
  }
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  if (mid >= e) {
    upd(nd + 1, l, mid, s, e, v); 
    push(rs, mid + 1, r); 
  } else {
    if (mid < s) {
      upd(rs, mid + 1, r, s, e, v);
      push(nd + 1, l, mid); 
    } else {
      upd(nd + 1, l, mid, s, e, v); 
      upd(rs, mid + 1, r, s, e, v);
    }
  }
  seg[nd] = min(seg[nd + 1], seg[rs]);
}

int get(int nd, int l, int r) {
  push(nd, l, r); 
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  push(nd + 1, l, mid);
  if (seg[nd + 1] <= 0) {
    return get(nd + 1, l, mid);
  }
  return get(rs, mid + 1, r); 
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, q;
  cin >> n >> m >> q;
  build_beats(0, 1, n);
  vector<vector<pair<long long, int>>> qs(n + 1);
  vector<int> type(q), lq(q), rq(q), cq(q), kq(q), a(q), b(q), ans(q);
  for (int i = 0; i < q; ++i) {
    cin >> type[i];
    if (type[i] == 1) {
      cin >> lq[i] >> rq[i] >> cq[i] >> kq[i];
      upd(lq[i], rq[i], kq[i]); 
      add_beats(0, 1, n, lq[i], rq[i], kq[i]);
    } else if (type[i] == 2) {
      cin >> lq[i] >> rq[i] >> kq[i];
      add_beats(0, 1, n, lq[i], rq[i], -kq[i]);
      maximize(0, 1, n, lq[i], rq[i], 0);
    } else {
      cin >> a[i] >> b[i];
      long long tot = qry(a[i]);
      long long cur = qry_beats(0, 1, n, a[i]);
      if (cur >= b[i]) {
        //debug(tot - (cur - b[i]));
        qs[a[i]].push_back({tot - (cur - b[i]), i});
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    sort(qs[i].begin(), qs[i].end());
  }
  build(0, 1, n, qs);
  for (int i = 0; i < q; ++i) {
    if (type[i] == 3) {
      cout << ans[i] << '\n';
    } 
    if (type[i] != 1) {
      continue; 
    }
    upd(0, 1, n, lq[i], rq[i], -kq[i]);
    while (seg[0] <= 0) {
      int ind = get(0, 1, n);
      ans[qs[ind][ptr[ind]].second] = cq[i]; 
      ptr[ind]++;
      if (ptr[ind] < (int) qs[ind].size()) {
        upd(0, 1, n, ind, ind, qs[ind][ptr[ind]].first - qs[ind][ptr[ind] - 1].first);
      } else {
        //debug(ind, seg[0], qs[ind].size(), ptr[ind]); 
        upd(0, 1, n, ind, ind, INF);
      }
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 2 ms 4952 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 1 ms 6744 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 2 ms 6748 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 2 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 2 ms 4700 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 2 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 2 ms 4856 KB Output is correct
19 Correct 2 ms 6748 KB Output is correct
20 Correct 2 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 2 ms 4952 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 1 ms 6744 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 2 ms 6748 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 2 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 2 ms 4700 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 2 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 2 ms 4856 KB Output is correct
19 Correct 2 ms 6748 KB Output is correct
20 Correct 2 ms 6748 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 2 ms 4700 KB Output is correct
23 Correct 2 ms 4700 KB Output is correct
24 Correct 4 ms 6840 KB Output is correct
25 Correct 1 ms 4700 KB Output is correct
26 Correct 1 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 2 ms 6744 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 4700 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 4836 KB Output is correct
33 Correct 2 ms 4700 KB Output is correct
34 Correct 1 ms 4700 KB Output is correct
35 Correct 3 ms 6748 KB Output is correct
36 Correct 2 ms 6748 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 2 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 21188 KB Output is correct
2 Correct 76 ms 22612 KB Output is correct
3 Correct 71 ms 22612 KB Output is correct
4 Correct 70 ms 22248 KB Output is correct
5 Correct 72 ms 23744 KB Output is correct
6 Correct 75 ms 23888 KB Output is correct
7 Correct 14 ms 11352 KB Output is correct
8 Correct 15 ms 9436 KB Output is correct
9 Correct 68 ms 22704 KB Output is correct
10 Correct 88 ms 22328 KB Output is correct
11 Correct 74 ms 24252 KB Output is correct
12 Correct 85 ms 23888 KB Output is correct
13 Correct 60 ms 21072 KB Output is correct
14 Correct 70 ms 22864 KB Output is correct
15 Correct 70 ms 21508 KB Output is correct
16 Correct 76 ms 22608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 348 ms 57428 KB Output is correct
2 Correct 284 ms 50260 KB Output is correct
3 Correct 366 ms 61008 KB Output is correct
4 Correct 256 ms 54248 KB Output is correct
5 Correct 262 ms 48788 KB Output is correct
6 Correct 348 ms 60892 KB Output is correct
7 Correct 70 ms 25496 KB Output is correct
8 Correct 71 ms 27436 KB Output is correct
9 Correct 454 ms 62072 KB Output is correct
10 Correct 373 ms 61852 KB Output is correct
11 Correct 363 ms 60752 KB Output is correct
12 Correct 358 ms 60752 KB Output is correct
13 Correct 344 ms 60676 KB Output is correct
14 Correct 382 ms 60724 KB Output is correct
15 Correct 387 ms 60676 KB Output is correct
16 Correct 452 ms 60556 KB Output is correct
17 Correct 367 ms 60496 KB Output is correct
18 Correct 317 ms 60756 KB Output is correct
19 Correct 327 ms 60676 KB Output is correct
20 Correct 354 ms 60756 KB Output is correct
21 Correct 378 ms 60624 KB Output is correct
22 Correct 358 ms 60504 KB Output is correct
23 Correct 363 ms 60556 KB Output is correct
24 Correct 348 ms 60496 KB Output is correct
25 Correct 288 ms 54504 KB Output is correct
26 Correct 291 ms 60868 KB Output is correct
27 Correct 275 ms 59812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 2 ms 4952 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 1 ms 6744 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 2 ms 6748 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 2 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 2 ms 4700 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 2 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 2 ms 4856 KB Output is correct
19 Correct 2 ms 6748 KB Output is correct
20 Correct 2 ms 6748 KB Output is correct
21 Correct 71 ms 21188 KB Output is correct
22 Correct 76 ms 22612 KB Output is correct
23 Correct 71 ms 22612 KB Output is correct
24 Correct 70 ms 22248 KB Output is correct
25 Correct 72 ms 23744 KB Output is correct
26 Correct 75 ms 23888 KB Output is correct
27 Correct 14 ms 11352 KB Output is correct
28 Correct 15 ms 9436 KB Output is correct
29 Correct 68 ms 22704 KB Output is correct
30 Correct 88 ms 22328 KB Output is correct
31 Correct 74 ms 24252 KB Output is correct
32 Correct 85 ms 23888 KB Output is correct
33 Correct 60 ms 21072 KB Output is correct
34 Correct 70 ms 22864 KB Output is correct
35 Correct 70 ms 21508 KB Output is correct
36 Correct 76 ms 22608 KB Output is correct
37 Correct 76 ms 21896 KB Output is correct
38 Correct 58 ms 21072 KB Output is correct
39 Correct 13 ms 8672 KB Output is correct
40 Correct 15 ms 11224 KB Output is correct
41 Correct 83 ms 22996 KB Output is correct
42 Correct 70 ms 24496 KB Output is correct
43 Correct 82 ms 24520 KB Output is correct
44 Correct 77 ms 24656 KB Output is correct
45 Correct 74 ms 24660 KB Output is correct
46 Correct 79 ms 24536 KB Output is correct
47 Correct 36 ms 22364 KB Output is correct
48 Correct 63 ms 22608 KB Output is correct
49 Correct 70 ms 20052 KB Output is correct
50 Correct 81 ms 21964 KB Output is correct
51 Correct 89 ms 24368 KB Output is correct
52 Correct 94 ms 23040 KB Output is correct
53 Correct 53 ms 20816 KB Output is correct
54 Correct 69 ms 24244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 21840 KB Output is correct
2 Correct 70 ms 21328 KB Output is correct
3 Correct 75 ms 25364 KB Output is correct
4 Correct 52 ms 21844 KB Output is correct
5 Correct 69 ms 22920 KB Output is correct
6 Correct 76 ms 23924 KB Output is correct
7 Correct 19 ms 11728 KB Output is correct
8 Correct 18 ms 9684 KB Output is correct
9 Correct 38 ms 25436 KB Output is correct
10 Correct 43 ms 21072 KB Output is correct
11 Correct 75 ms 25428 KB Output is correct
12 Correct 57 ms 25432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 2 ms 4952 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 1 ms 6744 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 2 ms 6748 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 2 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 2 ms 4700 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 2 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 2 ms 4856 KB Output is correct
19 Correct 2 ms 6748 KB Output is correct
20 Correct 2 ms 6748 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 2 ms 4700 KB Output is correct
23 Correct 2 ms 4700 KB Output is correct
24 Correct 4 ms 6840 KB Output is correct
25 Correct 1 ms 4700 KB Output is correct
26 Correct 1 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 2 ms 6744 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 4700 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 4836 KB Output is correct
33 Correct 2 ms 4700 KB Output is correct
34 Correct 1 ms 4700 KB Output is correct
35 Correct 3 ms 6748 KB Output is correct
36 Correct 2 ms 6748 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 2 ms 6748 KB Output is correct
39 Correct 71 ms 21188 KB Output is correct
40 Correct 76 ms 22612 KB Output is correct
41 Correct 71 ms 22612 KB Output is correct
42 Correct 70 ms 22248 KB Output is correct
43 Correct 72 ms 23744 KB Output is correct
44 Correct 75 ms 23888 KB Output is correct
45 Correct 14 ms 11352 KB Output is correct
46 Correct 15 ms 9436 KB Output is correct
47 Correct 68 ms 22704 KB Output is correct
48 Correct 88 ms 22328 KB Output is correct
49 Correct 74 ms 24252 KB Output is correct
50 Correct 85 ms 23888 KB Output is correct
51 Correct 60 ms 21072 KB Output is correct
52 Correct 70 ms 22864 KB Output is correct
53 Correct 70 ms 21508 KB Output is correct
54 Correct 76 ms 22608 KB Output is correct
55 Correct 76 ms 21896 KB Output is correct
56 Correct 58 ms 21072 KB Output is correct
57 Correct 13 ms 8672 KB Output is correct
58 Correct 15 ms 11224 KB Output is correct
59 Correct 83 ms 22996 KB Output is correct
60 Correct 70 ms 24496 KB Output is correct
61 Correct 82 ms 24520 KB Output is correct
62 Correct 77 ms 24656 KB Output is correct
63 Correct 74 ms 24660 KB Output is correct
64 Correct 79 ms 24536 KB Output is correct
65 Correct 36 ms 22364 KB Output is correct
66 Correct 63 ms 22608 KB Output is correct
67 Correct 70 ms 20052 KB Output is correct
68 Correct 81 ms 21964 KB Output is correct
69 Correct 89 ms 24368 KB Output is correct
70 Correct 94 ms 23040 KB Output is correct
71 Correct 53 ms 20816 KB Output is correct
72 Correct 69 ms 24244 KB Output is correct
73 Correct 71 ms 21840 KB Output is correct
74 Correct 70 ms 21328 KB Output is correct
75 Correct 75 ms 25364 KB Output is correct
76 Correct 52 ms 21844 KB Output is correct
77 Correct 69 ms 22920 KB Output is correct
78 Correct 76 ms 23924 KB Output is correct
79 Correct 19 ms 11728 KB Output is correct
80 Correct 18 ms 9684 KB Output is correct
81 Correct 38 ms 25436 KB Output is correct
82 Correct 43 ms 21072 KB Output is correct
83 Correct 75 ms 25428 KB Output is correct
84 Correct 57 ms 25432 KB Output is correct
85 Correct 71 ms 21968 KB Output is correct
86 Correct 78 ms 23632 KB Output is correct
87 Correct 64 ms 24204 KB Output is correct
88 Correct 64 ms 25172 KB Output is correct
89 Correct 45 ms 20560 KB Output is correct
90 Correct 69 ms 25132 KB Output is correct
91 Correct 62 ms 19544 KB Output is correct
92 Correct 58 ms 21128 KB Output is correct
93 Correct 78 ms 25096 KB Output is correct
94 Correct 68 ms 23632 KB Output is correct
95 Correct 69 ms 21216 KB Output is correct
96 Correct 71 ms 24916 KB Output is correct
97 Correct 87 ms 24916 KB Output is correct
98 Correct 64 ms 21588 KB Output is correct
99 Correct 32 ms 24924 KB Output is correct
100 Correct 50 ms 19828 KB Output is correct
101 Correct 63 ms 25112 KB Output is correct
102 Correct 60 ms 24912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 2 ms 4952 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 1 ms 6744 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 2 ms 6748 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 2 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 2 ms 4700 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 2 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 2 ms 4856 KB Output is correct
19 Correct 2 ms 6748 KB Output is correct
20 Correct 2 ms 6748 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 2 ms 4700 KB Output is correct
23 Correct 2 ms 4700 KB Output is correct
24 Correct 4 ms 6840 KB Output is correct
25 Correct 1 ms 4700 KB Output is correct
26 Correct 1 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 2 ms 6744 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 4700 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 4836 KB Output is correct
33 Correct 2 ms 4700 KB Output is correct
34 Correct 1 ms 4700 KB Output is correct
35 Correct 3 ms 6748 KB Output is correct
36 Correct 2 ms 6748 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 2 ms 6748 KB Output is correct
39 Correct 71 ms 21188 KB Output is correct
40 Correct 76 ms 22612 KB Output is correct
41 Correct 71 ms 22612 KB Output is correct
42 Correct 70 ms 22248 KB Output is correct
43 Correct 72 ms 23744 KB Output is correct
44 Correct 75 ms 23888 KB Output is correct
45 Correct 14 ms 11352 KB Output is correct
46 Correct 15 ms 9436 KB Output is correct
47 Correct 68 ms 22704 KB Output is correct
48 Correct 88 ms 22328 KB Output is correct
49 Correct 74 ms 24252 KB Output is correct
50 Correct 85 ms 23888 KB Output is correct
51 Correct 60 ms 21072 KB Output is correct
52 Correct 70 ms 22864 KB Output is correct
53 Correct 70 ms 21508 KB Output is correct
54 Correct 76 ms 22608 KB Output is correct
55 Correct 348 ms 57428 KB Output is correct
56 Correct 284 ms 50260 KB Output is correct
57 Correct 366 ms 61008 KB Output is correct
58 Correct 256 ms 54248 KB Output is correct
59 Correct 262 ms 48788 KB Output is correct
60 Correct 348 ms 60892 KB Output is correct
61 Correct 70 ms 25496 KB Output is correct
62 Correct 71 ms 27436 KB Output is correct
63 Correct 454 ms 62072 KB Output is correct
64 Correct 373 ms 61852 KB Output is correct
65 Correct 363 ms 60752 KB Output is correct
66 Correct 358 ms 60752 KB Output is correct
67 Correct 344 ms 60676 KB Output is correct
68 Correct 382 ms 60724 KB Output is correct
69 Correct 387 ms 60676 KB Output is correct
70 Correct 452 ms 60556 KB Output is correct
71 Correct 367 ms 60496 KB Output is correct
72 Correct 317 ms 60756 KB Output is correct
73 Correct 327 ms 60676 KB Output is correct
74 Correct 354 ms 60756 KB Output is correct
75 Correct 378 ms 60624 KB Output is correct
76 Correct 358 ms 60504 KB Output is correct
77 Correct 363 ms 60556 KB Output is correct
78 Correct 348 ms 60496 KB Output is correct
79 Correct 288 ms 54504 KB Output is correct
80 Correct 291 ms 60868 KB Output is correct
81 Correct 275 ms 59812 KB Output is correct
82 Correct 76 ms 21896 KB Output is correct
83 Correct 58 ms 21072 KB Output is correct
84 Correct 13 ms 8672 KB Output is correct
85 Correct 15 ms 11224 KB Output is correct
86 Correct 83 ms 22996 KB Output is correct
87 Correct 70 ms 24496 KB Output is correct
88 Correct 82 ms 24520 KB Output is correct
89 Correct 77 ms 24656 KB Output is correct
90 Correct 74 ms 24660 KB Output is correct
91 Correct 79 ms 24536 KB Output is correct
92 Correct 36 ms 22364 KB Output is correct
93 Correct 63 ms 22608 KB Output is correct
94 Correct 70 ms 20052 KB Output is correct
95 Correct 81 ms 21964 KB Output is correct
96 Correct 89 ms 24368 KB Output is correct
97 Correct 94 ms 23040 KB Output is correct
98 Correct 53 ms 20816 KB Output is correct
99 Correct 69 ms 24244 KB Output is correct
100 Correct 71 ms 21840 KB Output is correct
101 Correct 70 ms 21328 KB Output is correct
102 Correct 75 ms 25364 KB Output is correct
103 Correct 52 ms 21844 KB Output is correct
104 Correct 69 ms 22920 KB Output is correct
105 Correct 76 ms 23924 KB Output is correct
106 Correct 19 ms 11728 KB Output is correct
107 Correct 18 ms 9684 KB Output is correct
108 Correct 38 ms 25436 KB Output is correct
109 Correct 43 ms 21072 KB Output is correct
110 Correct 75 ms 25428 KB Output is correct
111 Correct 57 ms 25432 KB Output is correct
112 Correct 71 ms 21968 KB Output is correct
113 Correct 78 ms 23632 KB Output is correct
114 Correct 64 ms 24204 KB Output is correct
115 Correct 64 ms 25172 KB Output is correct
116 Correct 45 ms 20560 KB Output is correct
117 Correct 69 ms 25132 KB Output is correct
118 Correct 62 ms 19544 KB Output is correct
119 Correct 58 ms 21128 KB Output is correct
120 Correct 78 ms 25096 KB Output is correct
121 Correct 68 ms 23632 KB Output is correct
122 Correct 69 ms 21216 KB Output is correct
123 Correct 71 ms 24916 KB Output is correct
124 Correct 87 ms 24916 KB Output is correct
125 Correct 64 ms 21588 KB Output is correct
126 Correct 32 ms 24924 KB Output is correct
127 Correct 50 ms 19828 KB Output is correct
128 Correct 63 ms 25112 KB Output is correct
129 Correct 60 ms 24912 KB Output is correct
130 Correct 296 ms 61376 KB Output is correct
131 Correct 222 ms 48444 KB Output is correct
132 Correct 341 ms 61648 KB Output is correct
133 Correct 287 ms 60252 KB Output is correct
134 Correct 271 ms 56912 KB Output is correct
135 Correct 304 ms 61524 KB Output is correct
136 Correct 310 ms 62904 KB Output is correct
137 Correct 334 ms 62804 KB Output is correct
138 Correct 317 ms 61356 KB Output is correct
139 Correct 284 ms 61396 KB Output is correct
140 Correct 301 ms 61312 KB Output is correct
141 Correct 305 ms 61264 KB Output is correct
142 Correct 288 ms 61520 KB Output is correct
143 Correct 316 ms 61124 KB Output is correct
144 Correct 283 ms 61260 KB Output is correct
145 Correct 290 ms 61264 KB Output is correct
146 Correct 320 ms 61336 KB Output is correct
147 Correct 316 ms 61268 KB Output is correct
148 Correct 298 ms 61268 KB Output is correct
149 Correct 331 ms 61088 KB Output is correct
150 Correct 127 ms 61008 KB Output is correct
151 Correct 261 ms 61248 KB Output is correct
152 Correct 260 ms 61264 KB Output is correct
153 Correct 279 ms 60756 KB Output is correct