Submission #414939

# Submission time Handle Problem Language Result Execution time Memory
414939 2021-05-31T10:49:38 Z Pro_ktmr Food Court (JOI21_foodcourt) C++17
68 / 100
1000 ms 46548 KB
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3,unroll-loops")
using ll = long long;
using ull = unsigned long long;
constexpr ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
#define repi(i, a, b) for(int (i)=(a); (i)<int(b); (i)++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
template<class T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
constexpr int dy[4]={-1,0,1,0};
constexpr int dx[4]={0,-1,0,1};

template<typename T, typename U>
struct LazySegmentTree{
private:
    int n, N;
    vector<T> node;
    vector<U> lazy;
    function<T(T, T)> F;
    T E;
    function<T(T, U)> G;
    function<U(U, U)> H;
    U I;
public:
    void init(int _n, function<T(T, T)> f, T e, function<T(T, U)> g, function<U(U, U)> h, U i){
        F = f; E = e;
        G = g; H = h; I = i;
        n = _n; N = 1;
        while(N < n) N = (N<<1);
        node.assign(2*N-1, E);
        lazy.assign(2*N-1, I);
    }
    void init(vector<T> v, function<T(T, T)> f, T e, function<T(T, U)> g, function<U(U, U)> h, U i){
        F = f; E = e;
        G = g; H = h; I = i;
        n = v.size(); N = 1;
        while(N < n) N = (N<<1);
        node.assign(2*N-1, E);
        lazy.assign(2*N-1, I);
        for(int i=0; i<n; i++) node[N-1+i] = v[i];
        for(int i=N-2; i>=0; i--) node[i] = F(node[(i<<1)+1], node[(i<<1)+2]);
    }
    int length(){
        return N;
    }
    T operator [](int a){
        return query(a, a+1);
    }
    void eval(int k){
        node[k] = G(node[k], lazy[k]);
        if(k < N-1){
            lazy[(k<<1)+1] = H(lazy[(k<<1)+1], lazy[k]);
            lazy[(k<<1)+2] = H(lazy[(k<<1)+2], lazy[k]);
        }
        lazy[k] = I;
    }
    void apply(int a, int b, U x, int k=0, int l=0, int r=-1){
        if(r == -1) r = N;
        eval(k);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b){
            lazy[k] = H(lazy[k], x);
            eval(k);
        }
        else{
            apply(a, b, H(I, x), (k<<1)+1, l, (l+r)>>1);
            apply(a, b, H(I, x), (k<<1)+2, (l+r)>>1, r);
            node[k] = F(node[(k<<1)+1], node[(k<<1)+2]);
        }
    }
    T query(int a, int b, int k=0, int l=0, int r=-1){
        if(r == -1) r = N;
        if(b <= l || r <= a) return E;
        eval(k);
        if(a <= l && r <= b) return node[k];
        return F(query(a, b, (k<<1)+1, l, (l+r)>>1), query(a, b, (k<<1)+2, (l+r)>>1, r));
    }
    int find_right(function<bool(T)> g, int a){
        if(!g(E)) return -1;
        T t = E;
        return min(find_right(g, a, 0, 0, N, t), n);
    }
    int find_right(function<bool(T)> g, int a, int k, int l, int r, T &t){
        eval(k);
        if(r-l == 1){
            t = F(t, node[k]);
            return g(t) ? r : a;
        }
        int m = (l + r) >> 1;
        if(m <= a) return find_right(g, a, (k<<1)+2, m, r, t);
        if(a <= l && g(F(t, node[k]))){
            t = F(t, node[k]);
            return r;
        }
        int L = find_right(g, a, (k<<1)+1, l, m, t);
        if(L < m) return L;
        int R = find_right(g, a, (k<<1)+2, m, r, t);
        return max(L, R);
    }
    int find_left(function<bool(T)> g, int b){
        if(!g(E)) return n + 1;
        T t = E;
        return find_left(g, b, 0, 0, N, t);
    }
    int find_left(function<bool(T)> g, int b, int k, int l, int r, T &t){
        eval(k);
        if(r-l == 1){
            t = F(node[k], t);
            return g(t) ? l : b;
        }
        int m = (l + r) >> 1;
        if(b <= m) return find_left(g, b, (k<<1)+1, l, m, t);
        if(r <= b && g(F(node[k], t))){
            t = F(node[k], t);
            return l;
        }
        int R = find_left(g, b, (k<<1)+2, m, r, t);
        if(m < R) return R;
        int L = find_left(g, b, (k<<1)+1, l, m, t);
        return min(L, R);
    }
};
 
