Submission #502588

# Submission time Handle Problem Language Result Execution time Memory
502588 2022-01-06T09:58:48 Z cig32 Food Court (JOI21_foodcourt) C++17
35 / 100
933 ms 524292 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
    int u = uniform_int_distribution<int>(x, y)(rng);
    return u;
}
int bm(int b, int p) { // bigmod
    if(p==0) return 1;
    int r = bm(b, p/2);
    if(p&1) return (((r*r) % MOD) * b) % MOD;
    return (r*r) % MOD;
}
int N, M, Q;
 
struct segtree_beats {
    bool cmp(__int128 x, __int128 y) { return x > y; }
    int stok;
    const __int128 extr = 2e18;
    struct node {
        __int128 max1, max2, maxc;
        __int128 min1, min2, minc;
        __int128 lazy, sum;
        __int128 l, r;
    };
    vector<node> a;
    void pushtag_max(int idx, __int128 val) {
        if(val >= a[idx].max1) return;
        a[idx].sum -= (a[idx].max1 - val) * a[idx].maxc;
        a[idx].max1 = val;
        if(a[idx].l == a[idx].r) {
            a[idx].min1 = val;
        }
        else {
            if(a[idx].min1 >= val) {
                a[idx].min1 = val;
                a[idx].min2 = extr;
                a[idx].minc = a[idx].r - a[idx].l + 1;
            }
            else if(a[idx].min2 > val && a[idx].min2 != extr) {
                a[idx].min2 = val;
            }
        }
    }
    void pushtag_min(int idx, __int128 val) {
        if(val <= a[idx].min1) return;
        a[idx].sum += (val - a[idx].min1) * a[idx].minc;
        a[idx].min1 = val;
        if(a[idx].l == a[idx].r) {
            a[idx].max1 = val;
        }
        else {
            if(a[idx].max1 <= val) {
                a[idx].max1 = val;
                a[idx].max2 = -extr;
                a[idx].maxc = a[idx].r - a[idx].l + 1;
            }
            else if(a[idx].max2 < val && a[idx].max2 != -extr) {
                a[idx].max2 = val;
            }
        }
    }
    void pushtag_add(int idx, __int128 val) {
        a[idx].max1 += val;
        if(a[idx].max2 != -extr) a[idx].max2 += val;
        a[idx].min1 += val;
        if(a[idx].min2 != extr) a[idx].min2 += val;
        a[idx].lazy += val;
        a[idx].sum += val * (a[idx].r - a[idx].l + 1);
    }
    void pushdown(int idx) {
        pushtag_add(2*idx+1, a[idx].lazy);
        pushtag_add(2*idx+2, a[idx].lazy);
        a[idx].lazy = 0;
        pushtag_max(2*idx+1, a[idx].max1);
        pushtag_max(2*idx+2, a[idx].max1);
        pushtag_min(2*idx+1, a[idx].min1);
        pushtag_min(2*idx+2, a[idx].min1);
    }
    void pushup(int idx) {
        __int128 max1, max2, maxc;
        __int128 min1, min2, minc;
        __int128 lazy, sum;
        __int128 l, r;
        a[idx].max1 = max(a[2*idx+1].max1, a[2*idx+2].max1);
        a[idx].max2 = (a[2*idx+1].max1 == a[2*idx+2].max1 ?
                       max(a[2*idx+1].max2, a[2*idx+2].max2) :
                       (a[2*idx+1].max1 < a[2*idx+2].max1 ?
                        max(a[2*idx+1].max1, a[2*idx+2].max2) : 
                        max(a[2*idx+1].max2, a[2*idx+2].max1)
                        ));
        a[idx].maxc = (a[2*idx+1].max1 == a[2*idx+2].max1 ? 
                       a[2*idx+1].maxc + a[2*idx+2].maxc :
                       (a[2*idx+1].max1 < a[2*idx+2].max1 ? 
                        a[2*idx+2].maxc :
                        a[2*idx+1].maxc)
                       );
        a[idx].min1 = min(a[2*idx+1].min1, a[2*idx+2].min1);
        a[idx].min2 = (a[2*idx+1].min1 == a[2*idx+2].min1 ?
                       min(a[2*idx+1].min2, a[2*idx+2].min2) :
                       (a[2*idx+1].min1 > a[2*idx+2].min1 ?
                        min(a[2*idx+1].min1, a[2*idx+2].min2) : 
                        min(a[2*idx+1].min2, a[2*idx+2].min1)
                        ));
        a[idx].minc = (a[2*idx+1].min1 == a[2*idx+2].min1 ? 
                       a[2*idx+1].minc + a[2*idx+2].minc :
                       (a[2*idx+1].min1 > a[2*idx+2].min1 ? 
                        a[2*idx+2].minc :
                        a[2*idx+1].minc)
                       );
        a[idx].sum = a[2*idx+1].sum + a[2*idx+2].sum;
    }
    void init1(int l, int r, int idx, __int128 val) {
        a[idx].l = l, a[idx].r = r;
        if(l == r) {
            a[idx].max1 = a[idx].min1 = val;
            a[idx].max2 = -extr;
            a[idx].min2 = extr;
            a[idx].maxc = a[idx].minc = 1;
            a[idx].lazy = 0;
            a[idx].sum = val;
            return;
        }
        int mid = (l+r) >> 1;
        init1(l, mid, 2*idx+1, val);
        init1(mid+1, r, 2*idx+2, val);
        pushup(idx);
    }
    void u1(int l, int r, int constl, int constr, int idx, __int128 v) {
        if(v >= a[idx].max1) return;
        if(l<=constl && constr<=r && v>a[idx].max2) {
            pushtag_max(idx, v);
            return;
        }
        pushdown(idx);
        int mid = (constl+constr) >> 1;
        if(mid < l || r < constl) u1(l, r, mid+1, constr, 2*idx+2, v);
        else if(constr < l || r < mid+1) u1(l, r, constl, mid, 2*idx+1, v);
        else {
            u1(l, r, constl, mid, 2*idx+1, v);
            u1(l, r, mid+1, constr, 2*idx+2, v);
        }
        pushup(idx);
    }
    void u2(int l, int r, int constl, int constr, int idx, __int128 v) {
        if(v <= a[idx].min1) return;
        if(l<=constl && constr<=r && v<a[idx].min2) {
            pushtag_min(idx, v);
            return;
        }
        pushdown(idx);
        int mid = (constl+constr) >> 1;
        if(mid < l || r < constl) u2(l, r, mid+1, constr, 2*idx+2, v);
        else if(constr < l || r < mid+1) u2(l, r, constl, mid, 2*idx+1, v);
        else {
            u2(l, r, constl, mid, 2*idx+1, v);
            u2(l, r, mid+1, constr, 2*idx+2, v);
        }
        pushup(idx);
    }
    void u3(int l, int r, int constl, int constr, int idx, __int128 v) {
        if(l <= constl && constr <= r) {
            pushtag_add(idx, v);
            return;
        }
        pushdown(idx);
        int mid = (constl+constr) >> 1;
        if(mid < l || r < constl) u3(l, r, mid+1, constr, 2*idx+2, v);
        else if(constr < l || r < mid+1) u3(l, r, constl, mid, 2*idx+1, v);
        else {
            u3(l, r, constl, mid, 2*idx+1, v);
            u3(l, r, mid+1, constr, 2*idx+2, v);
        }
        pushup(idx);
    }
    __int128 qu(int l, int r, int constl, int constr, int idx) {
        if(l <= constl && constr <= r) {
            return a[idx].sum;
        }
        pushdown(idx);
        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 {
            return qu(l, r, constl, mid, 2*idx+1) + qu(l, r, mid+1, constr, 2*idx+2);
        }
    }
    public:
    void resize(int k) {
        stok = k;
        a.resize(4*k + 10);
    }
    void init(__int128 v) { // Initialize everything to v
        init1(0, stok, 0, v);
    }
    void min_with(int l, int r, __int128 v) {
        u1(l, r, 0, stok, 0, v);
    }
    void max_with(int l, int r, __int128 v) {
        u2(l, r, 0, stok, 0, v);
    }
    void range_add(int l, int r, __int128 v) {
        u3(l, r, 0, stok, 0, v);
    }
    long long query_sum(int l, int r) {
        return (long long)qu(l, r, 0, stok, 0);
    }
};
 
