답안 #160143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160143 2019-10-26T07:11:14 Z georgerapeanu Two Dishes (JOI19_dishes) C++11
74 / 100
6942 ms 199276 KB
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int NMAX = 1e6;

long long n,m;
long long a[NMAX + 5];
long long b[NMAX + 5];
long long p[NMAX + 5];
long long q[NMAX + 5];
long long s[NMAX + 5];
long long t[NMAX + 5];

long long pref_lin[NMAX + 5];
long long pref_col[NMAX + 5];

long long pref_sum_a[NMAX + 5];
long long pref_sum_b[NMAX + 5];

vector<long long> event[NMAX + 5];

struct node_t{
    long long base_offset;
    long long sum;
    long long val;
    long long lazy;

    node_t operator + (const node_t &other)const{
        node_t ans;
        ans.base_offset = 0;
        ans.sum = (this->sum) + other.sum;
        ans.val = 0;
        ans.lazy = 0;
        return ans;
    }
}aint[4 * NMAX + 5];

void propag(long long nod,long long st,long long dr){
    if(st == dr || aint[nod].lazy == 0){
        return ;
    }
    
    aint[2 * nod].lazy |= aint[nod].lazy;
    aint[2 * nod + 1].lazy |= aint[nod].lazy;
    
    aint[2 * nod].val = aint[2 * nod].sum = 0;
    aint[2 * nod + 1].val = aint[2 * nod + 1].sum = 0;

    aint[nod].lazy = 0;
}

void build(long long nod,long long st,long long dr){
    aint[nod].base_offset = 0;
    aint[nod].sum = 0;
    aint[nod].val = 0;
    aint[nod].lazy = 0;

    if(st == dr){
        return ;
    }

    long long mid = (st + dr) / 2;

    build(nod * 2,st,mid);
    build(nod * 2 + 1,mid + 1,dr);
}

void update_val(long long nod,long long st,long long dr,long long pos,long long delta){///+= delta
    propag(nod,st,dr);

    if(dr < pos || st > pos){
        return ;
    }

    if(st == dr){
        aint[nod].val += delta;
        if(st != 0)aint[nod].val = max(0LL,aint[nod].val);
        aint[nod].sum = aint[nod].val;
        return ;
    }

    long long mid = (st + dr) / 2;

    update_val(nod * 2,st,mid,pos,delta);
    update_val(nod * 2 + 1,mid + 1,dr,pos,delta);
        
    aint[nod] = aint[nod * 2] + aint[nod * 2 + 1];
}

void update_offset(long long nod,long long st,long long dr,long long pos,long long delta,bool initial = false){/// += delta_offset
    propag(nod,st,dr);
    if(dr < pos || st > pos){
        return ;
    }

    if(st == dr){
        aint[nod].base_offset += delta;
        if(initial == false){
            aint[nod].val -= delta;
            aint[nod].val = max(aint[nod].val,0LL);
        }
        aint[nod].sum = aint[nod].val;
        return ;
    }

    long long mid = (st + dr) / 2;

    update_offset(nod * 2,st,mid,pos,delta,initial);
    update_offset(nod * 2 + 1,mid + 1,dr,pos,delta,initial);
    
    aint[nod] = aint[nod * 2] + aint[nod * 2 + 1];
}

void update_0(long long nod,long long st,long long dr,long long l,long long r){
    propag(nod,st,dr);
    if(r < st || l > dr){
        return ;
    }
    if(l <= st && dr <= r){
        aint[nod].lazy = 1;
        aint[nod].sum = 0;
        aint[nod].val = 0;
        return ;
    }

    long long mid = (st + dr) / 2;

    update_0(nod * 2,st,mid,l,r);
    update_0(nod * 2 + 1,mid + 1,dr,l,r);

    aint[nod] = aint[nod * 2] + aint[nod * 2 + 1];
}
long long query_sum(long long nod,long long st,long long dr,long long l,long long r){
    propag(nod,st,dr);
    if(r < st || l > dr){
        return 0;
    }
    
    if(l <= st && dr <= r){
        return aint[nod].sum;
    }
    
    long long mid = (st + dr) / 2;

    return query_sum(nod * 2,st,mid,l,r) + query_sum(nod * 2 + 1,mid + 1,dr,l,r);
}

