답안 #731614

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
731614 2023-04-27T16:45:09 Z PoonYaPat 송신탑 (IOI22_towers) C++17
100 / 100
1740 ms 61652 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int R[100010],L[100010],h[100010],n,s[1<<18];
pii sm[1<<18];
vector<pii> v;

void build_sm(int l, int r, int idx) {
    if (l==r) sm[idx]={h[l],l};
    else {
        int mid=(l+r)/2;
        build_sm(l,mid,2*idx);
        build_sm(mid+1,r,2*idx+1);

        if (sm[2*idx].first<=sm[2*idx+1].first) sm[idx]=sm[2*idx];
        else sm[idx]=sm[2*idx+1];
    }
}

pii query_sm(int l, int r, int idx, int x, int y) {
    if (x>r || y<l) return {INT_MAX,0};
    if (x<=l && r<=y) return sm[idx];
    int mid=(l+r)/2;
    pii LL=query_sm(l,mid,2*idx,x,y), RR=query_sm(mid+1,r,2*idx+1,x,y);
    if (LL.first<=RR.first) return LL;
    else return RR;
}

struct ss {
    int mmin,mmax,sl,sr;
} sg[1<<18]; // i<j -> sl = j-i, sr=i-j

ss merge(ss l, ss r) {
    if (l.mmin==-1 && r.mmin==-1) return {-1,0,0,0};
    if (l.mmin==-1) return r;
    if (r.mmin==-1) return l;

    ss ans;
    ans.mmax=max(l.mmax,r.mmax);
    ans.mmin=min(l.mmin,r.mmin);
    ans.sl=max({l.sl,r.sl,r.mmax-l.mmin});
    ans.sr=max({l.sr,r.sr,l.mmax-r.mmin});
    return ans;
}

void build_sg(int l, int r, int idx) {
    if (l==r) sg[idx]={h[l],h[l],0,0};
    else {
        int mid=(l+r)/2;
        build_sg(l,mid,2*idx);
        build_sg(mid+1,r,2*idx+1);
        sg[idx]=merge(sg[2*idx],sg[2*idx+1]);
    }
}

ss query_sg(int l, int r, int idx, int x, int y) {
    if (x>r || y<l) return {-1,0,0,0};
    if (x<=l && r<=y) return sg[idx];
    int mid=(l+r)/2;
    return merge(query_sg(l,mid,2*idx,x,y),query_sg(mid+1,r,2*idx+1,x,y));
}

struct node {
    int mmin,mmax,cnt;
    node *l, *r;

    node() : mmin(INT_MAX), mmax(-INT_MAX), cnt(0), l(NULL), r(NULL) {}

    node(int val) : mmin(val), mmax(val), cnt(1), l(NULL), r(NULL) {}

    node(node *L, node *R) : mmin(INT_MAX), mmax(-INT_MAX), cnt(0) , r(R), l(L) {
        if (L) {
            mmin=min(L->mmin,mmin);
            mmax=max(L->mmax,mmax);
            cnt+=L->cnt;
        }

        if (R) {
            mmin=min(R->mmin,mmin);
            mmax=max(R->mmax,mmax);
            cnt+=R->cnt;
        }
    }
};
typedef pair<int,node*> pin;
vector<pin> arr;

struct N {
    int mmin,mmax,cnt;
};

node* build(int l, int r) {
    if (l==r) return new node();
    int mid=(l+r)/2;
    return new node(build(l,mid),build(mid+1,r));
}

node* update(int l, int r, int x, node* pnode) {
    if (x>r || x<l) return pnode;
    if (l==r) return new node(l);
    int mid=(l+r)/2;
    return new node(update(l,mid,x,pnode->l),update(mid+1,r,x,pnode->r));
}

N query(int l, int r, int x, int y, node *pnode) {
    if (x>r || y<l) return {INT_MAX,-INT_MAX,0};
    if (x<=l && r<=y) return {pnode->mmin,pnode->mmax,pnode->cnt};
    int mid=(l+r)/2;
    N ans,L=query(l,mid,x,y,pnode->l),R=query(mid+1,r,x,y,pnode->r);
    ans.mmax=max(L.mmax,R.mmax);
    ans.mmin=min(L.mmin,R.mmin);
    ans.cnt=L.cnt+R.cnt;
    return ans;
}