segtree_beats a;
void join(int l, int r, int c, int k) {
    a.range_add(l, r, k);
}
void leave(int l, int r, int k) {
    a.range_add(l, r, -k);
    a.max_with(l, r, 0);
}
int service(int shop, int b) {
    return (a.query_sum(shop, shop) >= b ? 1 : 0);
}
struct easy {
    deque<pair<int, int> > ok[MAXN];
    public:
    void join(int l, int r, int c, int k) {
        for(int i=l; i<=r; i++) ok[i].push_back({c, k});
    }
    void leave(int l, int r, int k) {
        for(int i=l; i<=r; i++) {
            int m = k;
            while(ok[i].size() && m > 0) {
                pair<int, int> f = ok[i].front();
                if(m >= f.second) {
                    m -= f.second;
                    ok[i].pop_front();
                }
                else {
                    f.second -= m;
                    ok[i].pop_front();
                    ok[i].push_front(f);
                    break;
                }
            }
        }
    }
    int service(int a, int b) {
        stack<pair<int, int> > st;
        int ans = 0;
        while(ok[a].size()) {
            pair<int, int> f = ok[a].front();
            if(b <= f.second) {
                ans = f.first;
                break;
            }
            else b -= f.second;
            st.push(f);
            ok[a].pop_front();
        }
        while(st.size()) {
            ok[a].push_front(st.top());
            st.pop();
        }
        return ans;
    }
};
void solve_easy() {
    easy ono;
    while(Q--) {
        int t;
        cin >> t;
        if(t == 1) {
            int l, r, c, k;
            cin >> l >> r >> c >> k;
            ono.join(l, r, c, k);
        }
        else if(t == 2) {
            int l, r, k;
            cin >> l >> r >> k;
            ono.leave(l, r, k);
        }
        else {
            int a, b;
            cin >> a >> b;
            cout << ono.service(a, b) << "\n";
        }
    }
}
struct special {
    int N, M, Q;
    vector<pair<int, int> > v[MAXN];
    int ptr[MAXN];
    void join(int l, int r, int c, int k) {
        for(int i=l; i<=r; i++) {
            v[i].push_back({c, k});
        }
    }
     