template<typename T>
struct SegmentTree{
private:
    int n, N;
    vector<T> node;
    function<T(T, T)> F;
    T E;
public:
    void init(int _n, function<T(T, T)> f, T e){
        F = f;
        E = e;
        n = _n;
        N = 1;
        while(N < n) N = (N<<1);
        node.assign(2*N-1, e);
    }
    void init(vector<T> v, function<T(T, T)> f, T e){
        F = f;
        E = e;
        n = v.size();
        N = 1;
        while(N < n) N = (N<<1);
        node.assign(2*N-1, e);
        for(int i=0; i<n; i++) node[N-1+i] = v[i];
        for(int i=N-2; i>=0; i--) node[i] = F(node[(i<<1)+1], node[(i<<1)+2]);
    }
    T& operator [](int a){
        return node[N-1+a];
    }
    void update(int a, T x){
        a += N-1;
        node[a] = x;
        while(a > 0){
            a = (a-1)>>1;
            node[a] = F(node[(a<<1)+1], node[(a<<1)+2]);
        }
    }
    T query(int a, int b, int k=0, int l=0, int r=-1){
        if(r == -1) r = N;
        if(b <= l || r <= a) return E;
        if(a <= l && r <= b) return node[k];
        return F(query(a, b, (k<<1)+1, l, (l+r)>>1), query(a, b, (k<<1)+2, (l+r)>>1, r));
    }
    int find_right(function<bool(T)> g, int a){
        if(!g(E)) return -1;
        T t = E;
        return min(find_right(g, a, 0, 0, N, t), n);
    }
    int find_right(function<bool(T)> g, int a, int k, int l, int r, T &t){
        if(r-l == 1){
            t = F(t, node[k]);
            return g(t) ? r : a;
        }
        int m = (l + r) >> 1;
        if(m <= a) return find_right(g, a, (k<<1)+2, m, r, t);
        if(a <= l && g(F(t, node[k]))){
            t = F(t, node[k]);
            return r;
        }
        int L = find_right(g, a, (k<<1)+1, l, m, t);
        if(L < m) return L;
        int R = find_right(g, a, (k<<1)+2, m, r, t);
        return max(L, R);
    }
    int find_left(function<bool(T)> g, int b){
        if(!g(E)) return n + 1;
        T t = E;
        return find_left(g, b, 0, 0, N, t);
    }
    int find_left(function<bool(T)> g, int b, int k, int l, int r, T &t){
        if(r-l == 1){
            t = F(node[k], t);
            return g(t) ? l : b;
        }
        int m = (l + r) >> 1;
        if(b <= m) return find_left(g, b, (k<<1)+1, l, m, t);
        if(r <= b && g(F(node[k], t))){
            t = F(node[k], t);
            return l;
        }
        int R = find_left(g, b, (k<<1)+2, m, r, t);
        if(m < R) return R;
        int L = find_left(g, b, (k<<1)+1, l, m, t);
        return min(L, R);
    }
};
 
using pll = pair<ll,ll>;
 
int N, M, Q;
int T[250001], L[250001], R[250001], A[250001]; ll B[250001];
int ans[250001];
 
LazySegmentTree<ll,pll> len;
 
vector<pair<int,ll>> query[250001];
vector<int> calc[250001];
SegmentTree<ll> st;
 