long long get_val(long long nod,long long st,long long dr,long long pos){
    propag(nod,st,dr);
    if(dr < pos || st > pos){
        return -1;
    }
    
    if(st == dr){
        return aint[nod].val;
    }

    long long mid = (st + dr) / 2;

    return max(get_val(nod * 2,st,mid,pos),get_val(nod * 2 + 1,mid + 1,dr,pos));
}

pair<long long,long long> find_pos(long long nod,long long st,long long dr,long long sum,long long pos){
    propag(nod,st,dr);

    if(st == dr){
        return {aint[nod].sum,st};
    }

    long long mid = (st + dr) / 2;

    if(st <= pos && dr <= pos){
        if(pos <= mid){
            pair<long long,long long> tmp = find_pos(nod * 2,st,mid,sum,pos);
            if(tmp.first < sum){
                if(aint[nod * 2 + 1].sum + tmp.first >= sum){
                    pair<long long,long long> tmp_fiu = find_pos(nod * 2 + 1,mid + 1,dr,sum - tmp.first,pos);
                    tmp.first += tmp_fiu.first;
                    tmp.second = tmp_fiu.second;
                    return tmp;
                }
                else{
                    tmp.first += aint[nod * 2 + 1].sum;
                    tmp.second = dr;
                    return tmp;
                }
            }
        }
        else{
            return find_pos(nod * 2 + 1,mid + 1,dr,sum,pos);
        }
    }
    else{
        if(aint[nod * 2].sum >= sum){
            return find_pos(nod * 2,st,mid,sum,pos);
        }
        else{
            pair<long long,long long> tmp = find_pos(nod * 2 + 1,mid + 1,dr,sum - aint[nod * 2].sum,pos);
            tmp.first += aint[nod * 2].sum;
            return tmp;
        }
    }

}

long long get_pos_sum(long long pos,long long elem){

    long long base_sum = query_sum(1,0,n,0,pos - 1) - elem;

    if(aint[1].sum < base_sum){
        return n + 1;
    }
        
    long long tmp = find_pos(1,0,n,base_sum,pos).second;
    return tmp;
}

long long get_time(long long i,long long j){
    return pref_sum_a[i] + pref_sum_b[j];
}

long long get_ans(long long nod,long long st,long long dr){
    propag(nod,st,dr);
    if(st == dr){
        return (aint[nod].val + aint[nod].base_offset);
    }

    long long mid = (st + dr) / 2;

    return get_ans(nod * 2,st,mid) + get_ans(nod * 2 + 1,mid + 1,dr);
}

const int LEN = 1 << 12;
char buff[LEN];
int ind = LEN - 1;

long long i64(){
    long long ans = 0;
    long long sgn = 1;

    while(buff[ind] != '-' && ('0' > buff[ind] || '9' < buff[ind])){
        if(++ind >= LEN){
            ind = 0;
            fread(buff,1,LEN,stdin);
        }
    }

    if(buff[ind] == '-'){
        sgn = -1;
        if(++ind >= LEN){
            ind = 0;
            fread(buff,1,LEN,stdin);
        }
    }
    
    while('0' <= buff[ind] && '9' >= buff[ind]){
        ans = ans * 10 + (buff[ind] - '0');
        if(++ind >= LEN){
            ind = 0;
            fread(buff,1,LEN,stdin);
        }
    }

    return ans * sgn;
}