    void leave(int l, int r, int k) {
        for(int i=l; i<=r; i++) {
            ptr[i] += k;
            ptr[i] = min(ptr[i], (int)v[i].size());
        }
    }
     
    int service(int a, int b) {
        if(v[a].size() > 0 && ptr[a] + b - 1 <= v[a].size() - 1) return v[a][ptr[a] + b - 1].first;
        else return 0;
    }
};
void solve_special() {
    special ono;
    while(Q--) {
        int t;
        cin >> t;
        if(t == 1) {
            int l, r, c, k;
            cin >> l >> r >> c >> k;
            ono.join(l, r, c, k);
        }
        else if(t == 2) {
            int l, r, k;
            cin >> l >> r >> k;
            ono.leave(l, r, k);
        }
        else {
            int a, b;
            cin >> a >> b;
            cout << ono.service(a, b) << "\n";
        }
    }
}
void solve(int tc) {
    cin >> N >> M >> Q;
    if(N <= 2000 && Q <= 2000) {
        solve_easy();
        return;
    }
    if(M > 1) {
        solve_special();
        return;
    }
    a.resize(N);
    a.init(0);
    while(Q--) {
        int t;
        cin >> t;
        if(t == 1) {
            int l, r, c, k;
            cin >> l >> r >> c >> k;
            join(l, r, c, k);
        }
        else if(t == 2) {
            int l, r, k;
            cin >> l >> r >> k;
            leave(l, r, k);
        }
        else {
            int a, b;
            cin >> a >> b;
            cout << service(a, b) << "\n";
        }
    }
}
int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1; //cin >> t;
    for(int i=1; i<=t; i++) {
        solve(i);
    }
}

Compilation message

foodcourt.cpp: In member function 'void segtree_beats::pushup(long long int)':
foodcourt.cpp:86:18: warning: unused variable 'max1' [-Wunused-variable]
   86 |         __int128 max1, max2, maxc;
      |                  ^~~~
