답안 #1098054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1098054 2024-10-09T01:46:08 Z azberjibiou 송신탑 (IOI22_towers) C++17
100 / 100
1083 ms 59844 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define lb lower_bound
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long long ll;
using namespace std;
const int mxN=500005;
const int mxM=2200005;
const int mxK=61;
const int MOD=1e9+7;
const ll INF=1e18;
struct segtree{
    pii seg[4*mxN];
    pii mrg(pii a, pii b){
        return pii(min(a.fi, b.fi), max(a.se, b.se));
    }
    void init(int idx, int s, int e, vector <int> &v){
        if(s==e){
            seg[idx]=pii(v[s], v[s]);
            return;
        }
        int mid=(s+e)/2;
        init(2*idx, s, mid, v);
        init(2*idx+1, mid+1, e, v);
        seg[idx]=mrg(seg[2*idx], seg[2*idx+1]);
    }
    pii solv(int idx, int s1, int e1, int s2, int e2){
        if(s2>e1 || s1>e2) return pii(MOD, -MOD);
        if(s2<=s1 && e1<=e2) return seg[idx];
        int mid=(s1+e1)/2;
        return mrg(solv(2*idx, s1, mid, s2, e2), solv(2*idx+1, mid+1, e1, s2, e2));
    }
};
struct node{
    int val;
    int l, r;
    node() : val(), l(), r() {}
    node(int val, int l, int r) : val(val), l(l), r(r) {}
};
struct pst{
    vector <node> tree;
    int root[100010]={};
    int sz=1, L, R;
    void init_s(int a, int b){
        tree.resize(2300000);
        root[0]=sz++;
        L=a, R=b;
        init_t(root[0], L, R);
    }
    void init_t(int idx, int s, int e){
        if(s==e) return;
        int mid=(s+e)/2;
        tree[idx].l=sz++;
        init_t(sz-1, s, mid);
        tree[idx].r=sz++;
        init_t(sz-1, mid+1, e);
    }
    void upd_s(int now, int pos){
        root[now]=sz++;
        upd_t(root[now], root[now-1], L, R, pos);
    }
    void upd_t(int idx1, int idx2, int s, int e, int pos){
        tree[idx1].val=tree[idx2].val;
        tree[idx1].val++;
        if(s==e) return;
        int mid=(s+e)/2;
        if(pos<=mid) tree[idx1].l=sz++;
        else tree[idx1].r=sz++;
        if(pos<=mid) upd_t(sz-1, tree[idx2].l, s, mid, pos), tree[idx1].r=tree[idx2].r;
        else upd_t(sz-1, tree[idx2].r, mid+1, e, pos), tree[idx1].l=tree[idx2].l;
    }
    int solv_s(int rt, int s, int e){
        return solv_t(root[rt], L, R, s, e);
    }
    int solv_t(int idx, int s1, int e1, int s2, int e2){
        if(s2>e1 || s1>e2) return 0;
        if(s2<=s1 && e1<=e2) return tree[idx].val;
        int mid=(s1+e1)/2;
        return solv_t(tree[idx].l, s1, mid, s2, e2)+solv_t(tree[idx].r, mid+1, e1, s2, e2);
    }
    int bin_searchl_t(int idx, int s1, int e1, int s2, int e2){
        if(s2>e1 || s1>e2) return 0;
        if(s1==e1){
            return (tree[idx].val==1 ? s1 : 0);
        }
        if(s2<=s1 && e1<=e2){
            if(tree[idx].val!=0){
                int mid=(s1+e1)/2;
                int lres=bin_searchl_t(tree[idx].l, s1, mid, s2, e2);
                if(lres!=0) return lres;
                return bin_searchl_t(tree[idx].r, mid+1, e1, s2, e2);
            }
            else return 0;
        }
        int mid=(s1+e1)/2;
        int lres=bin_searchl_t(tree[idx].l, s1, mid, s2, e2);
        if(lres!=0) return lres;
        return bin_searchl_t(tree[idx].r, mid+1, e1, s2, e2);
    }
    int bin_searchr_t(int idx, int s1, int e1, int s2, int e2){
        if(s2>e1 || s1>e2) return 0;
        if(s1==e1){
            return (tree[idx].val==1 ? s1 : 0);
        }
        if(s2<=s1 && e1<=e2){
            if(tree[idx].val!=0){
                int mid=(s1+e1)/2;
                int rres=bin_searchr_t(tree[idx].r, mid+1, e1, s2, e2);
                if(rres!=0) return rres;
                return bin_searchr_t(tree[idx].l, s1, mid, s2, e2);
            }
            else return 0;
        }
        int mid=(s1+e1)/2;
        int rres=bin_searchr_t(tree[idx].r, mid+1, e1, s2, e2);
        if(rres!=0) return rres;
        return bin_searchr_t(tree[idx].l, s1, mid, s2, e2);
    }
    int bin_searchl_s(int rt, int s, int e){
        return bin_searchl_t(root[rt], L, R, s, e);
    }
    