int main(){

    n = i64();m = i64();

    for(long long i = 1;i <= n;i++){
        a[i] = i64();s[i] = i64();p[i] = i64();
        pref_sum_a[i] = a[i] + pref_sum_a[i - 1];
    }
    
    for(long long i = 1;i <= m;i++){
        b[i] = i64();t[i] = i64();q[i] = i64();
        pref_sum_b[i] = b[i] + pref_sum_b[i - 1];
    }

    for(long long j = 0;j <= m;j++){
        long long l = -1,r = n + 1;
        while(r - l > 1){
            long long mid = (l + r) / 2;
            if(get_time(mid,j) <= t[j]){
                l = mid;
            }
            else{
                r = mid;
            }
        }

        pref_col[j] =  l;
    }


    for(long long i = 0;i <= n;i++){
        long long l = -1,r = m + 1;

        while(r - l > 1){
            long long mid = (l + r) / 2;
            if(get_time(i,mid) <= s[i]){
                l = mid;
            }
            else{
                r = mid;
            }
        }

        pref_lin[i] = l;
    }

    build(1,0,n);

    for(long long i = 1;i <= n;i++){
        if(pref_lin[i] > -1){
            update_offset(1,0,n,i,p[i],true);
            event[pref_lin[i] + 1].push_back(i);
        }
    }
   
    for(long long j = 1;j <= m;j++){
        for(auto it:event[j]){
            update_offset(1,0,n,it,-p[it]);
            if(-p[it] > 0){
                long long k = get_pos_sum(it + 1,p[it]);
                if(k <= n){
                    update_val(1,0,n,k,(query_sum(1,0,n,it + 1,k) + p[it]) - get_val(1,0,n,k));
                }
                if(it + 1 <= k - 1){
                    update_0(1,0,n,it + 1,k - 1);
                }
            }
        }
        if(pref_col[j] > -1){
            update_val(1,0,n,0,q[j]);
            long long k = get_pos_sum(pref_col[j] + 1,-q[j]);
            if(k <= n){
                update_val(1,0,n,k,(query_sum(1,0,n,pref_col[j] + 1,k) - q[j]) - get_val(1,0,n,k));
            }
            if(pref_col[j] + 1 <= k - 1){
                update_0(1,0,n,pref_col[j] + 1,k - 1);
            }
        }
    }

    printf("%lld\n",get_ans(1,0,n));

    return 0;
}

Compilation message

dishes.cpp: In function 'std::pair<long long int, long long int> find_pos(long long int, long long int, long long int, long long int, long long int)':
dishes.cpp:207:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
dishes.cpp: In function 'long long int i64()':
dishes.cpp:247:18: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
             fread(buff,1,LEN,stdin);
             ~~~~~^~~~~~~~~~~~~~~~~~
dishes.cpp:255:18: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
             fread(buff,1,LEN,stdin);
             ~~~~~^~~~~~~~~~~~~~~~~~
dishes.cpp:263:18: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
             fread(buff,1,LEN,stdin);
             ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 420 ms 59948 KB Output is correct