foodcourt.cpp:86:24: warning: unused variable 'max2' [-Wunused-variable]
   86 |         __int128 max1, max2, maxc;
      |                        ^~~~
foodcourt.cpp:86:30: warning: unused variable 'maxc' [-Wunused-variable]
   86 |         __int128 max1, max2, maxc;
      |                              ^~~~
foodcourt.cpp:87:18: warning: unused variable 'min1' [-Wunused-variable]
   87 |         __int128 min1, min2, minc;
      |                  ^~~~
foodcourt.cpp:87:24: warning: unused variable 'min2' [-Wunused-variable]
   87 |         __int128 min1, min2, minc;
      |                        ^~~~
foodcourt.cpp:87:30: warning: unused variable 'minc' [-Wunused-variable]
   87 |         __int128 min1, min2, minc;
      |                              ^~~~
foodcourt.cpp:88:18: warning: unused variable 'lazy' [-Wunused-variable]
   88 |         __int128 lazy, sum;
      |                  ^~~~
foodcourt.cpp:88:24: warning: unused variable 'sum' [-Wunused-variable]
   88 |         __int128 lazy, sum;
      |                        ^~~
foodcourt.cpp:89:18: warning: unused variable 'l' [-Wunused-variable]
   89 |         __int128 l, r;
      |                  ^
foodcourt.cpp:89:21: warning: unused variable 'r' [-Wunused-variable]
   89 |         __int128 l, r;
      |                     ^
foodcourt.cpp: In member function 'long long int special::service(long long int, long long int)':
foodcourt.cpp:310:46: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  310 |         if(v[a].size() > 0 && ptr[a] + b - 1 <= v[a].size() - 1) return v[a][ptr[a] + b - 1].first;
      |                               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 128 ms 202740 KB Output is correct
