답안 #161059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161059 2019-10-31T11:52:39 Z georgerapeanu Two Dishes (JOI19_dishes) C++11
100 / 100
9513 ms 246572 KB
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int NMAX = 1e6;

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

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

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

vector<int> event[NMAX + 5];

struct node_t {
    long long base_offset;
    long long sum;
    long long val;
    int 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(int nod,int st,int 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(int nod,int st,int dr) {
    aint[nod].base_offset = 0;
    aint[nod].sum = 0;
    aint[nod].val = 0;
    aint[nod].lazy = 0;

    if(st == dr) {
        return ;
    }

    int mid = (st + dr) / 2;

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

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

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

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

    int 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(int nod,int st,int dr,int pos,int delta) { /// += delta_offset
    propag(nod,st,dr);
    if(dr < pos || st > pos) {
        return ;
    }

    if(st == dr) {
        aint[nod].base_offset += delta;
        aint[nod].sum = aint[nod].val;
        return ;
    }

    int mid = (st + dr) / 2;

    update_offset(nod * 2,st,mid,pos,delta);
    update_offset(nod * 2 + 1,mid + 1,dr,pos,delta);

    aint[nod] = aint[nod * 2] + aint[nod * 2 + 1];
}

void update_0(int nod,int st,int dr,int l,int 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 ;
    }

    int 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(int nod,int st,int dr,int l,int r) {
    propag(nod,st,dr);
    if(r < st || l > dr) {
        return 0;
    }

    if(l <= st && dr <= r) {
        return aint[nod].sum;
    }

    int 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(int nod,int st,int dr,int pos) {
    propag(nod,st,dr);
    if(dr < pos || st > pos) {
        return -1e18;
    }

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

    int 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,int> find_pos(int nod,int st,int dr,long long sum,int pos) {
    propag(nod,st,dr);

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

    int mid = (st + dr) / 2;

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

}

int get_pos_sum(int pos,long long elem) {
    if(pos > n) {
        return n + 1;
    }

    pair<long long,int> tmp = find_pos(1,0,n,-elem,pos);

    if(tmp.first + elem < 0) {
        return n + 1;
    }

    return tmp.second;
}

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

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

    int 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;

int i32() {
    int ans = 0;
    int 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;
}

long long i64() {
    long long ans = 0;
    int 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;
}

void afis(int nod,int st,int dr,long long &sum) {
    propag(nod,st,dr);
    if(st == dr) {
        sum += aint[nod].val + aint[nod].base_offset;
        //    printf("%lld ",sum);
        printf("(%lld,%lld) ",aint[nod].val,aint[nod].base_offset);
        return ;
    }

    int mid = (st + dr) / 2;
    afis(nod * 2,st,mid,sum);
    afis(nod * 2 + 1,mid + 1,dr,sum);
}

int main() {

    m = i32();
    n = i32();

    for(int i = 1; i <= m; i++) {
        b[i] = i32();
        t[i] = i64();
        q[i] = i32();
        pref_sum_b[i] = b[i] + pref_sum_b[i - 1];
    }

    for(int i = 1; i <= n; i++) {
        a[i] = i32();
        s[i] = i64();
        p[i] = i32();
        pref_sum_a[i] = a[i] + pref_sum_a[i - 1];
    }


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

        pref_col[j] =  l;
    }


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

        while(r - l > 1) {
            int 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(int i = 1; i <= n; i++) {
        if(pref_lin[i] > -1) {
            update_offset(1,0,n,i,p[i]);
            event[pref_lin[i] + 1].push_back(i);
        }
    }

    //long long tmp = 0;afis(1,0,n,tmp);printf("\n");
    for(int j = 1; j <= m; j++) {
        vector<int> pos;
        for(auto it:event[j]) {
            //         printf("event rem offset on %d val is %d\n",it,p[it]);
            update_offset(1,0,n,it,-p[it]);
            update_val(1,0,n,it,p[it]);
            pos.push_back(it);
        }
        //       printf("col trans %d %d\n",pref_col[j] + 1,q[j]);
        if(pref_col[j] > -1){
            update_val(1,0,n,0,q[j]);
            if(pref_col[j] + 1 <= n){
                update_val(1,0,n,pref_col[j] + 1,-q[j]);
                pos.push_back(pref_col[j] + 1);
            }
        }
        sort(pos.begin(),pos.end());
        pos.resize(unique(pos.begin(),pos.end()) - pos.begin());
        reverse(pos.begin(),pos.end());
        for(auto it:pos){
            int k = get_pos_sum(it,0);
            if(k <= n){
                update_val(1,0,n,k,query_sum(1,0,n,it,k) - get_val(1,0,n,k));
            }
            if(it < k){
                update_0(1,0,n,it,k - 1);
            }
        }
        //long long sum = 0;afis(1,0,n,sum);printf("\n");
    }

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

    return 0;
}

Compilation message

dishes.cpp: In function 'int i32()':
dishes.cpp:249: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:257: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:265: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: In function 'long long int i64()':
dishes.cpp:279: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:287: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:295: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 681 ms 68860 KB Output is correct
2 Correct 634 ms 68728 KB Output is correct
3 Correct 262 ms 65832 KB Output is correct
4 Correct 466 ms 68600 KB Output is correct
5 Correct 24 ms 23800 KB Output is correct
6 Correct 637 ms 67528 KB Output is correct
7 Correct 126 ms 53744 KB Output is correct
8 Correct 51 ms 36344 KB Output is correct
9 Correct 294 ms 66800 KB Output is correct
10 Correct 719 ms 64964 KB Output is correct
11 Correct 244 ms 60320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23928 KB Output is correct
2 Correct 26 ms 23928 KB Output is correct
3 Correct 26 ms 23928 KB Output is correct
4 Correct 27 ms 23928 KB Output is correct
5 Correct 26 ms 23928 KB Output is correct
6 Correct 25 ms 23928 KB Output is correct
7 Correct 26 ms 23900 KB Output is correct
8 Correct 26 ms 23928 KB Output is correct
9 Correct 25 ms 23928 KB Output is correct
10 Correct 24 ms 23928 KB Output is correct
11 Correct 26 ms 23928 KB Output is correct
12 Correct 24 ms 23900 KB Output is correct
13 Correct 45 ms 23928 KB Output is correct
14 Correct 25 ms 23928 KB Output is correct
15 Correct 23 ms 23928 KB Output is correct
16 Correct 26 ms 23876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23928 KB Output is correct
2 Correct 26 ms 23928 KB Output is correct
3 Correct 26 ms 23928 KB Output is correct
4 Correct 27 ms 23928 KB Output is correct
5 Correct 26 ms 23928 KB Output is correct
6 Correct 25 ms 23928 KB Output is correct
7 Correct 26 ms 23900 KB Output is correct
8 Correct 26 ms 23928 KB Output is correct
9 Correct 25 ms 23928 KB Output is correct
10 Correct 24 ms 23928 KB Output is correct
11 Correct 26 ms 23928 KB Output is correct
12 Correct 24 ms 23900 KB Output is correct
13 Correct 45 ms 23928 KB Output is correct
14 Correct 25 ms 23928 KB Output is correct
15 Correct 23 ms 23928 KB Output is correct
16 Correct 26 ms 23876 KB Output is correct
17 Correct 29 ms 24188 KB Output is correct
18 Correct 30 ms 24160 KB Output is correct
19 Correct 33 ms 24312 KB Output is correct
20 Correct 30 ms 24184 KB Output is correct
21 Correct 31 ms 24184 KB Output is correct
22 Correct 31 ms 24184 KB Output is correct
23 Correct 33 ms 24184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23928 KB Output is correct
2 Correct 26 ms 23928 KB Output is correct
3 Correct 26 ms 23928 KB Output is correct
4 Correct 27 ms 23928 KB Output is correct
5 Correct 26 ms 23928 KB Output is correct
6 Correct 25 ms 23928 KB Output is correct
7 Correct 26 ms 23900 KB Output is correct
8 Correct 26 ms 23928 KB Output is correct
9 Correct 25 ms 23928 KB Output is correct
10 Correct 24 ms 23928 KB Output is correct
11 Correct 26 ms 23928 KB Output is correct
12 Correct 24 ms 23900 KB Output is correct
13 Correct 45 ms 23928 KB Output is correct
14 Correct 25 ms 23928 KB Output is correct
15 Correct 23 ms 23928 KB Output is correct
16 Correct 26 ms 23876 KB Output is correct
17 Correct 29 ms 24188 KB Output is correct
18 Correct 30 ms 24160 KB Output is correct
19 Correct 33 ms 24312 KB Output is correct
20 Correct 30 ms 24184 KB Output is correct
21 Correct 31 ms 24184 KB Output is correct
22 Correct 31 ms 24184 KB Output is correct
23 Correct 33 ms 24184 KB Output is correct
24 Correct 423 ms 62552 KB Output is correct
25 Correct 546 ms 64236 KB Output is correct
26 Correct 403 ms 62580 KB Output is correct
27 Correct 565 ms 68344 KB Output is correct
28 Correct 575 ms 63924 KB Output is correct
29 Correct 253 ms 63720 KB Output is correct
30 Correct 1469 ms 66012 KB Output is correct
31 Correct 307 ms 52552 KB Output is correct
32 Correct 119 ms 34552 KB Output is correct
33 Correct 809 ms 63980 KB Output is correct
34 Correct 1051 ms 64376 KB Output is correct
35 Correct 1479 ms 59484 KB Output is correct
36 Correct 1405 ms 59404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23928 KB Output is correct
2 Correct 26 ms 23928 KB Output is correct
3 Correct 26 ms 23928 KB Output is correct
4 Correct 27 ms 23928 KB Output is correct
5 Correct 26 ms 23928 KB Output is correct
6 Correct 25 ms 23928 KB Output is correct
7 Correct 26 ms 23900 KB Output is correct
8 Correct 26 ms 23928 KB Output is correct
9 Correct 25 ms 23928 KB Output is correct
10 Correct 24 ms 23928 KB Output is correct
11 Correct 26 ms 23928 KB Output is correct
12 Correct 24 ms 23900 KB Output is correct
13 Correct 45 ms 23928 KB Output is correct
14 Correct 25 ms 23928 KB Output is correct
15 Correct 23 ms 23928 KB Output is correct
16 Correct 26 ms 23876 KB Output is correct
17 Correct 29 ms 24188 KB Output is correct
18 Correct 30 ms 24160 KB Output is correct
19 Correct 33 ms 24312 KB Output is correct
20 Correct 30 ms 24184 KB Output is correct
21 Correct 31 ms 24184 KB Output is correct
22 Correct 31 ms 24184 KB Output is correct
23 Correct 33 ms 24184 KB Output is correct
24 Correct 423 ms 62552 KB Output is correct
25 Correct 546 ms 64236 KB Output is correct
26 Correct 403 ms 62580 KB Output is correct
27 Correct 565 ms 68344 KB Output is correct
28 Correct 575 ms 63924 KB Output is correct
29 Correct 253 ms 63720 KB Output is correct
30 Correct 1469 ms 66012 KB Output is correct
31 Correct 307 ms 52552 KB Output is correct
32 Correct 119 ms 34552 KB Output is correct
33 Correct 809 ms 63980 KB Output is correct
34 Correct 1051 ms 64376 KB Output is correct
35 Correct 1479 ms 59484 KB Output is correct
36 Correct 1405 ms 59404 KB Output is correct
37 Correct 406 ms 65688 KB Output is correct
38 Correct 575 ms 71328 KB Output is correct
39 Correct 692 ms 68696 KB Output is correct
40 Correct 840 ms 68728 KB Output is correct
41 Correct 24 ms 23928 KB Output is correct
42 Correct 1533 ms 69068 KB Output is correct
43 Correct 814 ms 67064 KB Output is correct
44 Correct 1040 ms 67356 KB Output is correct
45 Correct 1549 ms 62584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23928 KB Output is correct
2 Correct 26 ms 23928 KB Output is correct
3 Correct 26 ms 23928 KB Output is correct
4 Correct 27 ms 23928 KB Output is correct
5 Correct 26 ms 23928 KB Output is correct
6 Correct 25 ms 23928 KB Output is correct
7 Correct 26 ms 23900 KB Output is correct
8 Correct 26 ms 23928 KB Output is correct
9 Correct 25 ms 23928 KB Output is correct
10 Correct 24 ms 23928 KB Output is correct
11 Correct 26 ms 23928 KB Output is correct
12 Correct 24 ms 23900 KB Output is correct
13 Correct 45 ms 23928 KB Output is correct
14 Correct 25 ms 23928 KB Output is correct
15 Correct 23 ms 23928 KB Output is correct
16 Correct 26 ms 23876 KB Output is correct
17 Correct 29 ms 24188 KB Output is correct
18 Correct 30 ms 24160 KB Output is correct
19 Correct 33 ms 24312 KB Output is correct
20 Correct 30 ms 24184 KB Output is correct
21 Correct 31 ms 24184 KB Output is correct
22 Correct 31 ms 24184 KB Output is correct
23 Correct 33 ms 24184 KB Output is correct
24 Correct 423 ms 62552 KB Output is correct
25 Correct 546 ms 64236 KB Output is correct
26 Correct 403 ms 62580 KB Output is correct
27 Correct 565 ms 68344 KB Output is correct
28 Correct 575 ms 63924 KB Output is correct
29 Correct 253 ms 63720 KB Output is correct
30 Correct 1469 ms 66012 KB Output is correct
31 Correct 307 ms 52552 KB Output is correct
32 Correct 119 ms 34552 KB Output is correct
33 Correct 809 ms 63980 KB Output is correct
34 Correct 1051 ms 64376 KB Output is correct
35 Correct 1479 ms 59484 KB Output is correct
36 Correct 1405 ms 59404 KB Output is correct
37 Correct 406 ms 65688 KB Output is correct
38 Correct 575 ms 71328 KB Output is correct
39 Correct 692 ms 68696 KB Output is correct
40 Correct 840 ms 68728 KB Output is correct
41 Correct 24 ms 23928 KB Output is correct
42 Correct 1533 ms 69068 KB Output is correct
43 Correct 814 ms 67064 KB Output is correct
44 Correct 1040 ms 67356 KB Output is correct
45 Correct 1549 ms 62584 KB Output is correct
46 Correct 2139 ms 181744 KB Output is correct
47 Correct 3321 ms 210900 KB Output is correct
48 Correct 3831 ms 203232 KB Output is correct
49 Correct 4592 ms 202992 KB Output is correct
50 Correct 9278 ms 199384 KB Output is correct
51 Correct 4824 ms 187516 KB Output is correct
52 Correct 5878 ms 186668 KB Output is correct
53 Correct 8908 ms 182452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 681 ms 68860 KB Output is correct
2 Correct 634 ms 68728 KB Output is correct
3 Correct 262 ms 65832 KB Output is correct
4 Correct 466 ms 68600 KB Output is correct
5 Correct 24 ms 23800 KB Output is correct
6 Correct 637 ms 67528 KB Output is correct
7 Correct 126 ms 53744 KB Output is correct
8 Correct 51 ms 36344 KB Output is correct
9 Correct 294 ms 66800 KB Output is correct
10 Correct 719 ms 64964 KB Output is correct
11 Correct 244 ms 60320 KB Output is correct
12 Correct 24 ms 23928 KB Output is correct
13 Correct 26 ms 23928 KB Output is correct
14 Correct 26 ms 23928 KB Output is correct
15 Correct 27 ms 23928 KB Output is correct
16 Correct 26 ms 23928 KB Output is correct
17 Correct 25 ms 23928 KB Output is correct
18 Correct 26 ms 23900 KB Output is correct
19 Correct 26 ms 23928 KB Output is correct
20 Correct 25 ms 23928 KB Output is correct
21 Correct 24 ms 23928 KB Output is correct
22 Correct 26 ms 23928 KB Output is correct
23 Correct 24 ms 23900 KB Output is correct
24 Correct 45 ms 23928 KB Output is correct
25 Correct 25 ms 23928 KB Output is correct
26 Correct 23 ms 23928 KB Output is correct
27 Correct 26 ms 23876 KB Output is correct
28 Correct 29 ms 24188 KB Output is correct
29 Correct 30 ms 24160 KB Output is correct
30 Correct 33 ms 24312 KB Output is correct
31 Correct 30 ms 24184 KB Output is correct
32 Correct 31 ms 24184 KB Output is correct
33 Correct 31 ms 24184 KB Output is correct
34 Correct 33 ms 24184 KB Output is correct
35 Correct 423 ms 62552 KB Output is correct
36 Correct 546 ms 64236 KB Output is correct
37 Correct 403 ms 62580 KB Output is correct
38 Correct 565 ms 68344 KB Output is correct
39 Correct 575 ms 63924 KB Output is correct
40 Correct 253 ms 63720 KB Output is correct
41 Correct 1469 ms 66012 KB Output is correct
42 Correct 307 ms 52552 KB Output is correct
43 Correct 119 ms 34552 KB Output is correct
44 Correct 809 ms 63980 KB Output is correct
45 Correct 1051 ms 64376 KB Output is correct
46 Correct 1479 ms 59484 KB Output is correct
47 Correct 1405 ms 59404 KB Output is correct
48 Correct 406 ms 65688 KB Output is correct
49 Correct 575 ms 71328 KB Output is correct
50 Correct 692 ms 68696 KB Output is correct
51 Correct 840 ms 68728 KB Output is correct
52 Correct 24 ms 23928 KB Output is correct
53 Correct 1533 ms 69068 KB Output is correct
54 Correct 814 ms 67064 KB Output is correct
55 Correct 1040 ms 67356 KB Output is correct
56 Correct 1549 ms 62584 KB Output is correct
57 Correct 495 ms 66036 KB Output is correct
58 Correct 482 ms 71744 KB Output is correct
59 Correct 849 ms 69648 KB Output is correct
60 Correct 668 ms 69496 KB Output is correct
61 Correct 1205 ms 66120 KB Output is correct
62 Correct 23 ms 23928 KB Output is correct
63 Correct 1452 ms 69128 KB Output is correct
64 Correct 828 ms 66968 KB Output is correct
65 Correct 1126 ms 67316 KB Output is correct
66 Correct 1436 ms 62716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 681 ms 68860 KB Output is correct
2 Correct 634 ms 68728 KB Output is correct
3 Correct 262 ms 65832 KB Output is correct
4 Correct 466 ms 68600 KB Output is correct
5 Correct 24 ms 23800 KB Output is correct
6 Correct 637 ms 67528 KB Output is correct
7 Correct 126 ms 53744 KB Output is correct
8 Correct 51 ms 36344 KB Output is correct
9 Correct 294 ms 66800 KB Output is correct
10 Correct 719 ms 64964 KB Output is correct
11 Correct 244 ms 60320 KB Output is correct
12 Correct 24 ms 23928 KB Output is correct
13 Correct 26 ms 23928 KB Output is correct
14 Correct 26 ms 23928 KB Output is correct
15 Correct 27 ms 23928 KB Output is correct
16 Correct 26 ms 23928 KB Output is correct
17 Correct 25 ms 23928 KB Output is correct
18 Correct 26 ms 23900 KB Output is correct
19 Correct 26 ms 23928 KB Output is correct
20 Correct 25 ms 23928 KB Output is correct
21 Correct 24 ms 23928 KB Output is correct
22 Correct 26 ms 23928 KB Output is correct
23 Correct 24 ms 23900 KB Output is correct
24 Correct 45 ms 23928 KB Output is correct
25 Correct 25 ms 23928 KB Output is correct
26 Correct 23 ms 23928 KB Output is correct
27 Correct 26 ms 23876 KB Output is correct
28 Correct 29 ms 24188 KB Output is correct
29 Correct 30 ms 24160 KB Output is correct
30 Correct 33 ms 24312 KB Output is correct
31 Correct 30 ms 24184 KB Output is correct
32 Correct 31 ms 24184 KB Output is correct
33 Correct 31 ms 24184 KB Output is correct
34 Correct 33 ms 24184 KB Output is correct
35 Correct 423 ms 62552 KB Output is correct
36 Correct 546 ms 64236 KB Output is correct
37 Correct 403 ms 62580 KB Output is correct
38 Correct 565 ms 68344 KB Output is correct
39 Correct 575 ms 63924 KB Output is correct
40 Correct 253 ms 63720 KB Output is correct
41 Correct 1469 ms 66012 KB Output is correct
42 Correct 307 ms 52552 KB Output is correct
43 Correct 119 ms 34552 KB Output is correct
44 Correct 809 ms 63980 KB Output is correct
45 Correct 1051 ms 64376 KB Output is correct
46 Correct 1479 ms 59484 KB Output is correct
47 Correct 1405 ms 59404 KB Output is correct
48 Correct 406 ms 65688 KB Output is correct
49 Correct 575 ms 71328 KB Output is correct
50 Correct 692 ms 68696 KB Output is correct
51 Correct 840 ms 68728 KB Output is correct
52 Correct 24 ms 23928 KB Output is correct
53 Correct 1533 ms 69068 KB Output is correct
54 Correct 814 ms 67064 KB Output is correct
55 Correct 1040 ms 67356 KB Output is correct
56 Correct 1549 ms 62584 KB Output is correct
57 Correct 2139 ms 181744 KB Output is correct
58 Correct 3321 ms 210900 KB Output is correct
59 Correct 3831 ms 203232 KB Output is correct
60 Correct 4592 ms 202992 KB Output is correct
61 Correct 9278 ms 199384 KB Output is correct
62 Correct 4824 ms 187516 KB Output is correct
63 Correct 5878 ms 186668 KB Output is correct
64 Correct 8908 ms 182452 KB Output is correct
65 Correct 495 ms 66036 KB Output is correct
66 Correct 482 ms 71744 KB Output is correct
67 Correct 849 ms 69648 KB Output is correct
68 Correct 668 ms 69496 KB Output is correct
69 Correct 1205 ms 66120 KB Output is correct
70 Correct 23 ms 23928 KB Output is correct
71 Correct 1452 ms 69128 KB Output is correct
72 Correct 828 ms 66968 KB Output is correct
73 Correct 1126 ms 67316 KB Output is correct
74 Correct 1436 ms 62716 KB Output is correct
75 Correct 2622 ms 217120 KB Output is correct
76 Correct 2620 ms 246572 KB Output is correct
77 Correct 4728 ms 234372 KB Output is correct
78 Correct 3668 ms 234404 KB Output is correct
79 Correct 9513 ms 234268 KB Output is correct
80 Correct 4807 ms 221420 KB Output is correct
81 Correct 6369 ms 219864 KB Output is correct
82 Correct 9394 ms 202376 KB Output is correct
83 Correct 8784 ms 221984 KB Output is correct