2 Correct 529 ms 59744 KB Output is correct
3 Correct 252 ms 58116 KB Output is correct
4 Correct 331 ms 59384 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 506 ms 58876 KB Output is correct
7 Correct 54 ms 31736 KB Output is correct
8 Correct 136 ms 50348 KB Output is correct
9 Correct 252 ms 58204 KB Output is correct
10 Correct 620 ms 62252 KB Output is correct
11 Correct 241 ms 58188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23800 KB Output is correct
2 Correct 23 ms 23924 KB Output is correct
3 Correct 23 ms 23880 KB Output is correct
4 Correct 22 ms 23800 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 24 ms 23928 KB Output is correct
7 Correct 23 ms 23800 KB Output is correct
8 Correct 23 ms 23800 KB Output is correct
9 Correct 24 ms 23928 KB Output is correct
10 Correct 23 ms 23800 KB Output is correct
11 Correct 24 ms 23876 KB Output is correct
12 Correct 23 ms 23800 KB Output is correct
13 Correct 22 ms 23800 KB Output is correct
14 Correct 23 ms 23888 KB Output is correct
15 Correct 23 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23800 KB Output is correct
2 Correct 23 ms 23924 KB Output is correct
3 Correct 23 ms 23880 KB Output is correct
4 Correct 22 ms 23800 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 24 ms 23928 KB Output is correct
7 Correct 23 ms 23800 KB Output is correct
8 Correct 23 ms 23800 KB Output is correct
9 Correct 24 ms 23928 KB Output is correct
10 Correct 23 ms 23800 KB Output is correct
11 Correct 24 ms 23876 KB Output is correct
12 Correct 23 ms 23800 KB Output is correct
13 Correct 22 ms 23800 KB Output is correct
14 Correct 23 ms 23888 KB Output is correct
15 Correct 23 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 24184 KB Output is correct
18 Correct 24 ms 24184 KB Output is correct
19 Correct 29 ms 24184 KB Output is correct
20 Correct 26 ms 24188 KB Output is correct
21 Correct 26 ms 24184 KB Output is correct
22 Correct 28 ms 24184 KB Output is correct
23 Correct 29 ms 24184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23800 KB Output is correct
2 Correct 23 ms 23924 KB Output is correct
3 Correct 23 ms 23880 KB Output is correct
4 Correct 22 ms 23800 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 24 ms 23928 KB Output is correct
7 Correct 23 ms 23800 KB Output is correct
8 Correct 23 ms 23800 KB Output is correct
9 Correct 24 ms 23928 KB Output is correct
10 Correct 23 ms 23800 KB Output is correct
11 Correct 24 ms 23876 KB Output is correct
12 Correct 23 ms 23800 KB Output is correct
13 Correct 22 ms 23800 KB Output is correct
14 Correct 23 ms 23888 KB Output is correct
15 Correct 23 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 24184 KB Output is correct
18 Correct 24 ms 24184 KB Output is correct
19 Correct 29 ms 24184 KB Output is correct
20 Correct 26 ms 24188 KB Output is correct
21 Correct 26 ms 24184 KB Output is correct
22 Correct 28 ms 24184 KB Output is correct
23 Correct 29 ms 24184 KB Output is correct
24 Correct 284 ms 58088 KB Output is correct
25 Correct 344 ms 57164 KB Output is correct
26 Correct 296 ms 62200 KB Output is correct
27 Correct 329 ms 57116 KB Output is correct
28 Correct 458 ms 58392 KB Output is correct
29 Correct 246 ms 58176 KB Output is correct
30 Correct 1022 ms 60152 KB Output is correct
31 Correct 55 ms 31736 KB Output is correct
32 Correct 164 ms 49976 KB Output is correct
33 Correct 580 ms 58260 KB Output is correct
34 Correct 710 ms 58820 KB Output is correct
35 Correct 1088 ms 60192 KB Output is correct
36 Correct 1000 ms 60096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23800 KB Output is correct
2 Correct 23 ms 23924 KB Output is correct
3 Correct 23 ms 23880 KB Output is correct
4 Correct 22 ms 23800 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 24 ms 23928 KB Output is correct
7 Correct 23 ms 23800 KB Output is correct
8 Correct 23 ms 23800 KB Output is correct
9 Correct 24 ms 23928 KB Output is correct
10 Correct 23 ms 23800 KB Output is correct
11 Correct 24 ms 23876 KB Output is correct
12 Correct 23 ms 23800 KB Output is correct
13 Correct 22 ms 23800 KB Output is correct
14 Correct 23 ms 23888 KB Output is correct
15 Correct 23 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 24184 KB Output is correct
18 Correct 24 ms 24184 KB Output is correct
19 Correct 29 ms 24184 KB Output is correct
20 Correct 26 ms 24188 KB Output is correct
21 Correct 26 ms 24184 KB Output is correct
22 Correct 28 ms 24184 KB Output is correct
23 Correct 29 ms 24184 KB Output is correct
24 Correct 284 ms 58088 KB Output is correct
25 Correct 344 ms 57164 KB Output is correct
26 Correct 296 ms 62200 KB Output is correct
27 Correct 329 ms 57116 KB Output is correct
28 Correct 458 ms 58392 KB Output is correct
29 Correct 246 ms 58176 KB Output is correct
30 Correct 1022 ms 60152 KB Output is correct
31 Correct 55 ms 31736 KB Output is correct
32 Correct 164 ms 49976 KB Output is correct
33 Correct 580 ms 58260 KB Output is correct
34 Correct 710 ms 58820 KB Output is correct
35 Correct 1088 ms 60192 KB Output is correct
36 Correct 1000 ms 60096 KB Output is correct
37 Correct 301 ms 62364 KB Output is correct
38 Correct 334 ms 57072 KB Output is correct
39 Correct 696 ms 62276 KB Output is correct
40 Correct 562 ms 62360 KB Output is correct
41 Correct 24 ms 23800 KB Output is correct
42 Correct 1053 ms 60228 KB Output is correct
43 Correct 609 ms 58108 KB Output is correct
44 Correct 700 ms 58740 KB Output is correct
45 Correct 1022 ms 60244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23800 KB Output is correct
2 Correct 23 ms 23924 KB Output is correct
3 Correct 23 ms 23880 KB Output is correct
4 Correct 22 ms 23800 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 24 ms 23928 KB Output is correct
7 Correct 23 ms 23800 KB Output is correct
8 Correct 23 ms 23800 KB Output is correct
9 Correct 24 ms 23928 KB Output is correct
10 Correct 23 ms 23800 KB Output is correct
11 Correct 24 ms 23876 KB Output is correct
12 Correct 23 ms 23800 KB Output is correct
13 Correct 22 ms 23800 KB Output is correct
14 Correct 23 ms 23888 KB Output is correct
15 Correct 23 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 24184 KB Output is correct
18 Correct 24 ms 24184 KB Output is correct
19 Correct 29 ms 24184 KB Output is correct
20 Correct 26 ms 24188 KB Output is correct
21 Correct 26 ms 24184 KB Output is correct
22 Correct 28 ms 24184 KB Output is correct
23 Correct 29 ms 24184 KB Output is correct
24 Correct 284 ms 58088 KB Output is correct
25 Correct 344 ms 57164 KB Output is correct
26 Correct 296 ms 62200 KB Output is correct
27 Correct 329 ms 57116 KB Output is correct
28 Correct 458 ms 58392 KB Output is correct
29 Correct 246 ms 58176 KB Output is correct
30 Correct 1022 ms 60152 KB Output is correct
31 Correct 55 ms 31736 KB Output is correct
32 Correct 164 ms 49976 KB Output is correct
33 Correct 580 ms 58260 KB Output is correct
34 Correct 710 ms 58820 KB Output is correct
35 Correct 1088 ms 60192 KB Output is correct
36 Correct 1000 ms 60096 KB Output is correct
37 Correct 301 ms 62364 KB Output is correct
38 Correct 334 ms 57072 KB Output is correct
39 Correct 696 ms 62276 KB Output is correct
40 Correct 562 ms 62360 KB Output is correct
41 Correct 24 ms 23800 KB Output is correct
42 Correct 1053 ms 60228 KB Output is correct
43 Correct 609 ms 58108 KB Output is correct
44 Correct 700 ms 58740 KB Output is correct
45 Correct 1022 ms 60244 KB Output is correct
46 Correct 1587 ms 199276 KB Output is correct
47 Correct 1780 ms 172000 KB Output is correct
48 Correct 3890 ms 199200 KB Output is correct
49 Correct 3104 ms 199160 KB Output is correct
50 Correct 6942 ms 188772 KB Output is correct
51 Correct 3565 ms 177132 KB Output is correct
52 Correct 4094 ms 177880 KB Output is correct
53 Correct 6452 ms 188432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 420 ms 59948 KB Output is correct
2 Correct 529 ms 59744 KB Output is correct
3 Correct 252 ms 58116 KB Output is correct
4 Correct 331 ms 59384 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 506 ms 58876 KB Output is correct
7 Correct 54 ms 31736 KB Output is correct
8 Correct 136 ms 50348 KB Output is correct
9 Correct 252 ms 58204 KB Output is correct
10 Correct 620 ms 62252 KB Output is correct
11 Correct 241 ms 58188 KB Output is correct
12 Correct 25 ms 23800 KB Output is correct
13 Correct 23 ms 23924 KB Output is correct
14 Correct 23 ms 23880 KB Output is correct
15 Correct 22 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 23928 KB Output is correct
18 Correct 23 ms 23800 KB Output is correct
19 Correct 23 ms 23800 KB Output is correct
20 Correct 24 ms 23928 KB Output is correct
21 Correct 23 ms 23800 KB Output is correct
22 Correct 24 ms 23876 KB Output is correct
23 Correct 23 ms 23800 KB Output is correct
24 Correct 22 ms 23800 KB Output is correct
25 Correct 23 ms 23888 KB Output is correct
26 Correct 23 ms 23800 KB Output is correct
27 Correct 23 ms 23800 KB Output is correct
28 Correct 24 ms 24184 KB Output is correct
29 Correct 24 ms 24184 KB Output is correct
30 Correct 29 ms 24184 KB Output is correct
31 Correct 26 ms 24188 KB Output is correct
32 Correct 26 ms 24184 KB Output is correct
33 Correct 28 ms 24184 KB Output is correct
34 Correct 29 ms 24184 KB Output is correct
35 Correct 284 ms 58088 KB Output is correct
36 Correct 344 ms 57164 KB Output is correct
37 Correct 296 ms 62200 KB Output is correct
38 Correct 329 ms 57116 KB Output is correct
39 Correct 458 ms 58392 KB Output is correct
40 Correct 246 ms 58176 KB Output is correct
41 Correct 1022 ms 60152 KB Output is correct
42 Correct 55 ms 31736 KB Output is correct
43 Correct 164 ms 49976 KB Output is correct
44 Correct 580 ms 58260 KB Output is correct
45 Correct 710 ms 58820 KB Output is correct
46 Correct 1088 ms 60192 KB Output is correct
47 Correct 1000 ms 60096 KB Output is correct
48 Correct 301 ms 62364 KB Output is correct
49 Correct 334 ms 57072 KB Output is correct
50 Correct 696 ms 62276 KB Output is correct
51 Correct 562 ms 62360 KB Output is correct
52 Correct 24 ms 23800 KB Output is correct
53 Correct 1053 ms 60228 KB Output is correct
54 Correct 609 ms 58108 KB Output is correct
55 Correct 700 ms 58740 KB Output is correct
56 Correct 1022 ms 60244 KB Output is correct
57 Correct 578 ms 62188 KB Output is correct
58 Incorrect 409 ms 57072 KB Output isn't correct
59 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 420 ms 59948 KB Output is correct
2 Correct 529 ms 59744 KB Output is correct
3 Correct 252 ms 58116 KB Output is correct
4 Correct 331 ms 59384 KB Output is correct
5 Correct 23 ms 23800 KB Output is correct
6 Correct 506 ms 58876 KB Output is correct
7 Correct 54 ms 31736 KB Output is correct
8 Correct 136 ms 50348 KB Output is correct
9 Correct 252 ms 58204 KB Output is correct
10 Correct 620 ms 62252 KB Output is correct
11 Correct 241 ms 58188 KB Output is correct
12 Correct 25 ms 23800 KB Output is correct
13 Correct 23 ms 23924 KB Output is correct
14 Correct 23 ms 23880 KB Output is correct
15 Correct 22 ms 23800 KB Output is correct
16 Correct 23 ms 23800 KB Output is correct
17 Correct 24 ms 23928 KB Output is correct
18 Correct 23 ms 23800 KB Output is correct
19 Correct 23 ms 23800 KB Output is correct
20 Correct 24 ms 23928 KB Output is correct
21 Correct 23 ms 23800 KB Output is correct
22 Correct 24 ms 23876 KB Output is correct
23 Correct 23 ms 23800 KB Output is correct
24 Correct 22 ms 23800 KB Output is correct
25 Correct 23 ms 23888 KB Output is correct
26 Correct 23 ms 23800 KB Output is correct
27 Correct 23 ms 23800 KB Output is correct
28 Correct 24 ms 24184 KB Output is correct
29 Correct 24 ms 24184 KB Output is correct
30 Correct 29 ms 24184 KB Output is correct
31 Correct 26 ms 24188 KB Output is correct
32 Correct 26 ms 24184 KB Output is correct
33 Correct 28 ms 24184 KB Output is correct
34 Correct 29 ms 24184 KB Output is correct
35 Correct 284 ms 58088 KB Output is correct
36 Correct 344 ms 57164 KB Output is correct
37 Correct 296 ms 62200 KB Output is correct
38 Correct 329 ms 57116 KB Output is correct
39 Correct 458 ms 58392 KB Output is correct
40 Correct 246 ms 58176 KB Output is correct
41 Correct 1022 ms 60152 KB Output is correct
42 Correct 55 ms 31736 KB Output is correct
43 Correct 164 ms 49976 KB Output is correct
44 Correct 580 ms 58260 KB Output is correct
45 Correct 710 ms 58820 KB Output is correct
46 Correct 1088 ms 60192 KB Output is correct
47 Correct 1000 ms 60096 KB Output is correct
48 Correct 301 ms 62364 KB Output is correct
49 Correct 334 ms 57072 KB Output is correct
50 Correct 696 ms 62276 KB Output is correct
51 Correct 562 ms 62360 KB Output is correct
52 Correct 24 ms 23800 KB Output is correct
53 Correct 1053 ms 60228 KB Output is correct
54 Correct 609 ms 58108 KB Output is correct
55 Correct 700 ms 58740 KB Output is correct
56 Correct 1022 ms 60244 KB Output is correct
57 Correct 1587 ms 199276 KB Output is correct
58 Correct 1780 ms 172000 KB Output is correct
59 Correct 3890 ms 199200 KB Output is correct
60 Correct 3104 ms 199160 KB Output is correct
61 Correct 6942 ms 188772 KB Output is correct
62 Correct 3565 ms 177132 KB Output is correct
63 Correct 4094 ms 177880 KB Output is correct
64 Correct 6452 ms 188432 KB Output is correct
65 Correct 578 ms 62188 KB Output is correct
66 Incorrect 409 ms 57072 KB Output isn't correct
67 Halted 0 ms 0 KB -