signed main(){
    scanf("%d%d%d", &N, &M, &Q);
    rep(i, Q){
        scanf("%d", T+i);
        if(T[i] == 1){
            scanf("%d%d%d%lld", L+i, R+i, A+i, B+i);
            L[i]--;
        }
        if(T[i] == 2){
            scanf("%d%d%lld", L+i, R+i, B+i);
            L[i]--;
        }
        if(T[i] == 3){
            scanf("%d%lld", A+i, B+i);
            A[i]--;
        }
    }
 
    // delete T[i] = 2 by modifing T[i] = 3
    // calc the end of each line
    len.init(vector<ll>(N, 0), [](ll l, ll r){ return l + r; }, 0,
        [](ll m, pll f){ return max(m + f.first, f.second); }, [](pll o, pll n){ return make_pair(o.first + n.first, max(o.second + n.first, n.second)); }, {0,-1e18L});
    rep(i, Q){
        if(T[i] == 1){
            len.apply(L[i], R[i], {B[i],-1e18L});
        }
        if(T[i] == 2){
            len.apply(L[i], R[i], {-B[i],0});
        }
        if(T[i] == 3){
            B[i] = len[A[i]] - B[i];
        }
    }
 
    // see each line
    rep(i, Q){
        if(T[i] == 1){
            query[L[i]].pb({i, B[i]});
            query[R[i]].pb({i, 0});
        }
        if(T[i] == 3){
            calc[A[i]].pb(i);
        }
    }
    st.init(Q, [](ll a, ll b){ return a+b; }, 0);
    rep(i, N){
        for(auto [j, x]: query[i]) st.update(j, x);
        for(auto j: calc[i]){
            ans[j] = st.find_left([j](ll x){ return x <= B[j]; }, j) - 1;
        }
    }
 
    // output
    rep(i, Q){
        if(T[i] == 3){
            if(ans[i] == -1) printf("0\n");
            else printf("%d\n", A[ans[i]]);
        }
    }
}

Compilation message

foodcourt.cpp: In function 'int main()':
foodcourt.cpp:15:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
      |                            ^
foodcourt.cpp:14:43: note: in expansion of macro '_rep'
   14 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
foodcourt.cpp:17:18: note: in expansion of macro '_overload3'
   17 | #define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
      |                  ^~~~~~~~~~