2 Correct 128 ms 203072 KB Output is correct
3 Correct 135 ms 209708 KB Output is correct
4 Correct 139 ms 213164 KB Output is correct
5 Correct 117 ms 202308 KB Output is correct
6 Correct 112 ms 202180 KB Output is correct
7 Correct 140 ms 214840 KB Output is correct
8 Correct 138 ms 210396 KB Output is correct
9 Correct 132 ms 202988 KB Output is correct
10 Correct 139 ms 209860 KB Output is correct
11 Correct 138 ms 207036 KB Output is correct
12 Correct 136 ms 203104 KB Output is correct
13 Correct 133 ms 203204 KB Output is correct
14 Correct 144 ms 204420 KB Output is correct
15 Correct 135 ms 205124 KB Output is correct
16 Correct 141 ms 204232 KB Output is correct
17 Correct 130 ms 202564 KB Output is correct
18 Correct 134 ms 202820 KB Output is correct
19 Correct 112 ms 202180 KB Output is correct
20 Correct 117 ms 202252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 202740 KB Output is correct
2 Correct 128 ms 203072 KB Output is correct
3 Correct 135 ms 209708 KB Output is correct
4 Correct 139 ms 213164 KB Output is correct
5 Correct 117 ms 202308 KB Output is correct
6 Correct 112 ms 202180 KB Output is correct
7 Correct 140 ms 214840 KB Output is correct
8 Correct 138 ms 210396 KB Output is correct
9 Correct 132 ms 202988 KB Output is correct
10 Correct 139 ms 209860 KB Output is correct
11 Correct 138 ms 207036 KB Output is correct
12 Correct 136 ms 203104 KB Output is correct
13 Correct 133 ms 203204 KB Output is correct
14 Correct 144 ms 204420 KB Output is correct
15 Correct 135 ms 205124 KB Output is correct
16 Correct 141 ms 204232 KB Output is correct
17 Correct 130 ms 202564 KB Output is correct
18 Correct 134 ms 202820 KB Output is correct
19 Correct 112 ms 202180 KB Output is correct
20 Correct 117 ms 202252 KB Output is correct
21 Correct 131 ms 202948 KB Output is correct
22 Correct 133 ms 203100 KB Output is correct
23 Correct 142 ms 209664 KB Output is correct
24 Correct 141 ms 213340 KB Output is correct
25 Correct 111 ms 202188 KB Output is correct
26 Correct 113 ms 202292 KB Output is correct
27 Correct 149 ms 214392 KB Output is correct
28 Correct 144 ms 211180 KB Output is correct
29 Correct 142 ms 204852 KB Output is correct
30 Correct 143 ms 209404 KB Output is correct
31 Correct 152 ms 206956 KB Output is correct
32 Correct 137 ms 203028 KB Output is correct
33 Correct 141 ms 203032 KB Output is correct
34 Correct 148 ms 205368 KB Output is correct
35 Correct 143 ms 203752 KB Output is correct
36 Correct 145 ms 204228 KB Output is correct
37 Correct 117 ms 202212 KB Output is correct
38 Correct 114 ms 202296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 572 ms 13264 KB Output is correct
2 Correct 458 ms 15292 KB Output is correct
3 Correct 572 ms 16364 KB Output is correct
4 Correct 593 ms 16456 KB Output is correct
5 Correct 465 ms 19396 KB Output is correct
6 Correct 464 ms 19336 KB Output is correct
7 Correct 20 ms 11068 KB Output is correct
8 Correct 20 ms 11308 KB Output is correct
9 Correct 933 ms 14084 KB Output is correct
10 Correct 933 ms 14092 KB Output is correct
11 Correct 923 ms 14176 KB Output is correct
12 Correct 932 ms 14060 KB Output is correct
13 Correct 182 ms 15928 KB Output is correct
14 Correct 268 ms 16544 KB Output is correct
15 Correct 64 ms 19200 KB Output is correct
16 Correct 78 ms 19148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 788 ms 146496 KB Output is correct
2 Correct 662 ms 126468 KB Output is correct
3 Correct 787 ms 162884 KB Output is correct
4 Correct 575 ms 160244 KB Output is correct
5 Correct 577 ms 122312 KB Output is correct
6 Correct 776 ms 163192 KB Output is correct
7 Correct 75 ms 4544 KB Output is correct
8 Correct 82 ms 4520 KB Output is correct
9 Correct 663 ms 163384 KB Output is correct
10 Correct 664 ms 163096 KB Output is correct
11 Correct 818 ms 163100 KB Output is correct
12 Correct 764 ms 163076 KB Output is correct
13 Correct 757 ms 163008 KB Output is correct
14 Correct 808 ms 163140 KB Output is correct
15 Correct 899 ms 163008 KB Output is correct
16 Correct 889 ms 163032 KB Output is correct
17 Correct 876 ms 162864 KB Output is correct
18 Correct 822 ms 163140 KB Output is correct
19 Correct 898 ms 163008 KB Output is correct
20 Correct 831 ms 163092 KB Output is correct
21 Correct 888 ms 162988 KB Output is correct
22 Correct 894 ms 163064 KB Output is correct
23 Correct 829 ms 163084 KB Output is correct
24 Correct 891 ms 162852 KB Output is correct
25 Correct 550 ms 126820 KB Output is correct
26 Correct 582 ms 162624 KB Output is correct
27 Correct 645 ms 162748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 202740 KB Output is correct
2 Correct 128 ms 203072 KB Output is correct
3 Correct 135 ms 209708 KB Output is correct
4 Correct 139 ms 213164 KB Output is correct
5 Correct 117 ms 202308 KB Output is correct
6 Correct 112 ms 202180 KB Output is correct
7 Correct 140 ms 214840 KB Output is correct
8 Correct 138 ms 210396 KB Output is correct
9 Correct 132 ms 202988 KB Output is correct
10 Correct 139 ms 209860 KB Output is correct
11 Correct 138 ms 207036 KB Output is correct
12 Correct 136 ms 203104 KB Output is correct
13 Correct 133 ms 203204 KB Output is correct
14 Correct 144 ms 204420 KB Output is correct
15 Correct 135 ms 205124 KB Output is correct
16 Correct 141 ms 204232 KB Output is correct
17 Correct 130 ms 202564 KB Output is correct
18 Correct 134 ms 202820 KB Output is correct
19 Correct 112 ms 202180 KB Output is correct
20 Correct 117 ms 202252 KB Output is correct
21 Correct 572 ms 13264 KB Output is correct
22 Correct 458 ms 15292 KB Output is correct
23 Correct 572 ms 16364 KB Output is correct
24 Correct 593 ms 16456 KB Output is correct
25 Correct 465 ms 19396 KB Output is correct
26 Correct 464 ms 19336 KB Output is correct
27 Correct 20 ms 11068 KB Output is correct
28 Correct 20 ms 11308 KB Output is correct
29 Correct 933 ms 14084 KB Output is correct
30 Correct 933 ms 14092 KB Output is correct
31 Correct 923 ms 14176 KB Output is correct
32 Correct 932 ms 14060 KB Output is correct
33 Correct 182 ms 15928 KB Output is correct
34 Correct 268 ms 16544 KB Output is correct
35 Correct 64 ms 19200 KB Output is correct
36 Correct 78 ms 19148 KB Output is correct
37 Runtime error 587 ms 524292 KB Execution killed with signal 9
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 595 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 202740 KB Output is correct
2 Correct 128 ms 203072 KB Output is correct
3 Correct 135 ms 209708 KB Output is correct
4 Correct 139 ms 213164 KB Output is correct
5 Correct 117 ms 202308 KB Output is correct
6 Correct 112 ms 202180 KB Output is correct
7 Correct 140 ms 214840 KB Output is correct
8 Correct 138 ms 210396 KB Output is correct
9 Correct 132 ms 202988 KB Output is correct
10 Correct 139 ms 209860 KB Output is correct
11 Correct 138 ms 207036 KB Output is correct
12 Correct 136 ms 203104 KB Output is correct
13 Correct 133 ms 203204 KB Output is correct
14 Correct 144 ms 204420 KB Output is correct
15 Correct 135 ms 205124 KB Output is correct
16 Correct 141 ms 204232 KB Output is correct
17 Correct 130 ms 202564 KB Output is correct
18 Correct 134 ms 202820 KB Output is correct
19 Correct 112 ms 202180 KB Output is correct
20 Correct 117 ms 202252 KB Output is correct
21 Correct 131 ms 202948 KB Output is correct
22 Correct 133 ms 203100 KB Output is correct
23 Correct 142 ms 209664 KB Output is correct
24 Correct 141 ms 213340 KB Output is correct
25 Correct 111 ms 202188 KB Output is correct
26 Correct 113 ms 202292 KB Output is correct
27 Correct 149 ms 214392 KB Output is correct
28 Correct 144 ms 211180 KB Output is correct
29 Correct 142 ms 204852 KB Output is correct
30 Correct 143 ms 209404 KB Output is correct
31 Correct 152 ms 206956 KB Output is correct
32 Correct 137 ms 203028 KB Output is correct
33 Correct 141 ms 203032 KB Output is correct
34 Correct 148 ms 205368 KB Output is correct
35 Correct 143 ms 203752 KB Output is correct
36 Correct 145 ms 204228 KB Output is correct
37 Correct 117 ms 202212 KB Output is correct
38 Correct 114 ms 202296 KB Output is correct
39 Correct 572 ms 13264 KB Output is correct
40 Correct 458 ms 15292 KB Output is correct
41 Correct 572 ms 16364 KB Output is correct
42 Correct 593 ms 16456 KB Output is correct
43 Correct 465 ms 19396 KB Output is correct
44 Correct 464 ms 19336 KB Output is correct
45 Correct 20 ms 11068 KB Output is correct
46 Correct 20 ms 11308 KB Output is correct
47 Correct 933 ms 14084 KB Output is correct
48 Correct 933 ms 14092 KB Output is correct
49 Correct 923 ms 14176 KB Output is correct
50 Correct 932 ms 14060 KB Output is correct
51 Correct 182 ms 15928 KB Output is correct
52 Correct 268 ms 16544 KB Output is correct
53 Correct 64 ms 19200 KB Output is correct
54 Correct 78 ms 19148 KB Output is correct
55 Runtime error 587 ms 524292 KB Execution killed with signal 9
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 202740 KB Output is correct
2 Correct 128 ms 203072 KB Output is correct
3 Correct 135 ms 209708 KB Output is correct
4 Correct 139 ms 213164 KB Output is correct
5 Correct 117 ms 202308 KB Output is correct
6 Correct 112 ms 202180 KB Output is correct
7 Correct 140 ms 214840 KB Output is correct
8 Correct 138 ms 210396 KB Output is correct
9 Correct 132 ms 202988 KB Output is correct
10 Correct 139 ms 209860 KB Output is correct
11 Correct 138 ms 207036 KB Output is correct
12 Correct 136 ms 203104 KB Output is correct
13 Correct 133 ms 203204 KB Output is correct
14 Correct 144 ms 204420 KB Output is correct
15 Correct 135 ms 205124 KB Output is correct
16 Correct 141 ms 204232 KB Output is correct
17 Correct 130 ms 202564 KB Output is correct
18 Correct 134 ms 202820 KB Output is correct
19 Correct 112 ms 202180 KB Output is correct
20 Correct 117 ms 202252 KB Output is correct
21 Correct 131 ms 202948 KB Output is correct
22 Correct 133 ms 203100 KB Output is correct
23 Correct 142 ms 209664 KB Output is correct
24 Correct 141 ms 213340 KB Output is correct
25 Correct 111 ms 202188 KB Output is correct
26 Correct 113 ms 202292 KB Output is correct
27 Correct 149 ms 214392 KB Output is correct
28 Correct 144 ms 211180 KB Output is correct
29 Correct 142 ms 204852 KB Output is correct
30 Correct 143 ms 209404 KB Output is correct
31 Correct 152 ms 206956 KB Output is correct
32 Correct 137 ms 203028 KB Output is correct
33 Correct 141 ms 203032 KB Output is correct
34 Correct 148 ms 205368 KB Output is correct
35 Correct 143 ms 203752 KB Output is correct
36 Correct 145 ms 204228 KB Output is correct
37 Correct 117 ms 202212 KB Output is correct
38 Correct 114 ms 202296 KB Output is correct
39 Correct 572 ms 13264 KB Output is correct
40 Correct 458 ms 15292 KB Output is correct
41 Correct 572 ms 16364 KB Output is correct
42 Correct 593 ms 16456 KB Output is correct
43 Correct 465 ms 19396 KB Output is correct
44 Correct 464 ms 19336 KB Output is correct
45 Correct 20 ms 11068 KB Output is correct
46 Correct 20 ms 11308 KB Output is correct
47 Correct 933 ms 14084 KB Output is correct
48 Correct 933 ms 14092 KB Output is correct
49 Correct 923 ms 14176 KB Output is correct
50 Correct 932 ms 14060 KB Output is correct
51 Correct 182 ms 15928 KB Output is correct
52 Correct 268 ms 16544 KB Output is correct
53 Correct 64 ms 19200 KB Output is correct
54 Correct 78 ms 19148 KB Output is correct
55 Correct 788 ms 146496 KB Output is correct
56 Correct 662 ms 126468 KB Output is correct
57 Correct 787 ms 162884 KB Output is correct
58 Correct 575 ms 160244 KB Output is correct
59 Correct 577 ms 122312 KB Output is correct
60 Correct 776 ms 163192 KB Output is correct
61 Correct 75 ms 4544 KB Output is correct
62 Correct 82 ms 4520 KB Output is correct
63 Correct 663 ms 163384 KB Output is correct
64 Correct 664 ms 163096 KB Output is correct
65 Correct 818 ms 163100 KB Output is correct
66 Correct 764 ms 163076 KB Output is correct
67 Correct 757 ms 163008 KB Output is correct
68 Correct 808 ms 163140 KB Output is correct
69 Correct 899 ms 163008 KB Output is correct
70 Correct 889 ms 163032 KB Output is correct
71 Correct 876 ms 162864 KB Output is correct
72 Correct 822 ms 163140 KB Output is correct
73 Correct 898 ms 163008 KB Output is correct
74 Correct 831 ms 163092 KB Output is correct
75 Correct 888 ms 162988 KB Output is correct
76 Correct 894 ms 163064 KB Output is correct
77 Correct 829 ms 163084 KB Output is correct
78 Correct 891 ms 162852 KB Output is correct
79 Correct 550 ms 126820 KB Output is correct
80 Correct 582 ms 162624 KB Output is correct
81 Correct 645 ms 162748 KB Output is correct
82 Runtime error 587 ms 524292 KB Execution killed with signal 9
83 Halted 0 ms 0 KB -