void build_s(int l, int r, int idx) {
    if (l==r) s[idx]=h[l];
    else {
        int mid=(l+r)/2;
        build_s(l,mid,2*idx);
        build_s(mid+1,r,2*idx+1);
        s[idx]=max(s[2*idx],s[2*idx+1]);
    }
}

int query_s(int l, int r, int idx, int x, int y) {
    if (x>r || y<l) return 0;
    if (x<=l && r<=y) return s[idx];
    int mid=(l+r)/2;
    return max(query_s(l,mid,2*idx,x,y),query_s(mid+1,r,2*idx+1,x,y));
}

void init(int N, vector<int> H) {
    n=N;
    for (int i=0; i<n; ++i) h[i+1]=H[i];

    L[1]=0;
    for (int i=2; i<=n; ++i) {
        int idx=i-1;
        while (h[idx]>=h[i] && idx!=-1) idx=L[idx];
        L[i]=idx;
    }

    R[n]=n+1;
    for (int i=n-1; i>=1; --i) {
        int idx=i+1;
        while (h[idx]>=h[i] && idx!=-1) idx=R[idx];
        R[i]=idx;
    }

    build_s(1,n,1);
    build_sg(1,n,1);
    build_sm(1,n,1);

    for (int i=1; i<=n; ++i) {
        int h1=-1,h2=-1;
        if (L[i]+1<=i-1) h1=query_s(1,n,1,L[i]+1,i-1);
        if (i+1<=R[i]-1) h2=query_s(1,n,1,i+1,R[i]-1);

        if (L[i]==0) h1=INT_MAX;
        if (R[i]==n+1) h2=INT_MAX;

        if (h1!=-1 && h2!=-1) v.push_back(pii(min(h1,h2)-h[i],i));
    }

    sort(v.begin(),v.end(),greater<pii>());

    arr.push_back(pin(INT_MAX,build(1,n)));

    for (int i=0; i<v.size(); ++i) {
        node* pnode=update(1,n,v[i].second,arr.back().second);
        if (arr.back().first==v[i].first) arr.pop_back();
        arr.push_back(pin(v[i].first,pnode));
    }
}

int max_towers(int Le, int Ri, int D) {
    ++Le; ++Ri;

    int l=0, r=arr.size()-1;
    while (l<r) {
        int mid=(l+r+1)/2;
        if (arr[mid].first>=D) l=mid;
        else r=mid-1;
    }

    N res=query(1,n,Le,Ri,arr[l].second);
    int cnt=res.cnt,mi=res.mmin,ma=res.mmax;
    if (cnt==0) {
        ++cnt;
        int sm=query_sm(1,n,1,Le,Ri).second;
        if (sm+1<=Ri && query_sg(1,n,1,sm+1,Ri).sr>=D) ++cnt;
        if (Le<=sm-1 && query_sg(1,n,1,Le,sm-1).sl>=D) ++cnt;
        return cnt;
    }

    int LL=-1;
    if (mi!=Le && query_s(1,n,1,Le,mi-1)>=h[mi]+D) {
        l=Le; r=mi-1;
        while (l<r) {
            int mid=(l+r+1)/2;
            if (query_s(1,n,1,mid,mi-1)>=h[mi]+D) l=mid;
            else r=mid-1;
        }
        LL=l;
    }
    if (LL!=-1 && query_sg(1,n,1,Le,LL).sl>=D) ++cnt;

    int RR=-1;
    if (ma!=Ri && query_s(1,n,1,ma+1,Ri)>=h[ma]+D) {
        l=ma+1; r=Ri;
        while (l<r) {
            int mid=(l+r)/2;
            if (query_s(1,n,1,ma+1,mid)>=h[ma]+D) r=mid;
            else l=mid+1;
        }
        RR=l;
    }
    if (RR!=-1 && query_sg(1,n,1,RR,Ri).sr>=D) ++cnt;

    return cnt;
}

Compilation message

towers.cpp: In constructor 'node::node(node*, node*)':
towers.cpp:67:15: warning: 'node::r' will be initialized after [-Wreorder]
   67 |     node *l, *r;
      |               ^
towers.cpp:67:11: warning:   'node* node::l' [-Wreorder]
   67 |     node *l, *r;
      |           ^
