Submission #739819

# Submission time Handle Problem Language Result Execution time Memory
739819 2023-05-11T11:14:11 Z cig32 Food Court (JOI21_foodcourt) C++17
100 / 100
694 ms 151244 KB
#include "bits/stdc++.h"
using namespace std;
#define int long long
struct segtree_basic {
  struct node {
    int lazyval, mi, ma, sum; char lazytag;
    int len; // not changing
  };
  int stok;
  vector<node> st;
  void bu(int l, int r, int idx) {
    st[idx].lazyval = st[idx].mi = st[idx].ma = st[idx].sum = 0;
    st[idx].lazytag = '?';
    st[idx].len = r - l + 1;
    if(l == r) {
      return;
    }
    int mid = (l + r) >> 1;
    bu(l, mid, 2*idx+1);
    bu(mid+1, r, 2*idx+2);
  }
  void push_down(int idx) {
    if(st[idx].lazytag == '?') return;
    if(st[idx].lazytag == ':') {
      st[2*idx+1].lazyval = st[idx].lazyval;
      st[2*idx+1].mi = st[idx].lazyval;
      st[2*idx+1].ma = st[idx].lazyval;
      st[2*idx+1].sum = st[idx].lazyval * st[2*idx+1].len;
      st[2*idx+1].lazytag = ':';
 
      st[2*idx+2].lazyval = st[idx].lazyval;
      st[2*idx+2].mi = st[idx].lazyval;
      st[2*idx+2].ma = st[idx].lazyval;
      st[2*idx+2].sum = st[idx].lazyval * st[2*idx+2].len;
      st[2*idx+2].lazytag = ':';
 
    }
    else {
      st[2*idx+1].lazyval += st[idx].lazyval;
      st[2*idx+1].mi += st[idx].lazyval;
      st[2*idx+1].ma += st[idx].lazyval;
      st[2*idx+1].sum += st[idx].lazyval * st[2*idx+1].len;
      st[2*idx+1].lazytag = (st[2*idx+1].lazytag == ':' ? ':' : '+');
 
      st[2*idx+2].lazyval += st[idx].lazyval;
      st[2*idx+2].mi += st[idx].lazyval;
      st[2*idx+2].ma += st[idx].lazyval;
      st[2*idx+2].sum += st[idx].lazyval * st[2*idx+2].len;
      st[2*idx+2].lazytag = (st[2*idx+2].lazytag == ':' ? ':' : '+');
    }
    st[idx].lazytag = '?';
    st[idx].lazyval = 0;
  }
  void push_up(int idx) {
    st[idx].mi = min(st[2*idx+1].mi, st[2*idx+2].mi);
    st[idx].ma = max(st[2*idx+1].ma, st[2*idx+2].ma);
    st[idx].sum = st[2*idx+1].sum + st[2*idx+2].sum;
  }
  void u1(int l, int r, int constl, int constr, int idx, int val) { // range := v
    if(l <= constl && constr <= r) {
      st[idx].lazyval = val;
      st[idx].mi = val;
      st[idx].ma = val;
      st[idx].sum = val * st[idx].len;
      st[idx].lazytag = ':';
      return;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) u1(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) u1(l, r, constl, mid, 2*idx+1, val);
    else {
      u1(l, r, constl, mid, 2*idx+1, val);
      u1(l, r, mid+1, constr, 2*idx+2, val);
    }
    push_up(idx);
  }
 
  void u2(int l, int r, int constl, int constr, int idx, int val) { // range += v
    if(l <= constl && constr <= r) {
      st[idx].lazyval += val;
      st[idx].mi += val;
      st[idx].ma += val;
      st[idx].sum += val * st[idx].len;
      st[idx].lazytag = (st[idx].lazytag == ':' ? ':' : '+');
      return;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) u2(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) u2(l, r, constl, mid, 2*idx+1, val);
    else {
      u2(l, r, constl, mid, 2*idx+1, val);
      u2(l, r, mid+1, constr, 2*idx+2, val);
    }
    push_up(idx);
  }
 
  int qu1(int l, int r, int constl, int constr, int idx) { // range min
    if(l <= constl && constr <= r) return st[idx].mi;
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu1(l, r, mid+1, constr, 2*idx+2);
    else if(constr < l || r < mid + 1) return qu1(l, r, constl, mid, 2*idx+1);
    else {
      return min(qu1(l, r, constl, mid, 2*idx+1), qu1(l, r, mid+1, constr, 2*idx+2));
    }
  }
 