    int bin_searchr_s(int rt, int s, int e){
        return bin_searchr_t(root[rt], L, R, s, e);
    }
};
int N, Q;
int A[mxN];
int qry[mxN][3];
int F[mxN];
vector <pii> Dp, Dm;
/*
void input(){
    cin >> N >> Q;
    A[0]=-1e9-10, A[1]=1e9+10;
    for(int i=2;i<=N+1;i++) cin >> A[i];
    A[N+2]=1e9+10, A[N+3]=-1e9-10;
    for(int i=1;i<=Q;i++){
        int l, r, d;
        cin >> l >> r >> d;
        qry[i][0]=l;
        qry[i][1]=r;
        qry[i][2]=d;
    }
}
*/
segtree T1;
void make_F(){
    vector <int> v(N+4);
    for(int i=0;i<=N+3;i++) v[i]=A[i];
    T1.init(1, 0, N+3, v);
    stack <int> stk;
    stk.push(1);
    for(int i=2;i<=N+1;i++){
        while(A[stk.top()]<A[i]) stk.pop();
        if(A[i]<A[i-1] || A[i]<A[i+1]) continue;
        int mini=(stk.top()==i-1 ? MOD : T1.solv(1, 0, N+3, stk.top()+1, i-1).fi);
        F[i]=A[i]-mini;
        stk.push(i);
    }
    while(stk.size()) stk.pop();

    stk.push(N+2);
    for(int i=N+1;i>=2;i--){
        while(A[stk.top()]<A[i]) stk.pop();
        if(A[i]<A[i-1] || A[i]<A[i+1]) continue;
        int mini=(stk.top()==i+1 ? MOD : T1.solv(1, 0, N+3, i+1, stk.top()-1).fi);
        F[i]=min(F[i], A[i]-mini);
        stk.push(i);
    }
    while(stk.size()) stk.pop();

    stk.push(0);
    for(int i=2;i<=N+1;i++){
        while(A[stk.top()]>A[i]) stk.pop();
        if(A[i]>A[i-1] || A[i]>A[i+1]) continue;
        int maxi=(stk.top()==i-1 ? -MOD : T1.solv(1, 0, N+3, stk.top()+1, i-1).se);
        F[i]=maxi-A[i];
        stk.push(i);
    }

    stk.push(N+3);
    for(int i=N+1;i>=2;i--){
        while(A[stk.top()]>A[i]) stk.pop();
        if(A[i]>A[i-1] || A[i]>A[i+1]) continue;
        int maxi=(stk.top()==i+1 ? -MOD : T1.solv(1, 0, N+3, i+1, stk.top()-1).se);
        F[i]=min(F[i], maxi-A[i]);
        F[i]*=-1;
        stk.push(i);
    }
    //for(int i=1;i<=N;i++) printf("F[%d]=%d\n", i, F[i+1]);
    for(int i=2;i<=N+1;i++) if(F[i]>0) Dp.emplace_back(F[i], i);
    for(int i=2;i<=N+1;i++) if(F[i]<0) Dm.emplace_back(-F[i], i);
    sort(all(Dp), [](pii a, pii b){return a>b;});
    sort(all(Dm), [](pii a, pii b){return a>b;});
    /*
    for(auto [x, y] : Dp) printf("(%d %d) ", x, y);
    printf("\n");
    for(auto [x, y] : Dm) printf("(%d %d) ", x, y);
    printf("\n");
    */
}
pst T2, T3;
void make_tree(){
    T2.init_s(2, N+1);
    for(int i=0;i<Dp.size();i++){
        T2.upd_s(i+1, Dp[i].se);
    }
    T3.init_s(2, N+1);
    for(int i=0;i<Dm.size();i++){
        T3.upd_s(i+1, Dm[i].se);
    }
}
void init(int n, vector <int> v){
    N=n;
    A[0]=-1e9-10, A[1]=1e9+10;
    for(int i=2;i<=N+1;i++) A[i]=v[i-2];
    A[N+2]=1e9+10, A[N+3]=-1e9-10;
    make_F();
    make_tree();
}
int max_towers(int l, int r, int d){
    l+=2, r+=2;
    int lp=N+3, lm=N+3, rp=0, rm=0, mcnt=0, pcnt=0;

    int mxidx, mnidx;
    mxidx=lower_bound(all(Dp), pii(d, 0), [](pii a, pii b){return a>b;})-Dp.begin();
    mnidx=lower_bound(all(Dm), pii(d, 0), [](pii a, pii b){return a>b;})-Dm.begin();
    pcnt=T2.solv_s(mxidx, l, r);
    mcnt=T3.solv_s(mnidx, l, r);
    if(pcnt!=0){
        rp=T2.bin_searchr_s(mxidx, l, r);
        lp=T2.bin_searchl_s(mxidx, l, r);
        /*
        int s=l, e=r+1;
        while(s!=e){
            int mid=(s+e)/2;
            if(T2.solv_s(mxidx, mid, r)==0) e=mid;
            else s=mid+1;
        }
        rp=s-1;
        s=l, e=r;
        while(s!=e){
            int mid=(s+e)/2;
            if(T2.solv_s(mxidx, l, mid)==0) s=mid+1;
            else e=mid;
        }
        lp=s;
        */
    }
    if(mcnt!=0){
        rm=T3.bin_searchr_s(mnidx, l, r);
        lm=T3.bin_searchl_s(mnidx, l, r);
        /*
        int s=l, e=r+1;
        while(s!=e){
            int mid=(s+e)/2;
            if(T3.solv_s(mnidx, mid, r)==0) e=mid;
            else s=mid+1;
        }
        rm=s-1;
        s=l, e=r;
        while(s!=e){
            int mid=(s+e)/2;
            if(T3.solv_s(mnidx, l, mid)==0) s=mid+1;
            else e=mid;
        }
        lm=s;
        */
    }
    /*
    for(int i=l;i<=r;i++){
        if(F[i]>=d) pcnt++, rp=max(rp, i), lp=min(lp, i);
        if(F[i]<=-d) mcnt++, rm=max(rm, i), lm=min(lm, i);
    }
    */
    if(rp!=0 && rp>=rm){
        bool ok=false;
        if(rp!=r && T1.solv(1, 0, N+3, rp+1, r).fi<=A[rp]-d) ok=true;
        if(ok) mcnt++;
    }
    if(lp!=N+3 && lp<=lm){
        bool ok=false;
        if(lp!=l && T1.solv(1, 0, N+3, l, lp-1).fi<=A[lp]-d) ok=true;
        if(ok) mcnt++;
    }
    return (mcnt<=1 ? 1 : mcnt);
}
/*
int main()
{
    gibon
    input();
    make_F();
    make_tree();
    for(int i=1;i<=Q;i++){
        printf("%d\n", max_towers(qry[i][0], qry[i][1], qry[i][2]));
    }
} 
*/