towers.cpp:73:5: warning:   when initialized here [-Wreorder]
   73 |     node(node *L, node *R) : mmin(INT_MAX), mmax(-INT_MAX), cnt(0) , r(R), l(L) {
      |     ^~~~
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:172:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  172 |     for (int i=0; i<v.size(); ++i) {
      |                   ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 487 ms 10612 KB Output is correct
2 Correct 1109 ms 18728 KB Output is correct
3 Correct 1116 ms 18732 KB Output is correct
4 Correct 994 ms 18740 KB Output is correct
5 Correct 1025 ms 18732 KB Output is correct
6 Correct 1072 ms 18768 KB Output is correct
7 Correct 1048 ms 18760 KB Output is correct
8 Correct 1 ms 220 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 976 KB Output is correct
3 Correct 2 ms 976 KB Output is correct
4 Correct 2 ms 1232 KB Output is correct
5 Correct 2 ms 1232 KB Output is correct
6 Correct 3 ms 1232 KB Output is correct
7 Correct 2 ms 1232 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 592 KB Output is correct
15 Correct 3 ms 976 KB Output is correct
16 Correct 3 ms 1232 KB Output is correct
17 Correct 2 ms 1232 KB Output is correct
18 Correct 1 ms 592 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 1232 KB Output is correct
22 Correct 3 ms 1232 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 3 ms 976 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 2 ms 1232 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 2 ms 1232 KB Output is correct
32 Correct 2 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 976 KB Output is correct
3 Correct 2 ms 976 KB Output is correct
4 Correct 2 ms 1232 KB Output is correct
5 Correct 2 ms 1232 KB Output is correct
6 Correct 3 ms 1232 KB Output is correct
7 Correct 2 ms 1232 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 592 KB Output is correct
15 Correct 3 ms 976 KB Output is correct
16 Correct 3 ms 1232 KB Output is correct
17 Correct 2 ms 1232 KB Output is correct
18 Correct 1 ms 592 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 1232 KB Output is correct
22 Correct 3 ms 1232 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 3 ms 976 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 2 ms 1232 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 2 ms 1232 KB Output is correct
32 Correct 2 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 52 ms 28960 KB Output is correct
37 Correct 93 ms 47428 KB Output is correct
38 Correct 103 ms 47324 KB Output is correct
39 Correct 115 ms 61472 KB Output is correct
40 Correct 118 ms 61500 KB Output is correct
41 Correct 127 ms 61468 KB Output is correct
42 Correct 115 ms 61460 KB Output is correct
43 Correct 36 ms 18768 KB Output is correct
44 Correct 47 ms 18752 KB Output is correct
45 Correct 47 ms 18740 KB Output is correct
46 Correct 46 ms 18728 KB Output is correct
47 Correct 101 ms 47284 KB Output is correct
48 Correct 124 ms 61652 KB Output is correct
49 Correct 127 ms 61540 KB Output is correct
50 Correct 38 ms 18760 KB Output is correct
51 Correct 38 ms 18760 KB Output is correct
52 Correct 93 ms 47348 KB Output is correct
53 Correct 123 ms 61472 KB Output is correct
54 Correct 137 ms 61500 KB Output is correct
55 Correct 45 ms 18752 KB Output is correct
56 Correct 42 ms 18824 KB Output is correct
57 Correct 86 ms 45976 KB Output is correct
58 Correct 92 ms 47416 KB Output is correct
59 Correct 114 ms 47276 KB Output is correct
60 Correct 125 ms 61468 KB Output is correct
61 Correct 118 ms 61612 KB Output is correct
62 Correct 151 ms 61516 KB Output is correct
63 Correct 111 ms 61476 KB Output is correct
64 Correct 36 ms 18760 KB Output is correct
65 Correct 41 ms 18724 KB Output is correct
66 Correct 43 ms 18732 KB Output is correct
67 Correct 49 ms 18892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1022 ms 47140 KB Output is correct
2 Correct 1296 ms 47324 KB Output is correct
3 Correct 1165 ms 47272 KB Output is correct
4 Correct 1238 ms 61500 KB Output is correct
5 Correct 1302 ms 61488 KB Output is correct
6 Correct 1312 ms 61472 KB Output is correct
7 Correct 1223 ms 61500 KB Output is correct
8 Correct 1063 ms 18760 KB Output is correct
9 Correct 1189 ms 18836 KB Output is correct
10 Correct 1740 ms 18792 KB Output is correct
11 Correct 1709 ms 18764 KB Output is correct
12 Correct 1244 ms 18772 KB Output is correct
13 Correct 1239 ms 18732 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 2 ms 592 KB Output is correct
17 Correct 90 ms 47232 KB Output is correct
18 Correct 119 ms 61532 KB Output is correct
19 Correct 115 ms 61472 KB Output is correct
20 Correct 40 ms 18736 KB Output is correct
21 Correct 41 ms 18744 KB Output is correct
22 Correct 116 ms 47348 KB Output is correct
23 Correct 119 ms 61520 KB Output is correct
24 Correct 113 ms 61492 KB Output is correct
25 Correct 35 ms 18860 KB Output is correct
26 Correct 44 ms 18772 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 2 ms 1160 KB Output is correct
30 Correct 1 ms 592 KB Output is correct
31 Correct 2 ms 592 KB Output is correct
32 Correct 2 ms 976 KB Output is correct
33 Correct 2 ms 1232 KB Output is correct
34 Correct 2 ms 1232 KB Output is correct
35 Correct 2 ms 592 KB Output is correct
36 Correct 1 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 359 ms 10892 KB Output is correct
2 Correct 1074 ms 47288 KB Output is correct
3 Correct 1233 ms 47264 KB Output is correct
4 Correct 1077 ms 61492 KB Output is correct
5 Correct 1046 ms 61484 KB Output is correct
6 Correct 1200 ms 61472 KB Output is correct
7 Correct 990 ms 61492 KB Output is correct
8 Correct 1470 ms 18760 KB Output is correct
9 Correct 1394 ms 18740 KB Output is correct
10 Correct 1160 ms 18772 KB Output is correct
11 Correct 1196 ms 18764 KB Output is correct
12 Correct 88 ms 47292 KB Output is correct
13 Correct 118 ms 61504 KB Output is correct
14 Correct 113 ms 61600 KB Output is correct
15 Correct 38 ms 18760 KB Output is correct
16 Correct 41 ms 18776 KB Output is correct
17 Correct 82 ms 45864 KB Output is correct
18 Correct 95 ms 47320 KB Output is correct
19 Correct 94 ms 47364 KB Output is correct
20 Correct 112 ms 61448 KB Output is correct
21 Correct 114 ms 61456 KB Output is correct
22 Correct 112 ms 61440 KB Output is correct
23 Correct 108 ms 61564 KB Output is correct
24 Correct 35 ms 18784 KB Output is correct
25 Correct 42 ms 18776 KB Output is correct
26 Correct 51 ms 18812 KB Output is correct
27 Correct 36 ms 18764 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 3 ms 1232 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 2 ms 592 KB Output is correct
32 Correct 1 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 2 ms 976 KB Output is correct
35 Correct 2 ms 976 KB Output is correct
36 Correct 2 ms 1232 KB Output is correct
37 Correct 2 ms 1232 KB Output is correct
38 Correct 2 ms 1232 KB Output is correct
39 Correct 2 ms 1232 KB Output is correct
40 Correct 1 ms 592 KB Output is correct
41 Correct 1 ms 592 KB Output is correct
42 Correct 1 ms 592 KB Output is correct
43 Correct 1 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 976 KB Output is correct
3 Correct 2 ms 976 KB Output is correct
4 Correct 2 ms 1232 KB Output is correct
5 Correct 2 ms 1232 KB Output is correct
6 Correct 3 ms 1232 KB Output is correct
7 Correct 2 ms 1232 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 592 KB Output is correct
14 Correct 2 ms 592 KB Output is correct
15 Correct 3 ms 976 KB Output is correct
16 Correct 3 ms 1232 KB Output is correct
17 Correct 2 ms 1232 KB Output is correct
18 Correct 1 ms 592 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 1232 KB Output is correct
22 Correct 3 ms 1232 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 3 ms 976 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 2 ms 1232 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 2 ms 1232 KB Output is correct
32 Correct 2 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 52 ms 28960 KB Output is correct
37 Correct 93 ms 47428 KB Output is correct
38 Correct 103 ms 47324 KB Output is correct
39 Correct 115 ms 61472 KB Output is correct
40 Correct 118 ms 61500 KB Output is correct
41 Correct 127 ms 61468 KB Output is correct
42 Correct 115 ms 61460 KB Output is correct
43 Correct 36 ms 18768 KB Output is correct
44 Correct 47 ms 18752 KB Output is correct
45 Correct 47 ms 18740 KB Output is correct
46 Correct 46 ms 18728 KB Output is correct
47 Correct 101 ms 47284 KB Output is correct
48 Correct 124 ms 61652 KB Output is correct
49 Correct 127 ms 61540 KB Output is correct
50 Correct 38 ms 18760 KB Output is correct
51 Correct 38 ms 18760 KB Output is correct
52 Correct 93 ms 47348 KB Output is correct
53 Correct 123 ms 61472 KB Output is correct
54 Correct 137 ms 61500 KB Output is correct
55 Correct 45 ms 18752 KB Output is correct
56 Correct 42 ms 18824 KB Output is correct
57 Correct 86 ms 45976 KB Output is correct
58 Correct 92 ms 47416 KB Output is correct
59 Correct 114 ms 47276 KB Output is correct
60 Correct 125 ms 61468 KB Output is correct
61 Correct 118 ms 61612 KB Output is correct
62 Correct 151 ms 61516 KB Output is correct
63 Correct 111 ms 61476 KB Output is correct
64 Correct 36 ms 18760 KB Output is correct
65 Correct 41 ms 18724 KB Output is correct
66 Correct 43 ms 18732 KB Output is correct
67 Correct 49 ms 18892 KB Output is correct
68 Correct 1022 ms 47140 KB Output is correct
69 Correct 1296 ms 47324 KB Output is correct
70 Correct 1165 ms 47272 KB Output is correct
71 Correct 1238 ms 61500 KB Output is correct
72 Correct 1302 ms 61488 KB Output is correct
73 Correct 1312 ms 61472 KB Output is correct
74 Correct 1223 ms 61500 KB Output is correct
75 Correct 1063 ms 18760 KB Output is correct
76 Correct 1189 ms 18836 KB Output is correct
77 Correct 1740 ms 18792 KB Output is correct
78 Correct 1709 ms 18764 KB Output is correct
79 Correct 1244 ms 18772 KB Output is correct
80 Correct 1239 ms 18732 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 1 ms 592 KB Output is correct
83 Correct 2 ms 592 KB Output is correct
84 Correct 90 ms 47232 KB Output is correct
85 Correct 119 ms 61532 KB Output is correct
86 Correct 115 ms 61472 KB Output is correct
87 Correct 40 ms 18736 KB Output is correct
88 Correct 41 ms 18744 KB Output is correct
89 Correct 116 ms 47348 KB Output is correct
90 Correct 119 ms 61520 KB Output is correct
91 Correct 113 ms 61492 KB Output is correct
92 Correct 35 ms 18860 KB Output is correct
93 Correct 44 ms 18772 KB Output is correct
94 Correct 2 ms 976 KB Output is correct
95 Correct 2 ms 1232 KB Output is correct
96 Correct 2 ms 1160 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 2 ms 592 KB Output is correct
99 Correct 2 ms 976 KB Output is correct
100 Correct 2 ms 1232 KB Output is correct
101 Correct 2 ms 1232 KB Output is correct
102 Correct 2 ms 592 KB Output is correct
103 Correct 1 ms 592 KB Output is correct
104 Correct 1018 ms 42632 KB Output is correct
105 Correct 1318 ms 47268 KB Output is correct
106 Correct 1280 ms 47292 KB Output is correct
107 Correct 1305 ms 61420 KB Output is correct
108 Correct 1430 ms 61500 KB Output is correct
109 Correct 1179 ms 61492 KB Output is correct
110 Correct 1304 ms 61468 KB Output is correct
111 Correct 1000 ms 18760 KB Output is correct
112 Correct 1214 ms 18776 KB Output is correct
113 Correct 1254 ms 18756 KB Output is correct
114 Correct 1484 ms 18732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 487 ms 10612 KB Output is correct
2 Correct 1109 ms 18728 KB Output is correct
3 Correct 1116 ms 18732 KB Output is correct
4 Correct 994 ms 18740 KB Output is correct
5 Correct 1025 ms 18732 KB Output is correct
6 Correct 1072 ms 18768 KB Output is correct
7 Correct 1048 ms 18760 KB Output is correct
8 Correct 1 ms 220 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 2 ms 976 KB Output is correct
13 Correct 2 ms 976 KB Output is correct
14 Correct 2 ms 1232 KB Output is correct
15 Correct 2 ms 1232 KB Output is correct
16 Correct 3 ms 1232 KB Output is correct
17 Correct 2 ms 1232 KB Output is correct
18 Correct 1 ms 592 KB Output is correct
19 Correct 2 ms 592 KB Output is correct
20 Correct 2 ms 592 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 2 ms 592 KB Output is correct
24 Correct 2 ms 592 KB Output is correct
25 Correct 3 ms 976 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 2 ms 1232 KB Output is correct
28 Correct 1 ms 592 KB Output is correct
29 Correct 1 ms 592 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 2 ms 1232 KB Output is correct
32 Correct 3 ms 1232 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 3 ms 976 KB Output is correct
37 Correct 2 ms 976 KB Output is correct
38 Correct 2 ms 1232 KB Output is correct
39 Correct 2 ms 1232 KB Output is correct
40 Correct 2 ms 1232 KB Output is correct
41 Correct 2 ms 1232 KB Output is correct
42 Correct 2 ms 592 KB Output is correct
43 Correct 1 ms 592 KB Output is correct
44 Correct 1 ms 592 KB Output is correct
45 Correct 1 ms 592 KB Output is correct
46 Correct 52 ms 28960 KB Output is correct
47 Correct 93 ms 47428 KB Output is correct
48 Correct 103 ms 47324 KB Output is correct
49 Correct 115 ms 61472 KB Output is correct
50 Correct 118 ms 61500 KB Output is correct
51 Correct 127 ms 61468 KB Output is correct
52 Correct 115 ms 61460 KB Output is correct
53 Correct 36 ms 18768 KB Output is correct
54 Correct 47 ms 18752 KB Output is correct
55 Correct 47 ms 18740 KB Output is correct
56 Correct 46 ms 18728 KB Output is correct
57 Correct 101 ms 47284 KB Output is correct
58 Correct 124 ms 61652 KB Output is correct
59 Correct 127 ms 61540 KB Output is correct
60 Correct 38 ms 18760 KB Output is correct
61 Correct 38 ms 18760 KB Output is correct
62 Correct 93 ms 47348 KB Output is correct
63 Correct 123 ms 61472 KB Output is correct
64 Correct 137 ms 61500 KB Output is correct
65 Correct 45 ms 18752 KB Output is correct
66 Correct 42 ms 18824 KB Output is correct
67 Correct 86 ms 45976 KB Output is correct
68 Correct 92 ms 47416 KB Output is correct
69 Correct 114 ms 47276 KB Output is correct
70 Correct 125 ms 61468 KB Output is correct
71 Correct 118 ms 61612 KB Output is correct
72 Correct 151 ms 61516 KB Output is correct
73 Correct 111 ms 61476 KB Output is correct
74 Correct 36 ms 18760 KB Output is correct
75 Correct 41 ms 18724 KB Output is correct
76 Correct 43 ms 18732 KB Output is correct
77 Correct 49 ms 18892 KB Output is correct
78 Correct 1022 ms 47140 KB Output is correct
79 Correct 1296 ms 47324 KB Output is correct
80 Correct 1165 ms 47272 KB Output is correct
81 Correct 1238 ms 61500 KB Output is correct
82 Correct 1302 ms 61488 KB Output is correct
83 Correct 1312 ms 61472 KB Output is correct
84 Correct 1223 ms 61500 KB Output is correct
85 Correct 1063 ms 18760 KB Output is correct
86 Correct 1189 ms 18836 KB Output is correct
87 Correct 1740 ms 18792 KB Output is correct
88 Correct 1709 ms 18764 KB Output is correct
89 Correct 1244 ms 18772 KB Output is correct
90 Correct 1239 ms 18732 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 1 ms 592 KB Output is correct
93 Correct 2 ms 592 KB Output is correct
94 Correct 90 ms 47232 KB Output is correct
95 Correct 119 ms 61532 KB Output is correct
96 Correct 115 ms 61472 KB Output is correct
97 Correct 40 ms 18736 KB Output is correct
98 Correct 41 ms 18744 KB Output is correct
99 Correct 116 ms 47348 KB Output is correct
100 Correct 119 ms 61520 KB Output is correct
101 Correct 113 ms 61492 KB Output is correct
102 Correct 35 ms 18860 KB Output is correct
103 Correct 44 ms 18772 KB Output is correct
104 Correct 2 ms 976 KB Output is correct
105 Correct 2 ms 1232 KB Output is correct
106 Correct 2 ms 1160 KB Output is correct
107 Correct 1 ms 592 KB Output is correct
108 Correct 2 ms 592 KB Output is correct
109 Correct 2 ms 976 KB Output is correct
110 Correct 2 ms 1232 KB Output is correct
111 Correct 2 ms 1232 KB Output is correct
112 Correct 2 ms 592 KB Output is correct
113 Correct 1 ms 592 KB Output is correct
114 Correct 359 ms 10892 KB Output is correct
115 Correct 1074 ms 47288 KB Output is correct
116 Correct 1233 ms 47264 KB Output is correct
117 Correct 1077 ms 61492 KB Output is correct
118 Correct 1046 ms 61484 KB Output is correct
119 Correct 1200 ms 61472 KB Output is correct
120 Correct 990 ms 61492 KB Output is correct
121 Correct 1470 ms 18760 KB Output is correct
122 Correct 1394 ms 18740 KB Output is correct
123 Correct 1160 ms 18772 KB Output is correct
124 Correct 1196 ms 18764 KB Output is correct
125 Correct 88 ms 47292 KB Output is correct
126 Correct 118 ms 61504 KB Output is correct
127 Correct 113 ms 61600 KB Output is correct
128 Correct 38 ms 18760 KB Output is correct
129 Correct 41 ms 18776 KB Output is correct
130 Correct 82 ms 45864 KB Output is correct
131 Correct 95 ms 47320 KB Output is correct
132 Correct 94 ms 47364 KB Output is correct
133 Correct 112 ms 61448 KB Output is correct
134 Correct 114 ms 61456 KB Output is correct
135 Correct 112 ms 61440 KB Output is correct
136 Correct 108 ms 61564 KB Output is correct
137 Correct 35 ms 18784 KB Output is correct
138 Correct 42 ms 18776 KB Output is correct
139 Correct 51 ms 18812 KB Output is correct
140 Correct 36 ms 18764 KB Output is correct
141 Correct 2 ms 976 KB Output is correct
142 Correct 3 ms 1232 KB Output is correct
143 Correct 2 ms 1232 KB Output is correct
144 Correct 2 ms 592 KB Output is correct
145 Correct 1 ms 592 KB Output is correct
146 Correct 1 ms 592 KB Output is correct
147 Correct 2 ms 976 KB Output is correct
148 Correct 2 ms 976 KB Output is correct
149 Correct 2 ms 1232 KB Output is correct
150 Correct 2 ms 1232 KB Output is correct
151 Correct 2 ms 1232 KB Output is correct
152 Correct 2 ms 1232 KB Output is correct
153 Correct 1 ms 592 KB Output is correct
154 Correct 1 ms 592 KB Output is correct
155 Correct 1 ms 592 KB Output is correct
156 Correct 1 ms 592 KB Output is correct
157 Correct 1018 ms 42632 KB Output is correct
158 Correct 1318 ms 47268 KB Output is correct
159 Correct 1280 ms 47292 KB Output is correct
160 Correct 1305 ms 61420 KB Output is correct
161 Correct 1430 ms 61500 KB Output is correct
162 Correct 1179 ms 61492 KB Output is correct
163 Correct 1304 ms 61468 KB Output is correct
164 Correct 1000 ms 18760 KB Output is correct
165 Correct 1214 ms 18776 KB Output is correct
166 Correct 1254 ms 18756 KB Output is correct
167 Correct 1484 ms 18732 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 954 ms 16880 KB Output is correct
170 Correct 1327 ms 47296 KB Output is correct
171 Correct 1438 ms 47260 KB Output is correct
172 Correct 1476 ms 61500 KB Output is correct
173 Correct 1333 ms 61500 KB Output is correct
174 Correct 1457 ms 61420 KB Output is correct
175 Correct 1475 ms 61476 KB Output is correct
176 Correct 1185 ms 18760 KB Output is correct
177 Correct 1115 ms 18760 KB Output is correct
178 Correct 1411 ms 18732 KB Output is correct
179 Correct 1491 ms 18728 KB Output is correct