foodcourt.cpp:235:5: note: in expansion of macro 'rep'
  235 |     rep(i, Q){
      |     ^~~
foodcourt.cpp:15:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
      |                            ^
foodcourt.cpp:14:43: note: in expansion of macro '_rep'
   14 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
foodcourt.cpp:17:18: note: in expansion of macro '_overload3'
   17 | #define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
      |                  ^~~~~~~~~~
foodcourt.cpp:255:5: note: in expansion of macro 'rep'
  255 |     rep(i, Q){
      |     ^~~
foodcourt.cpp:15:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
      |                            ^
foodcourt.cpp:14:43: note: in expansion of macro '_rep'
   14 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
foodcourt.cpp:17:18: note: in expansion of macro '_overload3'
   17 | #define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
      |                  ^~~~~~~~~~
foodcourt.cpp:268:5: note: in expansion of macro 'rep'
  268 |     rep(i, Q){
      |     ^~~
foodcourt.cpp:15:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
      |                            ^
foodcourt.cpp:14:43: note: in expansion of macro '_rep'
   14 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
foodcourt.cpp:17:18: note: in expansion of macro '_overload3'
   17 | #define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
      |                  ^~~~~~~~~~
foodcourt.cpp:278:5: note: in expansion of macro 'rep'
  278 |     rep(i, N){
      |     ^~~
foodcourt.cpp:15:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define _rep(i, n) for(int (i)=0; (i)<int(n); (i)++)
      |                            ^
foodcourt.cpp:14:43: note: in expansion of macro '_rep'
   14 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
foodcourt.cpp:17:18: note: in expansion of macro '_overload3'
   17 | #define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
      |                  ^~~~~~~~~~
foodcourt.cpp:286:5: note: in expansion of macro 'rep'
  286 |     rep(i, Q){
      |     ^~~
foodcourt.cpp:234:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  234 |     scanf("%d%d%d", &N, &M, &Q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:236:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  236 |         scanf("%d", T+i);
      |         ~~~~~^~~~~~~~~~~
foodcourt.cpp:238:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  238 |             scanf("%d%d%d%lld", L+i, R+i, A+i, B+i);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:242:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  242 |             scanf("%d%d%lld", L+i, R+i, B+i);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:246:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  246 |             scanf("%d%lld", A+i, B+i);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 12236 KB Output is correct
2 Correct 12 ms 12252 KB Output is correct
3 Correct 11 ms 12312 KB Output is correct
4 Correct 12 ms 12344 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12132 KB Output is correct
7 Correct 13 ms 12236 KB Output is correct
8 Correct 12 ms 12240 KB Output is correct
9 Correct 12 ms 12304 KB Output is correct
10 Correct 13 ms 12252 KB Output is correct
11 Correct 13 ms 12312 KB Output is correct
12 Correct 13 ms 12248 KB Output is correct
13 Correct 11 ms 12308 KB Output is correct
14 Correct 10 ms 12236 KB Output is correct
15 Correct 13 ms 12304 KB Output is correct
16 Correct 17 ms 12236 KB Output is correct
17 Correct 12 ms 12236 KB Output is correct
18 Correct 12 ms 12316 KB Output is correct
19 Correct 12 ms 12252 KB Output is correct
20 Correct 12 ms 12308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 12236 KB Output is correct
2 Correct 12 ms 12252 KB Output is correct
3 Correct 11 ms 12312 KB Output is correct
4 Correct 12 ms 12344 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12132 KB Output is correct
7 Correct 13 ms 12236 KB Output is correct
8 Correct 12 ms 12240 KB Output is correct
9 Correct 12 ms 12304 KB Output is correct
10 Correct 13 ms 12252 KB Output is correct
11 Correct 13 ms 12312 KB Output is correct
12 Correct 13 ms 12248 KB Output is correct
13 Correct 11 ms 12308 KB Output is correct
14 Correct 10 ms 12236 KB Output is correct
15 Correct 13 ms 12304 KB Output is correct
16 Correct 17 ms 12236 KB Output is correct
17 Correct 12 ms 12236 KB Output is correct
18 Correct 12 ms 12316 KB Output is correct
19 Correct 12 ms 12252 KB Output is correct
20 Correct 12 ms 12308 KB Output is correct
21 Correct 15 ms 12308 KB Output is correct
22 Correct 13 ms 12300 KB Output is correct
23 Correct 13 ms 12352 KB Output is correct
24 Correct 13 ms 12308 KB Output is correct
25 Correct 9 ms 12184 KB Output is correct
26 Correct 9 ms 12184 KB Output is correct
27 Correct 13 ms 12280 KB Output is correct
28 Correct 14 ms 12236 KB Output is correct
29 Correct 14 ms 12304 KB Output is correct
30 Correct 13 ms 12236 KB Output is correct
31 Correct 17 ms 12312 KB Output is correct
32 Correct 14 ms 12264 KB Output is correct
33 Correct 11 ms 12308 KB Output is correct
34 Correct 13 ms 12308 KB Output is correct
35 Correct 12 ms 12236 KB Output is correct
36 Correct 17 ms 12236 KB Output is correct
37 Correct 11 ms 12228 KB Output is correct
38 Correct 14 ms 12312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 20936 KB Output is correct
2 Correct 198 ms 21384 KB Output is correct
3 Correct 192 ms 20936 KB Output is correct
4 Correct 216 ms 20936 KB Output is correct
5 Correct 196 ms 21376 KB Output is correct
6 Correct 229 ms 21320 KB Output is correct
7 Correct 42 ms 16344 KB Output is correct
8 Correct 45 ms 16408 KB Output is correct
9 Correct 206 ms 21064 KB Output is correct
10 Correct 198 ms 20940 KB Output is correct
11 Correct 197 ms 20932 KB Output is correct
12 Correct 198 ms 20924 KB Output is correct
13 Correct 185 ms 20816 KB Output is correct
14 Correct 195 ms 21536 KB Output is correct
15 Correct 178 ms 22116 KB Output is correct
16 Correct 180 ms 22216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 46548 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 12236 KB Output is correct
2 Correct 12 ms 12252 KB Output is correct
3 Correct 11 ms 12312 KB Output is correct
4 Correct 12 ms 12344 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12132 KB Output is correct
7 Correct 13 ms 12236 KB Output is correct
8 Correct 12 ms 12240 KB Output is correct
9 Correct 12 ms 12304 KB Output is correct
10 Correct 13 ms 12252 KB Output is correct
11 Correct 13 ms 12312 KB Output is correct
12 Correct 13 ms 12248 KB Output is correct
13 Correct 11 ms 12308 KB Output is correct
14 Correct 10 ms 12236 KB Output is correct
15 Correct 13 ms 12304 KB Output is correct
16 Correct 17 ms 12236 KB Output is correct
17 Correct 12 ms 12236 KB Output is correct
18 Correct 12 ms 12316 KB Output is correct
19 Correct 12 ms 12252 KB Output is correct
20 Correct 12 ms 12308 KB Output is correct
21 Correct 197 ms 20936 KB Output is correct
22 Correct 198 ms 21384 KB Output is correct
23 Correct 192 ms 20936 KB Output is correct
24 Correct 216 ms 20936 KB Output is correct
25 Correct 196 ms 21376 KB Output is correct
26 Correct 229 ms 21320 KB Output is correct
27 Correct 42 ms 16344 KB Output is correct
28 Correct 45 ms 16408 KB Output is correct
29 Correct 206 ms 21064 KB Output is correct
30 Correct 198 ms 20940 KB Output is correct
31 Correct 197 ms 20932 KB Output is correct
32 Correct 198 ms 20924 KB Output is correct
33 Correct 185 ms 20816 KB Output is correct
34 Correct 195 ms 21536 KB Output is correct
35 Correct 178 ms 22116 KB Output is correct
36 Correct 180 ms 22216 KB Output is correct
37 Correct 218 ms 20376 KB Output is correct
38 Correct 206 ms 20236 KB Output is correct
39 Correct 40 ms 15928 KB Output is correct
40 Correct 49 ms 16492 KB Output is correct
41 Correct 245 ms 20880 KB Output is correct
42 Correct 261 ms 20840 KB Output is correct
43 Correct 243 ms 20816 KB Output is correct
44 Correct 244 ms 20812 KB Output is correct
45 Correct 264 ms 20832 KB Output is correct
46 Correct 261 ms 20816 KB Output is correct
47 Correct 147 ms 20572 KB Output is correct
48 Correct 241 ms 20712 KB Output is correct
49 Correct 214 ms 19408 KB Output is correct
50 Correct 225 ms 20120 KB Output is correct
51 Correct 274 ms 20884 KB Output is correct
52 Correct 275 ms 20808 KB Output is correct
53 Correct 143 ms 20864 KB Output is correct
54 Correct 178 ms 22268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 215 ms 21628 KB Output is correct
2 Correct 228 ms 22124 KB Output is correct
3 Correct 222 ms 22220 KB Output is correct
4 Correct 175 ms 20428 KB Output is correct
5 Correct 213 ms 21452 KB Output is correct
6 Correct 240 ms 22272 KB Output is correct
7 Correct 68 ms 17172 KB Output is correct
8 Correct 63 ms 16948 KB Output is correct
9 Correct 158 ms 21664 KB Output is correct
10 Correct 176 ms 20324 KB Output is correct
11 Correct 231 ms 21900 KB Output is correct
12 Correct 227 ms 21892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 12236 KB Output is correct
2 Correct 12 ms 12252 KB Output is correct
3 Correct 11 ms 12312 KB Output is correct
4 Correct 12 ms 12344 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12132 KB Output is correct
7 Correct 13 ms 12236 KB Output is correct
8 Correct 12 ms 12240 KB Output is correct
9 Correct 12 ms 12304 KB Output is correct
10 Correct 13 ms 12252 KB Output is correct
11 Correct 13 ms 12312 KB Output is correct
12 Correct 13 ms 12248 KB Output is correct
13 Correct 11 ms 12308 KB Output is correct
14 Correct 10 ms 12236 KB Output is correct
15 Correct 13 ms 12304 KB Output is correct
16 Correct 17 ms 12236 KB Output is correct
17 Correct 12 ms 12236 KB Output is correct
18 Correct 12 ms 12316 KB Output is correct
19 Correct 12 ms 12252 KB Output is correct
20 Correct 12 ms 12308 KB Output is correct
21 Correct 15 ms 12308 KB Output is correct
22 Correct 13 ms 12300 KB Output is correct
23 Correct 13 ms 12352 KB Output is correct
24 Correct 13 ms 12308 KB Output is correct
25 Correct 9 ms 12184 KB Output is correct
26 Correct 9 ms 12184 KB Output is correct
27 Correct 13 ms 12280 KB Output is correct
28 Correct 14 ms 12236 KB Output is correct
29 Correct 14 ms 12304 KB Output is correct
30 Correct 13 ms 12236 KB Output is correct
31 Correct 17 ms 12312 KB Output is correct
32 Correct 14 ms 12264 KB Output is correct
33 Correct 11 ms 12308 KB Output is correct
34 Correct 13 ms 12308 KB Output is correct
35 Correct 12 ms 12236 KB Output is correct
36 Correct 17 ms 12236 KB Output is correct
37 Correct 11 ms 12228 KB Output is correct
38 Correct 14 ms 12312 KB Output is correct
39 Correct 197 ms 20936 KB Output is correct
40 Correct 198 ms 21384 KB Output is correct
41 Correct 192 ms 20936 KB Output is correct
42 Correct 216 ms 20936 KB Output is correct
43 Correct 196 ms 21376 KB Output is correct
44 Correct 229 ms 21320 KB Output is correct
45 Correct 42 ms 16344 KB Output is correct
46 Correct 45 ms 16408 KB Output is correct
47 Correct 206 ms 21064 KB Output is correct
48 Correct 198 ms 20940 KB Output is correct
49 Correct 197 ms 20932 KB Output is correct
50 Correct 198 ms 20924 KB Output is correct
51 Correct 185 ms 20816 KB Output is correct
52 Correct 195 ms 21536 KB Output is correct
53 Correct 178 ms 22116 KB Output is correct
54 Correct 180 ms 22216 KB Output is correct
55 Correct 218 ms 20376 KB Output is correct
56 Correct 206 ms 20236 KB Output is correct
57 Correct 40 ms 15928 KB Output is correct
58 Correct 49 ms 16492 KB Output is correct
59 Correct 245 ms 20880 KB Output is correct
60 Correct 261 ms 20840 KB Output is correct
61 Correct 243 ms 20816 KB Output is correct
62 Correct 244 ms 20812 KB Output is correct
63 Correct 264 ms 20832 KB Output is correct
64 Correct 261 ms 20816 KB Output is correct
65 Correct 147 ms 20572 KB Output is correct
66 Correct 241 ms 20712 KB Output is correct
67 Correct 214 ms 19408 KB Output is correct
68 Correct 225 ms 20120 KB Output is correct
69 Correct 274 ms 20884 KB Output is correct
70 Correct 275 ms 20808 KB Output is correct
71 Correct 143 ms 20864 KB Output is correct
72 Correct 178 ms 22268 KB Output is correct
73 Correct 215 ms 21628 KB Output is correct
74 Correct 228 ms 22124 KB Output is correct
75 Correct 222 ms 22220 KB Output is correct
76 Correct 175 ms 20428 KB Output is correct
77 Correct 213 ms 21452 KB Output is correct
78 Correct 240 ms 22272 KB Output is correct
79 Correct 68 ms 17172 KB Output is correct
80 Correct 63 ms 16948 KB Output is correct
81 Correct 158 ms 21664 KB Output is correct
82 Correct 176 ms 20324 KB Output is correct
83 Correct 231 ms 21900 KB Output is correct
84 Correct 227 ms 21892 KB Output is correct
85 Correct 217 ms 20888 KB Output is correct
86 Correct 258 ms 21304 KB Output is correct
87 Correct 260 ms 21136 KB Output is correct
88 Correct 264 ms 21804 KB Output is correct
89 Correct 181 ms 19632 KB Output is correct
90 Correct 321 ms 21320 KB Output is correct
91 Correct 232 ms 20456 KB Output is correct
92 Correct 207 ms 20164 KB Output is correct
93 Correct 262 ms 21376 KB Output is correct
94 Correct 267 ms 21336 KB Output is correct
95 Correct 244 ms 21196 KB Output is correct
96 Correct 271 ms 21340 KB Output is correct
97 Correct 266 ms 21324 KB Output is correct
98 Correct 214 ms 20568 KB Output is correct
99 Correct 156 ms 21156 KB Output is correct
100 Correct 205 ms 20312 KB Output is correct
101 Correct 248 ms 21196 KB Output is correct
102 Correct 207 ms 22168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 12236 KB Output is correct
2 Correct 12 ms 12252 KB Output is correct
3 Correct 11 ms 12312 KB Output is correct
4 Correct 12 ms 12344 KB Output is correct
5 Correct 9 ms 12108 KB Output is correct
6 Correct 9 ms 12132 KB Output is correct
7 Correct 13 ms 12236 KB Output is correct
8 Correct 12 ms 12240 KB Output is correct
9 Correct 12 ms 12304 KB Output is correct
10 Correct 13 ms 12252 KB Output is correct
11 Correct 13 ms 12312 KB Output is correct
12 Correct 13 ms 12248 KB Output is correct
13 Correct 11 ms 12308 KB Output is correct
14 Correct 10 ms 12236 KB Output is correct
15 Correct 13 ms 12304 KB Output is correct
16 Correct 17 ms 12236 KB Output is correct
17 Correct 12 ms 12236 KB Output is correct
18 Correct 12 ms 12316 KB Output is correct
19 Correct 12 ms 12252 KB Output is correct
20 Correct 12 ms 12308 KB Output is correct
21 Correct 15 ms 12308 KB Output is correct
22 Correct 13 ms 12300 KB Output is correct
23 Correct 13 ms 12352 KB Output is correct
24 Correct 13 ms 12308 KB Output is correct
25 Correct 9 ms 12184 KB Output is correct
26 Correct 9 ms 12184 KB Output is correct
27 Correct 13 ms 12280 KB Output is correct
28 Correct 14 ms 12236 KB Output is correct
29 Correct 14 ms 12304 KB Output is correct
30 Correct 13 ms 12236 KB Output is correct
31 Correct 17 ms 12312 KB Output is correct
32 Correct 14 ms 12264 KB Output is correct
33 Correct 11 ms 12308 KB Output is correct
34 Correct 13 ms 12308 KB Output is correct
35 Correct 12 ms 12236 KB Output is correct
36 Correct 17 ms 12236 KB Output is correct
37 Correct 11 ms 12228 KB Output is correct
38 Correct 14 ms 12312 KB Output is correct
39 Correct 197 ms 20936 KB Output is correct
40 Correct 198 ms 21384 KB Output is correct
41 Correct 192 ms 20936 KB Output is correct
42 Correct 216 ms 20936 KB Output is correct
43 Correct 196 ms 21376 KB Output is correct
44 Correct 229 ms 21320 KB Output is correct
45 Correct 42 ms 16344 KB Output is correct
46 Correct 45 ms 16408 KB Output is correct
47 Correct 206 ms 21064 KB Output is correct
48 Correct 198 ms 20940 KB Output is correct
49 Correct 197 ms 20932 KB Output is correct
50 Correct 198 ms 20924 KB Output is correct
51 Correct 185 ms 20816 KB Output is correct
52 Correct 195 ms 21536 KB Output is correct
53 Correct 178 ms 22116 KB Output is correct
54 Correct 180 ms 22216 KB Output is correct
55 Execution timed out 1048 ms 46548 KB Time limit exceeded
56 Halted 0 ms 0 KB -