  int qu2(int l, int r, int constl, int constr, int idx) { // range max
    if(l <= constl && constr <= r) return st[idx].ma;
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu2(l, r, mid+1, constr, 2*idx+2); 
    else if(constr < l || r < mid + 1) return qu2(l, r, constl, mid, 2*idx+1);
    else {
      return max(qu2(l, r, constl, mid, 2*idx+1), qu2(l, r, mid+1, constr, 2*idx+2));
    }
  }
  int qu3(int l, int r, int constl, int constr, int idx) { // range sum
    if(l <= constl && constr <= r) return st[idx].sum;
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu3(l, r, mid+1, constr, 2*idx+2);
    else if(constr < l || r < mid + 1) return qu3(l, r, constl, mid, 2*idx+1);
    else {
      return qu3(l, r, constl, mid, 2*idx+1) + qu3(l, r, mid+1, constr, 2*idx+2);
    }
  }
  int qu4(int l, int r, int constl, int constr, int idx, int val) { // first at least v
    if(l <= constl && constr <= r) {
      if(st[idx].ma < val) return -1;
      while(constl < constr) {
        int mid = (constl + constr) >> 1;
        push_down(idx);
        if(st[2*idx+1].ma >= val) constr = mid, idx = 2*idx + 1;
        else constl = mid+1, idx = 2*idx + 2;
      }
      return constl;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu4(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) return qu4(l, r, constl, mid, 2*idx+1, val);
    else {
      int lchild = qu4(l, r, constl, mid, 2*idx+1, val);
      if(lchild != -1) return lchild;
      return qu4(l, r, mid+1, constr, 2*idx+2, val);
    }
  }
  int qu5(int l, int r, int constl, int constr, int idx, int val) { // first at most v
    if(l <= constl && constr <= r) {
      if(st[idx].mi > val) return -1;
      while(constl < constr) {
        int mid = (constl + constr) >> 1;
        push_down(idx);
        if(st[2*idx+1].mi <= val) constr = mid, idx = 2*idx + 1;
        else constl = mid+1, idx = 2*idx + 2;
      }
      return constl;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu5(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) return qu5(l, r, constl, mid, 2*idx+1, val);
    else {
      int lchild = qu5(l, r, constl, mid, 2*idx+1, val);
      if(lchild != -1) return lchild;
      return qu5(l, r, mid+1, constr, 2*idx+2, val);
    }
  }
  int qu6(int l, int r, int constl, int constr, int idx, int val) { // last at least v
    if(l <= constl && constr <= r) {
      if(st[idx].ma < val) return -1;
      while(constl < constr) {
        int mid = (constl + constr) >> 1;
        push_down(idx);
        if(st[2*idx+2].ma >= val) constl = mid+1, idx = 2*idx + 2;
        else constr = mid, idx = 2*idx + 1;
      }
      return constl;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu6(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) return qu6(l, r, constl, mid, 2*idx+1, val);
    else {
      int rchild = qu6(l, r, mid+1, constr, 2*idx+2, val);
      if(rchild != -1) return rchild;
      return qu6(l, r, constl, mid, 2*idx+1, val);
    }
  }
  int qu7(int l, int r, int constl, int constr, int idx, int val) { // last at most v
    if(l <= constl && constr <= r) {
      if(st[idx].mi > val) return -1;
      while(constl < constr) {
        int mid = (constl + constr) >> 1;
        push_down(idx);
        if(st[2*idx+2].mi <= val) constl = mid+1, idx = 2*idx + 2;
        else constr = mid, idx = 2*idx + 1;
      }
      return constl;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu7(l, r, mid+1, constr, 2*idx+2, val);
    else if(constr < l || r < mid + 1) return qu7(l, r, constl, mid, 2*idx+1, val);
    else {
      int rchild = qu7(l, r, mid+1, constr, 2*idx+2, val);
      if(rchild != -1) return rchild;
      return qu7(l, r, constl, mid, 2*idx+1, val);
    }
  }
  int qu8(int l, int r, int constl, int constr, int idx, int val) { // first partial sum at least v, only works when partial sum is non-decreasing
    if(l <= constl && constr <= r) {
      if(st[idx].sum < val) return -1;
      while(constl < constr) {
        int mid = (constl + constr) >> 1;
        push_down(idx);
        if(st[2*idx+1].sum >= val) {
          idx = 2*idx+1, constr = mid;
        }
        else {
          val -= st[2*idx+1].sum;
          idx = 2*idx+2, constl = mid+1;
        }
      }
      return constl;
    }
    int mid = (constl + constr) >> 1;
    push_down(idx);
    if(mid < l || r < constl) return qu8(l, r, mid+1, constr, 2*idx+2, val - st[2*idx+1].sum);
    else if(constr < l || r < mid+1) return qu8(l, r, constl, mid, 2*idx+1, val);
    else {
      int lchild = qu8(l, r, constl, mid, 2*idx+1, val);
      if(lchild != -1) return lchild;
      return qu8(l, r, mid+1, constr, 2*idx+2, val - st[2*idx+1].sum);
    }
  }
  public:
  void resize(int k) {
    st.resize(4*k + 10);
    stok = k;
    bu(0, k, 0);
  }
  void range_assign(int l, int r, int v) { u1(l, r, 0, stok, 0, v); }
 
  void range_add(int l, int r, int v) { u2(l, r, 0, stok, 0, v); }
 
  int query_min(int l, int r) { return qu1(l, r, 0, stok, 0); }
 
  int query_max(int l, int r) { return qu2(l, r, 0, stok, 0); }
 
  int query_sum(int l, int r) { return qu3(l, r, 0, stok, 0); }
 
  int query_firstAtLeast(int l, int r, int v) { return qu4(l, r, 0, stok, 0, v); }
 
  int query_firstAtMost(int l, int r, int v) { return qu5(l, r, 0, stok, 0, v); }
 
  int query_lastAtLeast(int l, int r, int v) { return qu6(l, r, 0, stok, 0, v); } 
 
  int query_lastAtMost(int l, int r, int v) { return qu7(l, r, 0, stok, 0, v); }

  int query_firstPSAtLeast(int l, int r, int v) { return qu8(l, r, 0, stok, 0, v); }
};
struct segtree_bruh {
  struct node {
    int mss = 0, sum = 0, id;
  };
  vector<node> st;
  int stok;
  void push_up(int idx) {
    st[idx].sum = st[2*idx+1].sum + st[2*idx+2].sum;
    st[idx].mss = max(st[2*idx+2].mss, st[2*idx+1].mss + st[2*idx+2].sum);
    if(st[2*idx+2].mss < st[2*idx+1].mss + st[2*idx+2].sum) st[idx].id = st[2*idx+1].id;
    else st[idx].id = st[2*idx+2].id;
  }
  void init(int l, int r, int idx) {
    if(l == r) {
      st[idx].id = l;
      return;
    }
    int m = (l + r) >> 1;
    init(l, m, (idx << 1) + 1);
    init(m + 1, r, (idx << 1) + 2);
    push_up(idx);
  }
  void u(int l, int r, int tar, int idx, int val) {
    if(l == r) {
      st[idx].sum += val;
      st[idx].mss = max(st[idx].sum, 0ll);
      return;
    }
    int mid = (l + r) >> 1;
    if(tar <= mid) u(l, mid, tar, 2*idx+1, val);
    else u(mid+1, r, tar, 2*idx+2, val);
    push_up(idx);
  }

  pair<pair<int, int>, int> qu(int l, int r, int constl, int constr, int idx) {
    if(l <= constl && constr <= r) return {{st[idx].mss, st[idx].id}, st[idx].sum};
    int mid = (constl + constr) >> 1;
    if(mid < l || r < constl) return qu(l, r, mid+1, constr, 2*idx+2);
    else if(constr < l || r < mid+1) return qu(l, r, constl, mid, 2*idx+1);
    else {
      pair<pair<int, int>, int> lc = qu(l, r, constl, mid, 2*idx+1);
      pair<pair<int, int>, int> rc = qu(l, r, mid+1, constr, 2*idx+2);
      if(rc.first.first >= lc.first.first + rc.second) return {rc.first, lc.second + rc.second};
      else return {{lc.first.first + rc.second, lc.first.second}, lc.second + rc.second};
    }
  }
  void resize(int k) {
    stok = k;
    st.resize(4*k + 10);
    init(0, k, 0);
  }
  void point_add(int i, int v) {
    u(0, stok, i, 0, v);
  }
  pair<int, int> prefix_mss(int i) {
    return qu(1, i, 0, stok, 0).first;
  }
};
const int MAXN = 250050;
int bit[MAXN];
void not_add(int x, int v) {
  for(;x<MAXN;x+=x&-x) bit[x] += v;
}
int sum(int x) {
  int s=0;
  for(;x;x-=x&-x) s += bit[x];
  return s;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  int l[q+1], r[q+1], c[q+1], k[q+1], a[q+1], b[q+1], ans[q+1], tyy[q+1];
  set<int> add[n+1], sub[n+2], qry[n+1];
  for(int i=1; i<=q; i++) {
    int ty;
    cin >> ty;
    tyy[i] = ty;
    if(ty == 1) {
      cin >> l[i] >> r[i] >> c[i] >> k[i];
      add[l[i]].insert(i);
      sub[r[i]+1].insert(i);
    }
    else if(ty == 2) {
      cin >> l[i] >> r[i] >> k[i];
      k[i] = -k[i];
      c[i] = 0;
      add[l[i]].insert(i);
      sub[r[i]+1].insert(i);
    }
    else {
      cin >> a[i] >> b[i];
      k[i] = 0;
      qry[a[i]].insert(i);
    }
  }
  segtree_basic stb;
  segtree_bruh str;
  stb.resize(q);
  str.resize(q);
  for(int i=1; i<=n; i++) {
    for(int x: add[i]) {
      str.point_add(x, k[x]);
      if(k[x] < 0) not_add(x, k[x]);
      else stb.range_add(x, x, k[x]);
    }
    for(int x: sub[i]) {
      str.point_add(x, -k[x]);
      if(k[x] < 0) not_add(x, -k[x]);
      else stb.range_add(x, x, -k[x]);
    }
    for(int x: qry[i]) {
      pair<int, int> bruh = str.prefix_mss(x);
      if(bruh.first < b[x]) {
        ans[x] = 0; continue;
      }
      int pss = 0;
      if(bruh.second>1) pss= stb.query_sum(1, bruh.second-1);
      int bruh2= sum(x)-sum(bruh.second);
      ans[x] = c[stb.query_firstPSAtLeast(bruh.second, x, b[x] + pss - bruh2)];
    }
  }
  for(int i=1; i<=q; i++) if(tyy[i] == 3) cout << ans[i] << '\n';
  
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1236 KB Output is correct
2 Correct 3 ms 1492 KB Output is correct
3 Correct 2 ms 1236 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 4 ms 1492 KB Output is correct
8 Correct 3 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 3 ms 1552 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 2 ms 1492 KB Output is correct
15 Correct 3 ms 1236 KB Output is correct
16 Correct 3 ms 1496 KB Output is correct
17 Correct 3 ms 1236 KB Output is correct
18 Correct 3 ms 1496 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 3 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1236 KB Output is correct
2 Correct 3 ms 1492 KB Output is correct
3 Correct 2 ms 1236 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 4 ms 1492 KB Output is correct
8 Correct 3 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 3 ms 1552 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 2 ms 1492 KB Output is correct
15 Correct 3 ms 1236 KB Output is correct
16 Correct 3 ms 1496 KB Output is correct
17 Correct 3 ms 1236 KB Output is correct
18 Correct 3 ms 1496 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 3 ms 1492 KB Output is correct
21 Correct 3 ms 1492 KB Output is correct
22 Correct 3 ms 1492 KB Output is correct
23 Correct 3 ms 1364 KB Output is correct
24 Correct 3 ms 1492 KB Output is correct
25 Correct 2 ms 1108 KB Output is correct
26 Correct 2 ms 1148 KB Output is correct
27 Correct 3 ms 1492 KB Output is correct
28 Correct 3 ms 1564 KB Output is correct
29 Correct 3 ms 1492 KB Output is correct
30 Correct 3 ms 1492 KB Output is correct
31 Correct 3 ms 1492 KB Output is correct
32 Correct 3 ms 1492 KB Output is correct
33 Correct 3 ms 1364 KB Output is correct
34 Correct 3 ms 1492 KB Output is correct
35 Correct 3 ms 1364 KB Output is correct
36 Correct 3 ms 1492 KB Output is correct
37 Correct 3 ms 1108 KB Output is correct
38 Correct 4 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 38688 KB Output is correct
2 Correct 123 ms 39000 KB Output is correct
3 Correct 106 ms 38580 KB Output is correct
4 Correct 112 ms 38628 KB Output is correct
5 Correct 121 ms 38968 KB Output is correct
6 Correct 127 ms 39020 KB Output is correct
7 Correct 65 ms 27228 KB Output is correct
8 Correct 65 ms 27584 KB Output is correct
9 Correct 118 ms 38824 KB Output is correct
10 Correct 120 ms 38980 KB Output is correct
11 Correct 126 ms 38984 KB Output is correct
12 Correct 124 ms 38980 KB Output is correct
13 Correct 100 ms 32692 KB Output is correct
14 Correct 133 ms 38604 KB Output is correct
15 Correct 128 ms 36004 KB Output is correct
16 Correct 136 ms 39324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 618 ms 134828 KB Output is correct
2 Correct 436 ms 111104 KB Output is correct
3 Correct 606 ms 149316 KB Output is correct
4 Correct 454 ms 118064 KB Output is correct
5 Correct 464 ms 111652 KB Output is correct
6 Correct 655 ms 150440 KB Output is correct
7 Correct 283 ms 112148 KB Output is correct
8 Correct 348 ms 112088 KB Output is correct
9 Correct 616 ms 147564 KB Output is correct
10 Correct 598 ms 147676 KB Output is correct
11 Correct 613 ms 149416 KB Output is correct
12 Correct 622 ms 150364 KB Output is correct
13 Correct 606 ms 149476 KB Output is correct
14 Correct 631 ms 150352 KB Output is correct
15 Correct 658 ms 150152 KB Output is correct
16 Correct 678 ms 150248 KB Output is correct
17 Correct 660 ms 150220 KB Output is correct
18 Correct 672 ms 149756 KB Output is correct
19 Correct 632 ms 150316 KB Output is correct
20 Correct 617 ms 149960 KB Output is correct
21 Correct 615 ms 150344 KB Output is correct
22 Correct 633 ms 150256 KB Output is correct
23 Correct 625 ms 150184 KB Output is correct
24 Correct 643 ms 150228 KB Output is correct
25 Correct 627 ms 139096 KB Output is correct
26 Correct 662 ms 149112 KB Output is correct
27 Correct 480 ms 149912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1236 KB Output is correct
2 Correct 3 ms 1492 KB Output is correct
3 Correct 2 ms 1236 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 4 ms 1492 KB Output is correct
8 Correct 3 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 3 ms 1552 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 2 ms 1492 KB Output is correct
15 Correct 3 ms 1236 KB Output is correct
16 Correct 3 ms 1496 KB Output is correct
17 Correct 3 ms 1236 KB Output is correct
18 Correct 3 ms 1496 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 3 ms 1492 KB Output is correct
21 Correct 115 ms 38688 KB Output is correct
22 Correct 123 ms 39000 KB Output is correct
23 Correct 106 ms 38580 KB Output is correct
24 Correct 112 ms 38628 KB Output is correct
25 Correct 121 ms 38968 KB Output is correct
26 Correct 127 ms 39020 KB Output is correct
27 Correct 65 ms 27228 KB Output is correct
28 Correct 65 ms 27584 KB Output is correct
29 Correct 118 ms 38824 KB Output is correct
30 Correct 120 ms 38980 KB Output is correct
31 Correct 126 ms 38984 KB Output is correct
32 Correct 124 ms 38980 KB Output is correct
33 Correct 100 ms 32692 KB Output is correct
34 Correct 133 ms 38604 KB Output is correct
35 Correct 128 ms 36004 KB Output is correct
36 Correct 136 ms 39324 KB Output is correct
37 Correct 110 ms 34648 KB Output is correct
38 Correct 104 ms 31876 KB Output is correct
39 Correct 55 ms 23912 KB Output is correct
40 Correct 74 ms 27212 KB Output is correct
41 Correct 151 ms 38580 KB Output is correct
42 Correct 123 ms 38916 KB Output is correct
43 Correct 137 ms 38800 KB Output is correct
44 Correct 128 ms 38732 KB Output is correct
45 Correct 124 ms 38816 KB Output is correct
46 Correct 136 ms 38780 KB Output is correct
47 Correct 87 ms 38452 KB Output is correct
48 Correct 145 ms 38508 KB Output is correct
49 Correct 95 ms 27476 KB Output is correct
50 Correct 141 ms 34304 KB Output is correct
51 Correct 140 ms 38944 KB Output is correct
52 Correct 143 ms 38992 KB Output is correct
53 Correct 113 ms 31680 KB Output is correct
54 Correct 136 ms 39332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 149 ms 34780 KB Output is correct
2 Correct 127 ms 36300 KB Output is correct
3 Correct 128 ms 38156 KB Output is correct
4 Correct 99 ms 29152 KB Output is correct
5 Correct 121 ms 33936 KB Output is correct
6 Correct 168 ms 38220 KB Output is correct
7 Correct 66 ms 25516 KB Output is correct
8 Correct 85 ms 23932 KB Output is correct
9 Correct 108 ms 38120 KB Output is correct
10 Correct 102 ms 28220 KB Output is correct
11 Correct 152 ms 38200 KB Output is correct
12 Correct 167 ms 38176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1236 KB Output is correct
2 Correct 3 ms 1492 KB Output is correct
3 Correct 2 ms 1236 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 4 ms 1492 KB Output is correct
8 Correct 3 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 3 ms 1552 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 2 ms 1492 KB Output is correct
15 Correct 3 ms 1236 KB Output is correct
16 Correct 3 ms 1496 KB Output is correct
17 Correct 3 ms 1236 KB Output is correct
18 Correct 3 ms 1496 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 3 ms 1492 KB Output is correct
21 Correct 3 ms 1492 KB Output is correct
22 Correct 3 ms 1492 KB Output is correct
23 Correct 3 ms 1364 KB Output is correct
24 Correct 3 ms 1492 KB Output is correct
25 Correct 2 ms 1108 KB Output is correct
26 Correct 2 ms 1148 KB Output is correct
27 Correct 3 ms 1492 KB Output is correct
28 Correct 3 ms 1564 KB Output is correct
29 Correct 3 ms 1492 KB Output is correct
30 Correct 3 ms 1492 KB Output is correct
31 Correct 3 ms 1492 KB Output is correct
32 Correct 3 ms 1492 KB Output is correct
33 Correct 3 ms 1364 KB Output is correct
34 Correct 3 ms 1492 KB Output is correct
35 Correct 3 ms 1364 KB Output is correct
36 Correct 3 ms 1492 KB Output is correct
37 Correct 3 ms 1108 KB Output is correct
38 Correct 4 ms 1492 KB Output is correct
39 Correct 115 ms 38688 KB Output is correct
40 Correct 123 ms 39000 KB Output is correct
41 Correct 106 ms 38580 KB Output is correct
42 Correct 112 ms 38628 KB Output is correct
43 Correct 121 ms 38968 KB Output is correct
44 Correct 127 ms 39020 KB Output is correct
45 Correct 65 ms 27228 KB Output is correct
46 Correct 65 ms 27584 KB Output is correct
47 Correct 118 ms 38824 KB Output is correct
48 Correct 120 ms 38980 KB Output is correct
49 Correct 126 ms 38984 KB Output is correct
50 Correct 124 ms 38980 KB Output is correct
51 Correct 100 ms 32692 KB Output is correct
52 Correct 133 ms 38604 KB Output is correct
53 Correct 128 ms 36004 KB Output is correct
54 Correct 136 ms 39324 KB Output is correct
55 Correct 110 ms 34648 KB Output is correct
56 Correct 104 ms 31876 KB Output is correct
57 Correct 55 ms 23912 KB Output is correct
58 Correct 74 ms 27212 KB Output is correct
59 Correct 151 ms 38580 KB Output is correct
60 Correct 123 ms 38916 KB Output is correct
61 Correct 137 ms 38800 KB Output is correct
62 Correct 128 ms 38732 KB Output is correct
63 Correct 124 ms 38816 KB Output is correct
64 Correct 136 ms 38780 KB Output is correct
65 Correct 87 ms 38452 KB Output is correct
66 Correct 145 ms 38508 KB Output is correct
67 Correct 95 ms 27476 KB Output is correct
68 Correct 141 ms 34304 KB Output is correct
69 Correct 140 ms 38944 KB Output is correct
70 Correct 143 ms 38992 KB Output is correct
71 Correct 113 ms 31680 KB Output is correct
72 Correct 136 ms 39332 KB Output is correct
73 Correct 149 ms 34780 KB Output is correct
74 Correct 127 ms 36300 KB Output is correct
75 Correct 128 ms 38156 KB Output is correct
76 Correct 99 ms 29152 KB Output is correct
77 Correct 121 ms 33936 KB Output is correct
78 Correct 168 ms 38220 KB Output is correct
79 Correct 66 ms 25516 KB Output is correct
80 Correct 85 ms 23932 KB Output is correct
81 Correct 108 ms 38120 KB Output is correct
82 Correct 102 ms 28220 KB Output is correct
83 Correct 152 ms 38200 KB Output is correct
84 Correct 167 ms 38176 KB Output is correct
85 Correct 125 ms 34404 KB Output is correct
86 Correct 140 ms 39136 KB Output is correct
87 Correct 136 ms 35012 KB Output is correct
88 Correct 153 ms 39396 KB Output is correct
89 Correct 80 ms 27500 KB Output is correct
90 Correct 130 ms 39400 KB Output is correct
91 Correct 117 ms 31124 KB Output is correct
92 Correct 104 ms 29832 KB Output is correct
93 Correct 127 ms 39380 KB Output is correct
94 Correct 125 ms 39204 KB Output is correct
95 Correct 122 ms 37784 KB Output is correct
96 Correct 125 ms 39404 KB Output is correct
97 Correct 132 ms 39316 KB Output is correct
98 Correct 121 ms 32488 KB Output is correct
99 Correct 91 ms 38952 KB Output is correct
100 Correct 125 ms 33108 KB Output is correct
101 Correct 146 ms 38952 KB Output is correct
102 Correct 113 ms 39372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1236 KB Output is correct
2 Correct 3 ms 1492 KB Output is correct
3 Correct 2 ms 1236 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 4 ms 1492 KB Output is correct
8 Correct 3 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 3 ms 1552 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 3 ms 1504 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 2 ms 1492 KB Output is correct
15 Correct 3 ms 1236 KB Output is correct
16 Correct 3 ms 1496 KB Output is correct
17 Correct 3 ms 1236 KB Output is correct
18 Correct 3 ms 1496 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 3 ms 1492 KB Output is correct
21 Correct 3 ms 1492 KB Output is correct
22 Correct 3 ms 1492 KB Output is correct
23 Correct 3 ms 1364 KB Output is correct
24 Correct 3 ms 1492 KB Output is correct
25 Correct 2 ms 1108 KB Output is correct
26 Correct 2 ms 1148 KB Output is correct
27 Correct 3 ms 1492 KB Output is correct
28 Correct 3 ms 1564 KB Output is correct
29 Correct 3 ms 1492 KB Output is correct
30 Correct 3 ms 1492 KB Output is correct
31 Correct 3 ms 1492 KB Output is correct
32 Correct 3 ms 1492 KB Output is correct
33 Correct 3 ms 1364 KB Output is correct
34 Correct 3 ms 1492 KB Output is correct
35 Correct 3 ms 1364 KB Output is correct
36 Correct 3 ms 1492 KB Output is correct
37 Correct 3 ms 1108 KB Output is correct
38 Correct 4 ms 1492 KB Output is correct
39 Correct 115 ms 38688 KB Output is correct
40 Correct 123 ms 39000 KB Output is correct
41 Correct 106 ms 38580 KB Output is correct
42 Correct 112 ms 38628 KB Output is correct
43 Correct 121 ms 38968 KB Output is correct
44 Correct 127 ms 39020 KB Output is correct
45 Correct 65 ms 27228 KB Output is correct
46 Correct 65 ms 27584 KB Output is correct
47 Correct 118 ms 38824 KB Output is correct
48 Correct 120 ms 38980 KB Output is correct
49 Correct 126 ms 38984 KB Output is correct
50 Correct 124 ms 38980 KB Output is correct
51 Correct 100 ms 32692 KB Output is correct
52 Correct 133 ms 38604 KB Output is correct
53 Correct 128 ms 36004 KB Output is correct
54 Correct 136 ms 39324 KB Output is correct
55 Correct 618 ms 134828 KB Output is correct
56 Correct 436 ms 111104 KB Output is correct
57 Correct 606 ms 149316 KB Output is correct
58 Correct 454 ms 118064 KB Output is correct
59 Correct 464 ms 111652 KB Output is correct
60 Correct 655 ms 150440 KB Output is correct
61 Correct 283 ms 112148 KB Output is correct
62 Correct 348 ms 112088 KB Output is correct
63 Correct 616 ms 147564 KB Output is correct
64 Correct 598 ms 147676 KB Output is correct
65 Correct 613 ms 149416 KB Output is correct
66 Correct 622 ms 150364 KB Output is correct
67 Correct 606 ms 149476 KB Output is correct
68 Correct 631 ms 150352 KB Output is correct
69 Correct 658 ms 150152 KB Output is correct
70 Correct 678 ms 150248 KB Output is correct
71 Correct 660 ms 150220 KB Output is correct
72 Correct 672 ms 149756 KB Output is correct
73 Correct 632 ms 150316 KB Output is correct
74 Correct 617 ms 149960 KB Output is correct
75 Correct 615 ms 150344 KB Output is correct
76 Correct 633 ms 150256 KB Output is correct
77 Correct 625 ms 150184 KB Output is correct
78 Correct 643 ms 150228 KB Output is correct
79 Correct 627 ms 139096 KB Output is correct
80 Correct 662 ms 149112 KB Output is correct
81 Correct 480 ms 149912 KB Output is correct
82 Correct 110 ms 34648 KB Output is correct
83 Correct 104 ms 31876 KB Output is correct
84 Correct 55 ms 23912 KB Output is correct
85 Correct 74 ms 27212 KB Output is correct
86 Correct 151 ms 38580 KB Output is correct
87 Correct 123 ms 38916 KB Output is correct
88 Correct 137 ms 38800 KB Output is correct
89 Correct 128 ms 38732 KB Output is correct
90 Correct 124 ms 38816 KB Output is correct
91 Correct 136 ms 38780 KB Output is correct
92 Correct 87 ms 38452 KB Output is correct
93 Correct 145 ms 38508 KB Output is correct
94 Correct 95 ms 27476 KB Output is correct
95 Correct 141 ms 34304 KB Output is correct
96 Correct 140 ms 38944 KB Output is correct
97 Correct 143 ms 38992 KB Output is correct
98 Correct 113 ms 31680 KB Output is correct
99 Correct 136 ms 39332 KB Output is correct
100 Correct 149 ms 34780 KB Output is correct
101 Correct 127 ms 36300 KB Output is correct
102 Correct 128 ms 38156 KB Output is correct
103 Correct 99 ms 29152 KB Output is correct
104 Correct 121 ms 33936 KB Output is correct
105 Correct 168 ms 38220 KB Output is correct
106 Correct 66 ms 25516 KB Output is correct
107 Correct 85 ms 23932 KB Output is correct
108 Correct 108 ms 38120 KB Output is correct
109 Correct 102 ms 28220 KB Output is correct
110 Correct 152 ms 38200 KB Output is correct
111 Correct 167 ms 38176 KB Output is correct
112 Correct 125 ms 34404 KB Output is correct
113 Correct 140 ms 39136 KB Output is correct
114 Correct 136 ms 35012 KB Output is correct
115 Correct 153 ms 39396 KB Output is correct
116 Correct 80 ms 27500 KB Output is correct
117 Correct 130 ms 39400 KB Output is correct
118 Correct 117 ms 31124 KB Output is correct
119 Correct 104 ms 29832 KB Output is correct
120 Correct 127 ms 39380 KB Output is correct
121 Correct 125 ms 39204 KB Output is correct
122 Correct 122 ms 37784 KB Output is correct
123 Correct 125 ms 39404 KB Output is correct
124 Correct 132 ms 39316 KB Output is correct
125 Correct 121 ms 32488 KB Output is correct
126 Correct 91 ms 38952 KB Output is correct
127 Correct 125 ms 33108 KB Output is correct
128 Correct 146 ms 38952 KB Output is correct
129 Correct 113 ms 39372 KB Output is correct
130 Correct 623 ms 148972 KB Output is correct
131 Correct 484 ms 109736 KB Output is correct
132 Correct 619 ms 149788 KB Output is correct
133 Correct 617 ms 144632 KB Output is correct
134 Correct 538 ms 132344 KB Output is correct
135 Correct 646 ms 151244 KB Output is correct
136 Correct 612 ms 148564 KB Output is correct
137 Correct 629 ms 148480 KB Output is correct
138 Correct 599 ms 149964 KB Output is correct
139 Correct 626 ms 150988 KB Output is correct
140 Correct 629 ms 150352 KB Output is correct
141 Correct 649 ms 150988 KB Output is correct
142 Correct 651 ms 150932 KB Output is correct
143 Correct 634 ms 150988 KB Output is correct
144 Correct 630 ms 150528 KB Output is correct
145 Correct 675 ms 150944 KB Output is correct
146 Correct 666 ms 150768 KB Output is correct
147 Correct 640 ms 150864 KB Output is correct
148 Correct 664 ms 150912 KB Output is correct
149 Correct 648 ms 150908 KB Output is correct
150 Correct 359 ms 149280 KB Output is correct
151 Correct 694 ms 149560 KB Output is correct
152 Correct 673 ms 149708 KB Output is correct
153 Correct 492 ms 150940 KB Output is correct