Compilation message

towers.cpp: In function 'void make_tree()':
towers.cpp:211:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  211 |     for(int i=0;i<Dp.size();i++){
      |                 ~^~~~~~~~~~
towers.cpp:215:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  215 |     for(int i=0;i<Dm.size();i++){
      |                 ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 346 ms 57192 KB Output is correct
2 Correct 819 ms 58312 KB Output is correct
3 Correct 765 ms 58308 KB Output is correct
4 Correct 748 ms 58248 KB Output is correct
5 Correct 748 ms 58312 KB Output is correct
6 Correct 729 ms 58312 KB Output is correct
7 Correct 736 ms 58312 KB Output is correct
8 Correct 26 ms 55120 KB Output is correct
9 Correct 24 ms 55120 KB Output is correct
10 Correct 25 ms 55128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55128 KB Output is correct
2 Correct 24 ms 55128 KB Output is correct
3 Correct 23 ms 55128 KB Output is correct
4 Correct 22 ms 55128 KB Output is correct
5 Correct 22 ms 55128 KB Output is correct
6 Correct 23 ms 55128 KB Output is correct
7 Correct 24 ms 55116 KB Output is correct
8 Correct 23 ms 55212 KB Output is correct
9 Correct 22 ms 55128 KB Output is correct
10 Correct 23 ms 55128 KB Output is correct
11 Correct 22 ms 55128 KB Output is correct
12 Correct 21 ms 55128 KB Output is correct
13 Correct 21 ms 55336 KB Output is correct
14 Correct 21 ms 55212 KB Output is correct
15 Correct 24 ms 55256 KB Output is correct
16 Correct 22 ms 55128 KB Output is correct
17 Correct 22 ms 55128 KB Output is correct
18 Correct 21 ms 55128 KB Output is correct
19 Correct 22 ms 55128 KB Output is correct
20 Correct 21 ms 55352 KB Output is correct
21 Correct 21 ms 55176 KB Output is correct
22 Correct 21 ms 55128 KB Output is correct
23 Correct 22 ms 55128 KB Output is correct
24 Correct 21 ms 55128 KB Output is correct
25 Correct 21 ms 55124 KB Output is correct
26 Correct 23 ms 55128 KB Output is correct
27 Correct 22 ms 55120 KB Output is correct
28 Correct 22 ms 55252 KB Output is correct
29 Correct 23 ms 55128 KB Output is correct
30 Correct 22 ms 55120 KB Output is correct
31 Correct 23 ms 55128 KB Output is correct
32 Correct 21 ms 55128 KB Output is correct
33 Correct 22 ms 55120 KB Output is correct
34 Correct 25 ms 55068 KB Output is correct
35 Correct 27 ms 55120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55128 KB Output is correct
2 Correct 24 ms 55128 KB Output is correct
3 Correct 23 ms 55128 KB Output is correct
4 Correct 22 ms 55128 KB Output is correct
5 Correct 22 ms 55128 KB Output is correct
6 Correct 23 ms 55128 KB Output is correct
7 Correct 24 ms 55116 KB Output is correct
8 Correct 23 ms 55212 KB Output is correct
9 Correct 22 ms 55128 KB Output is correct
10 Correct 23 ms 55128 KB Output is correct
11 Correct 22 ms 55128 KB Output is correct
12 Correct 21 ms 55128 KB Output is correct
13 Correct 21 ms 55336 KB Output is correct
14 Correct 21 ms 55212 KB Output is correct
15 Correct 24 ms 55256 KB Output is correct
16 Correct 22 ms 55128 KB Output is correct
17 Correct 22 ms 55128 KB Output is correct
18 Correct 21 ms 55128 KB Output is correct
19 Correct 22 ms 55128 KB Output is correct
20 Correct 21 ms 55352 KB Output is correct
21 Correct 21 ms 55176 KB Output is correct
22 Correct 21 ms 55128 KB Output is correct
23 Correct 22 ms 55128 KB Output is correct
24 Correct 21 ms 55128 KB Output is correct
25 Correct 21 ms 55124 KB Output is correct
26 Correct 23 ms 55128 KB Output is correct
27 Correct 22 ms 55120 KB Output is correct
28 Correct 22 ms 55252 KB Output is correct
29 Correct 23 ms 55128 KB Output is correct
30 Correct 22 ms 55120 KB Output is correct
31 Correct 23 ms 55128 KB Output is correct
32 Correct 21 ms 55128 KB Output is correct
33 Correct 22 ms 55120 KB Output is correct
34 Correct 25 ms 55068 KB Output is correct
35 Correct 27 ms 55120 KB Output is correct
36 Correct 54 ms 57552 KB Output is correct
37 Correct 65 ms 59332 KB Output is correct
38 Correct 66 ms 59336 KB Output is correct
39 Correct 88 ms 59588 KB Output is correct
40 Correct 81 ms 59776 KB Output is correct
41 Correct 83 ms 59652 KB Output is correct
42 Correct 80 ms 59780 KB Output is correct
43 Correct 42 ms 58320 KB Output is correct
44 Correct 33 ms 58468 KB Output is correct
45 Correct 44 ms 58312 KB Output is correct
46 Correct 34 ms 58316 KB Output is correct
47 Correct 76 ms 59332 KB Output is correct
48 Correct 84 ms 59588 KB Output is correct
49 Correct 78 ms 59588 KB Output is correct
50 Correct 36 ms 58312 KB Output is correct
51 Correct 32 ms 58312 KB Output is correct
52 Correct 74 ms 59332 KB Output is correct
53 Correct 83 ms 59644 KB Output is correct
54 Correct 92 ms 59772 KB Output is correct
55 Correct 41 ms 58308 KB Output is correct
56 Correct 36 ms 58300 KB Output is correct
57 Correct 64 ms 59348 KB Output is correct
58 Correct 66 ms 59328 KB Output is correct
59 Correct 71 ms 59332 KB Output is correct
60 Correct 85 ms 59636 KB Output is correct
61 Correct 82 ms 59772 KB Output is correct
62 Correct 79 ms 59588 KB Output is correct
63 Correct 81 ms 59636 KB Output is correct
64 Correct 34 ms 58312 KB Output is correct
65 Correct 33 ms 58320 KB Output is correct
66 Correct 42 ms 58312 KB Output is correct
67 Correct 37 ms 58312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 697 ms 59332 KB Output is correct
2 Correct 901 ms 59332 KB Output is correct
3 Correct 897 ms 59332 KB Output is correct
4 Correct 944 ms 59776 KB Output is correct
5 Correct 934 ms 59588 KB Output is correct
6 Correct 888 ms 59712 KB Output is correct
7 Correct 913 ms 59536 KB Output is correct
8 Correct 755 ms 58312 KB Output is correct
9 Correct 803 ms 58304 KB Output is correct
10 Correct 852 ms 58308 KB Output is correct
11 Correct 816 ms 58252 KB Output is correct
12 Correct 745 ms 58312 KB Output is correct
13 Correct 679 ms 58312 KB Output is correct
14 Correct 25 ms 55120 KB Output is correct
15 Correct 25 ms 55128 KB Output is correct
16 Correct 25 ms 55128 KB Output is correct
17 Correct 72 ms 59392 KB Output is correct
18 Correct 82 ms 59656 KB Output is correct
19 Correct 79 ms 59588 KB Output is correct
20 Correct 34 ms 58312 KB Output is correct
21 Correct 35 ms 58312 KB Output is correct
22 Correct 72 ms 59332 KB Output is correct
23 Correct 83 ms 59588 KB Output is correct
24 Correct 94 ms 59584 KB Output is correct
25 Correct 35 ms 58320 KB Output is correct
26 Correct 34 ms 58308 KB Output is correct
27 Correct 26 ms 55128 KB Output is correct
28 Correct 27 ms 55124 KB Output is correct
29 Correct 26 ms 55128 KB Output is correct
30 Correct 23 ms 55124 KB Output is correct
31 Correct 25 ms 55284 KB Output is correct
32 Correct 25 ms 55128 KB Output is correct
33 Correct 22 ms 55128 KB Output is correct
34 Correct 23 ms 55120 KB Output is correct
35 Correct 33 ms 55120 KB Output is correct
36 Correct 21 ms 55128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 56656 KB Output is correct
2 Correct 784 ms 59356 KB Output is correct
3 Correct 836 ms 59332 KB Output is correct
4 Correct 896 ms 59584 KB Output is correct
5 Correct 874 ms 59588 KB Output is correct
6 Correct 852 ms 59844 KB Output is correct
7 Correct 821 ms 59588 KB Output is correct
8 Correct 674 ms 58312 KB Output is correct
9 Correct 681 ms 58320 KB Output is correct
10 Correct 718 ms 58312 KB Output is correct
11 Correct 672 ms 58312 KB Output is correct
12 Correct 75 ms 59332 KB Output is correct
13 Correct 83 ms 59588 KB Output is correct
14 Correct 81 ms 59620 KB Output is correct
15 Correct 34 ms 58320 KB Output is correct
16 Correct 33 ms 58412 KB Output is correct
17 Correct 64 ms 59348 KB Output is correct
18 Correct 72 ms 59336 KB Output is correct
19 Correct 68 ms 59332 KB Output is correct
20 Correct 79 ms 59588 KB Output is correct
21 Correct 79 ms 59588 KB Output is correct
22 Correct 84 ms 59632 KB Output is correct
23 Correct 78 ms 59588 KB Output is correct
24 Correct 32 ms 58320 KB Output is correct
25 Correct 32 ms 58320 KB Output is correct
26 Correct 39 ms 58312 KB Output is correct
27 Correct 36 ms 58376 KB Output is correct
28 Correct 22 ms 55128 KB Output is correct
29 Correct 22 ms 55128 KB Output is correct
30 Correct 22 ms 55128 KB Output is correct
31 Correct 21 ms 55128 KB Output is correct
32 Correct 21 ms 55128 KB Output is correct
33 Correct 21 ms 55264 KB Output is correct
34 Correct 21 ms 55128 KB Output is correct
35 Correct 21 ms 55128 KB Output is correct
36 Correct 22 ms 55128 KB Output is correct
37 Correct 22 ms 55292 KB Output is correct
38 Correct 25 ms 55128 KB Output is correct
39 Correct 25 ms 55128 KB Output is correct
40 Correct 22 ms 55128 KB Output is correct
41 Correct 23 ms 55128 KB Output is correct
42 Correct 22 ms 55128 KB Output is correct
43 Correct 22 ms 55176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55128 KB Output is correct
2 Correct 24 ms 55128 KB Output is correct
3 Correct 23 ms 55128 KB Output is correct
4 Correct 22 ms 55128 KB Output is correct
5 Correct 22 ms 55128 KB Output is correct
6 Correct 23 ms 55128 KB Output is correct
7 Correct 24 ms 55116 KB Output is correct
8 Correct 23 ms 55212 KB Output is correct
9 Correct 22 ms 55128 KB Output is correct
10 Correct 23 ms 55128 KB Output is correct
11 Correct 22 ms 55128 KB Output is correct
12 Correct 21 ms 55128 KB Output is correct
13 Correct 21 ms 55336 KB Output is correct
14 Correct 21 ms 55212 KB Output is correct
15 Correct 24 ms 55256 KB Output is correct
16 Correct 22 ms 55128 KB Output is correct
17 Correct 22 ms 55128 KB Output is correct
18 Correct 21 ms 55128 KB Output is correct
19 Correct 22 ms 55128 KB Output is correct
20 Correct 21 ms 55352 KB Output is correct
21 Correct 21 ms 55176 KB Output is correct
22 Correct 21 ms 55128 KB Output is correct
23 Correct 22 ms 55128 KB Output is correct
24 Correct 21 ms 55128 KB Output is correct
25 Correct 21 ms 55124 KB Output is correct
26 Correct 23 ms 55128 KB Output is correct
27 Correct 22 ms 55120 KB Output is correct
28 Correct 22 ms 55252 KB Output is correct
29 Correct 23 ms 55128 KB Output is correct
30 Correct 22 ms 55120 KB Output is correct
31 Correct 23 ms 55128 KB Output is correct
32 Correct 21 ms 55128 KB Output is correct
33 Correct 22 ms 55120 KB Output is correct
34 Correct 25 ms 55068 KB Output is correct
35 Correct 27 ms 55120 KB Output is correct
36 Correct 54 ms 57552 KB Output is correct
37 Correct 65 ms 59332 KB Output is correct
38 Correct 66 ms 59336 KB Output is correct
39 Correct 88 ms 59588 KB Output is correct
40 Correct 81 ms 59776 KB Output is correct
41 Correct 83 ms 59652 KB Output is correct
42 Correct 80 ms 59780 KB Output is correct
43 Correct 42 ms 58320 KB Output is correct
44 Correct 33 ms 58468 KB Output is correct
45 Correct 44 ms 58312 KB Output is correct
46 Correct 34 ms 58316 KB Output is correct
47 Correct 76 ms 59332 KB Output is correct
48 Correct 84 ms 59588 KB Output is correct
49 Correct 78 ms 59588 KB Output is correct
50 Correct 36 ms 58312 KB Output is correct
51 Correct 32 ms 58312 KB Output is correct
52 Correct 74 ms 59332 KB Output is correct
53 Correct 83 ms 59644 KB Output is correct
54 Correct 92 ms 59772 KB Output is correct
55 Correct 41 ms 58308 KB Output is correct
56 Correct 36 ms 58300 KB Output is correct
57 Correct 64 ms 59348 KB Output is correct
58 Correct 66 ms 59328 KB Output is correct
59 Correct 71 ms 59332 KB Output is correct
60 Correct 85 ms 59636 KB Output is correct
61 Correct 82 ms 59772 KB Output is correct
62 Correct 79 ms 59588 KB Output is correct
63 Correct 81 ms 59636 KB Output is correct
64 Correct 34 ms 58312 KB Output is correct
65 Correct 33 ms 58320 KB Output is correct
66 Correct 42 ms 58312 KB Output is correct
67 Correct 37 ms 58312 KB Output is correct
68 Correct 697 ms 59332 KB Output is correct
69 Correct 901 ms 59332 KB Output is correct
70 Correct 897 ms 59332 KB Output is correct
71 Correct 944 ms 59776 KB Output is correct
72 Correct 934 ms 59588 KB Output is correct
73 Correct 888 ms 59712 KB Output is correct
74 Correct 913 ms 59536 KB Output is correct
75 Correct 755 ms 58312 KB Output is correct
76 Correct 803 ms 58304 KB Output is correct
77 Correct 852 ms 58308 KB Output is correct
78 Correct 816 ms 58252 KB Output is correct
79 Correct 745 ms 58312 KB Output is correct
80 Correct 679 ms 58312 KB Output is correct
81 Correct 25 ms 55120 KB Output is correct
82 Correct 25 ms 55128 KB Output is correct
83 Correct 25 ms 55128 KB Output is correct
84 Correct 72 ms 59392 KB Output is correct
85 Correct 82 ms 59656 KB Output is correct
86 Correct 79 ms 59588 KB Output is correct
87 Correct 34 ms 58312 KB Output is correct
88 Correct 35 ms 58312 KB Output is correct
89 Correct 72 ms 59332 KB Output is correct
90 Correct 83 ms 59588 KB Output is correct
91 Correct 94 ms 59584 KB Output is correct
92 Correct 35 ms 58320 KB Output is correct
93 Correct 34 ms 58308 KB Output is correct
94 Correct 26 ms 55128 KB Output is correct
95 Correct 27 ms 55124 KB Output is correct
96 Correct 26 ms 55128 KB Output is correct
97 Correct 23 ms 55124 KB Output is correct
98 Correct 25 ms 55284 KB Output is correct
99 Correct 25 ms 55128 KB Output is correct
100 Correct 22 ms 55128 KB Output is correct
101 Correct 23 ms 55120 KB Output is correct
102 Correct 33 ms 55120 KB Output is correct
103 Correct 21 ms 55128 KB Output is correct
104 Correct 770 ms 59124 KB Output is correct
105 Correct 960 ms 59388 KB Output is correct
106 Correct 901 ms 59332 KB Output is correct
107 Correct 964 ms 59588 KB Output is correct
108 Correct 950 ms 59588 KB Output is correct
109 Correct 957 ms 59588 KB Output is correct
110 Correct 979 ms 59584 KB Output is correct
111 Correct 743 ms 58312 KB Output is correct
112 Correct 814 ms 58312 KB Output is correct
113 Correct 794 ms 58320 KB Output is correct
114 Correct 851 ms 58312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 346 ms 57192 KB Output is correct
2 Correct 819 ms 58312 KB Output is correct
3 Correct 765 ms 58308 KB Output is correct
4 Correct 748 ms 58248 KB Output is correct
5 Correct 748 ms 58312 KB Output is correct
6 Correct 729 ms 58312 KB Output is correct
7 Correct 736 ms 58312 KB Output is correct
8 Correct 26 ms 55120 KB Output is correct
9 Correct 24 ms 55120 KB Output is correct
10 Correct 25 ms 55128 KB Output is correct
11 Correct 24 ms 55128 KB Output is correct
12 Correct 24 ms 55128 KB Output is correct
13 Correct 23 ms 55128 KB Output is correct
14 Correct 22 ms 55128 KB Output is correct
15 Correct 22 ms 55128 KB Output is correct
16 Correct 23 ms 55128 KB Output is correct
17 Correct 24 ms 55116 KB Output is correct
18 Correct 23 ms 55212 KB Output is correct
19 Correct 22 ms 55128 KB Output is correct
20 Correct 23 ms 55128 KB Output is correct
21 Correct 22 ms 55128 KB Output is correct
22 Correct 21 ms 55128 KB Output is correct
23 Correct 21 ms 55336 KB Output is correct
24 Correct 21 ms 55212 KB Output is correct
25 Correct 24 ms 55256 KB Output is correct
26 Correct 22 ms 55128 KB Output is correct
27 Correct 22 ms 55128 KB Output is correct
28 Correct 21 ms 55128 KB Output is correct
29 Correct 22 ms 55128 KB Output is correct
30 Correct 21 ms 55352 KB Output is correct
31 Correct 21 ms 55176 KB Output is correct
32 Correct 21 ms 55128 KB Output is correct
33 Correct 22 ms 55128 KB Output is correct
34 Correct 21 ms 55128 KB Output is correct
35 Correct 21 ms 55124 KB Output is correct
36 Correct 23 ms 55128 KB Output is correct
37 Correct 22 ms 55120 KB Output is correct
38 Correct 22 ms 55252 KB Output is correct
39 Correct 23 ms 55128 KB Output is correct
40 Correct 22 ms 55120 KB Output is correct
41 Correct 23 ms 55128 KB Output is correct
42 Correct 21 ms 55128 KB Output is correct
43 Correct 22 ms 55120 KB Output is correct
44 Correct 25 ms 55068 KB Output is correct
45 Correct 27 ms 55120 KB Output is correct
46 Correct 54 ms 57552 KB Output is correct
47 Correct 65 ms 59332 KB Output is correct
48 Correct 66 ms 59336 KB Output is correct
49 Correct 88 ms 59588 KB Output is correct
50 Correct 81 ms 59776 KB Output is correct
51 Correct 83 ms 59652 KB Output is correct
52 Correct 80 ms 59780 KB Output is correct
53 Correct 42 ms 58320 KB Output is correct
54 Correct 33 ms 58468 KB Output is correct
55 Correct 44 ms 58312 KB Output is correct
56 Correct 34 ms 58316 KB Output is correct
57 Correct 76 ms 59332 KB Output is correct
58 Correct 84 ms 59588 KB Output is correct
59 Correct 78 ms 59588 KB Output is correct
60 Correct 36 ms 58312 KB Output is correct
61 Correct 32 ms 58312 KB Output is correct
62 Correct 74 ms 59332 KB Output is correct
63 Correct 83 ms 59644 KB Output is correct
64 Correct 92 ms 59772 KB Output is correct
65 Correct 41 ms 58308 KB Output is correct
66 Correct 36 ms 58300 KB Output is correct
67 Correct 64 ms 59348 KB Output is correct
68 Correct 66 ms 59328 KB Output is correct
69 Correct 71 ms 59332 KB Output is correct
70 Correct 85 ms 59636 KB Output is correct
71 Correct 82 ms 59772 KB Output is correct
72 Correct 79 ms 59588 KB Output is correct
73 Correct 81 ms 59636 KB Output is correct
74 Correct 34 ms 58312 KB Output is correct
75 Correct 33 ms 58320 KB Output is correct
76 Correct 42 ms 58312 KB Output is correct
77 Correct 37 ms 58312 KB Output is correct
78 Correct 697 ms 59332 KB Output is correct
79 Correct 901 ms 59332 KB Output is correct
80 Correct 897 ms 59332 KB Output is correct
81 Correct 944 ms 59776 KB Output is correct
82 Correct 934 ms 59588 KB Output is correct
83 Correct 888 ms 59712 KB Output is correct
84 Correct 913 ms 59536 KB Output is correct
85 Correct 755 ms 58312 KB Output is correct
86 Correct 803 ms 58304 KB Output is correct
87 Correct 852 ms 58308 KB Output is correct
88 Correct 816 ms 58252 KB Output is correct
89 Correct 745 ms 58312 KB Output is correct
90 Correct 679 ms 58312 KB Output is correct
91 Correct 25 ms 55120 KB Output is correct
92 Correct 25 ms 55128 KB Output is correct
93 Correct 25 ms 55128 KB Output is correct
94 Correct 72 ms 59392 KB Output is correct
95 Correct 82 ms 59656 KB Output is correct
96 Correct 79 ms 59588 KB Output is correct
97 Correct 34 ms 58312 KB Output is correct
98 Correct 35 ms 58312 KB Output is correct
99 Correct 72 ms 59332 KB Output is correct
100 Correct 83 ms 59588 KB Output is correct
101 Correct 94 ms 59584 KB Output is correct
102 Correct 35 ms 58320 KB Output is correct
103 Correct 34 ms 58308 KB Output is correct
104 Correct 26 ms 55128 KB Output is correct
105 Correct 27 ms 55124 KB Output is correct
106 Correct 26 ms 55128 KB Output is correct
107 Correct 23 ms 55124 KB Output is correct
108 Correct 25 ms 55284 KB Output is correct
109 Correct 25 ms 55128 KB Output is correct
110 Correct 22 ms 55128 KB Output is correct
111 Correct 23 ms 55120 KB Output is correct
112 Correct 33 ms 55120 KB Output is correct
113 Correct 21 ms 55128 KB Output is correct
114 Correct 273 ms 56656 KB Output is correct
115 Correct 784 ms 59356 KB Output is correct
116 Correct 836 ms 59332 KB Output is correct
117 Correct 896 ms 59584 KB Output is correct
118 Correct 874 ms 59588 KB Output is correct
119 Correct 852 ms 59844 KB Output is correct
120 Correct 821 ms 59588 KB Output is correct
121 Correct 674 ms 58312 KB Output is correct
122 Correct 681 ms 58320 KB Output is correct
123 Correct 718 ms 58312 KB Output is correct
124 Correct 672 ms 58312 KB Output is correct
125 Correct 75 ms 59332 KB Output is correct
126 Correct 83 ms 59588 KB Output is correct
127 Correct 81 ms 59620 KB Output is correct
128 Correct 34 ms 58320 KB Output is correct
129 Correct 33 ms 58412 KB Output is correct
130 Correct 64 ms 59348 KB Output is correct
131 Correct 72 ms 59336 KB Output is correct
132 Correct 68 ms 59332 KB Output is correct
133 Correct 79 ms 59588 KB Output is correct
134 Correct 79 ms 59588 KB Output is correct
135 Correct 84 ms 59632 KB Output is correct
136 Correct 78 ms 59588 KB Output is correct
137 Correct 32 ms 58320 KB Output is correct
138 Correct 32 ms 58320 KB Output is correct
139 Correct 39 ms 58312 KB Output is correct
140 Correct 36 ms 58376 KB Output is correct
141 Correct 22 ms 55128 KB Output is correct
142 Correct 22 ms 55128 KB Output is correct
143 Correct 22 ms 55128 KB Output is correct
144 Correct 21 ms 55128 KB Output is correct
145 Correct 21 ms 55128 KB Output is correct
146 Correct 21 ms 55264 KB Output is correct
147 Correct 21 ms 55128 KB Output is correct
148 Correct 21 ms 55128 KB Output is correct
149 Correct 22 ms 55128 KB Output is correct
150 Correct 22 ms 55292 KB Output is correct
151 Correct 25 ms 55128 KB Output is correct
152 Correct 25 ms 55128 KB Output is correct
153 Correct 22 ms 55128 KB Output is correct
154 Correct 23 ms 55128 KB Output is correct
155 Correct 22 ms 55128 KB Output is correct
156 Correct 22 ms 55176 KB Output is correct
157 Correct 770 ms 59124 KB Output is correct
158 Correct 960 ms 59388 KB Output is correct
159 Correct 901 ms 59332 KB Output is correct
160 Correct 964 ms 59588 KB Output is correct
161 Correct 950 ms 59588 KB Output is correct
162 Correct 957 ms 59588 KB Output is correct
163 Correct 979 ms 59584 KB Output is correct
164 Correct 743 ms 58312 KB Output is correct
165 Correct 814 ms 58312 KB Output is correct
166 Correct 794 ms 58320 KB Output is correct
167 Correct 851 ms 58312 KB Output is correct
168 Correct 24 ms 55120 KB Output is correct
169 Correct 608 ms 57040 KB Output is correct
170 Correct 1079 ms 59588 KB Output is correct
171 Correct 1034 ms 59420 KB Output is correct
172 Correct 1032 ms 59648 KB Output is correct
173 Correct 1075 ms 59588 KB Output is correct
174 Correct 1058 ms 59604 KB Output is correct
175 Correct 1083 ms 59588 KB Output is correct
176 Correct 799 ms 58312 KB Output is correct
177 Correct 773 ms 58312 KB Output is correct
178 Correct 868 ms 58320 KB Output is correct
179 Correct 783 ms 58312 KB Output is correct