#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dbg(...) printf(__VA_ARGS__);
#define getchar_unlocked getchar
#else
#define dbg(...)
#endif
#define sf scanf
#define pf printf
#define fi first
#define se second
#define pb push_back
#define psf push_front
#define ppb pop_back
#define ppf pop_front
#define sz(x) (int)x.size()
#define mnto(x,y) x=min(x,(__typeof__(x))y)
#define mxto(x,y) x=max(x,(__typeof__(x))y)
#define INF 1023456789
#define LINF 1023456789123456789
#define all(x) x.begin(),x.end()
#define lb(x,v) (lower_bound(all(x),v)-x.begin())
#define ub(x,v) (upper_bound(all(x),v)-x.begin())
#define disc(x) sort(all(x));x.resize(unique(all(x))-x.begin());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef pair<int,ii> iii;
typedef tuple<int,int,int,int> iiii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
mt19937 rng(time(0));
#define mod 1000000007
#define maxn 100005
struct node{
int s,e,m,v=0,mn=0,mx=0,mnd=0,mxd=0;
node *l,*r;
node(int _s,int _e){
s=_s;e=_e;m=(s+e)>>1;
if(s!=e)l=new node(s,m),r=new node(m+1,e);
}
void up(int x,int nv){
if(s==x&&e==x){
v=mn=mx=nv;
return;
}
if(x<=m)l->up(x,nv);
else r->up(x,nv);
mn=min(l->mn,r->mn);
mx=max(l->mx,r->mx);
mnd=min(min(l->mnd,r->mnd),r->mn-l->mx);
mxd=max(max(l->mxd,r->mxd),r->mx-l->mn);
}
int qmx(int x,int y){
if(s==x&&e==y)return mx;
if(y<=m)return l->qmx(x,y);
if(x>m)return r->qmx(x,y);
return max(l->qmx(x,m),r->qmx(m+1,y));
}
int qmn(int x,int y){
if(s==x&&e==y)return mn;
if(y<=m)return l->qmn(x,y);
if(x>m)return r->qmn(x,y);
return min(l->qmn(x,m),r->qmn(m+1,y));
}
iii qmxd(int x,int y){
if(s==x&&e==y)return {mxd,{mn,mx}};
if(y<=m)return l->qmxd(x,y);
if(x>m)return r->qmxd(x,y);
iii p1=qmxd(x,m),p2=qmxd(m+1,y);
int mxd=max(max(p1.fi,p2.fi),p2.se.se-p1.se.fi);
int mx=max(p1.se.se,p2.se.se);
int mn=min(p1.se.fi,p2.se.fi);
return {mxd,{mn,mx}};
}
iii qmnd(int x,int y){
if(s==x&&e==y)return {mnd,{mn,mx}};
if(y<=m)return l->qmnd(x,y);
if(x>m)return r->qmnd(x,y);
iii p1=qmnd(x,m),p2=qmnd(m+1,y);
int mnd=min(min(p1.fi,p2.fi),p2.se.fi-p1.se.se);
int mx=max(p1.se.se,p2.se.se);
int mn=min(p1.se.fi,p2.se.fi);
return {mnd,{mn,mx}};
}
int findr(int x,int y,int d){
if(s==x&&e==y){
if(mx<d)return -1;
if(s==e)return s;
if(r->mx>=d)return r->findr(m+1,y,d);
else return l->findr(x,m,d);
}
if(y<=m)return l->findr(x,y,d);
if(x>m)return r->findr(x,y,d);
int tmp=r->findr(m+1,y,d);
if(tmp!=-1)return tmp;
return l->findr(x,m,d);
}
int findl(int x,int y,int d){
if(s==x&&e==y){
if(mx<d)return -1;
if(s==e)return s;
if(l->mx>=d)return l->findl(x,m,d);
else return r->findl(m+1,y,d);
}
if(y<=m)return l->findl(x,y,d);
if(x>m)return r->findl(x,y,d);
int tmp=l->findl(x,m,d);
if(tmp!=-1)return tmp;
return r->findl(m+1,y,d);
}
}*seg;
struct node2{
int s,e,m,v=-1,mn=INF,mx=-1,cnt=0;
node2 *l,*r;
node2(int _s,int _e){
s=_s;e=_e;m=(s+e)>>1;
if(s!=e)l=new node2(s,m),r=new node2(m+1,e);
}
node2(node2 *n){
s=n->s,e=n->e,m=(s+e)>>1;
v=n->v,mn=n->mn,mx=n->mx,cnt=n->cnt;
l=n->l,r=n->r;
}
void up(int x,int nv){
if(s==x&&e==x){
v=mn=mx=nv;
cnt=1;
return;
}
if(x<=m){
l=new node2(l);
l->up(x,nv);
}
else{
r=new node2(r);
r->up(x,nv);
}
mx=max(l->mx,r->mx);
mn=min(l->mn,r->mn);
cnt=l->cnt+r->cnt;
}
int qmn(int x,int y){
if(s==x&&e==y)return mn;
if(y<=m)return l->qmn(x,y);
if(x>m)return r->qmn(x,y);
return min(l->qmn(x,m),r->qmn(m+1,y));
}
int qmx(int x,int y){
if(s==x&&e==y)return mx;
if(y<=m)return l->qmx(x,y);
if(x>m)return r->qmx(x,y);
return max(l->qmx(x,m),r->qmx(m+1,y));
}
int qcnt(int x,int y){
if(s==x&&e==y)return cnt;
if(y<=m)return l->qcnt(x,y);
if(x>m)return r->qcnt(x,y);
return l->qcnt(x,m)+r->qcnt(m+1,y);
}
}*root[maxn];
int ls[maxn],rs[maxn],delta[maxn];
vector<int> h;
vector<ii> d;
void init(int N,vector<int> H){
h=H;
seg=new node(0,N-1);
for(int i=0;i<N;++i)seg->up(i,H[i]);
stack<int> st;
for(int i=0;i<N;++i){
while(!st.empty()&&H[st.top()]>H[i])st.pop();
if(st.empty())ls[i]=-1;
else ls[i]=st.top();
st.push(i);
}
while(!st.empty())st.pop();
for(int i=N-1;i>=0;--i){
while(!st.empty()&&H[st.top()]>H[i])st.pop();
if(st.empty())rs[i]=-1;
else rs[i]=st.top();
st.push(i);
}
for(int i=0;i<N;++i){
int a,b;
if(ls[i]!=-1)a=seg->qmx(ls[i],i);
else a=INF;
if(rs[i]!=-1)b=seg->qmx(i,rs[i]);
else b=INF;
delta[i]=min(a,b)-H[i];
d.pb({delta[i],i});
}
sort(all(d));
root[N]=new node2(0,N-1);
for(int i=N-1;i>=0;--i){
root[i]=new node2(root[i+1]);
int x=d[i].se;
root[i]->up(x,x);
}
}
int max_towers(int L,int R,int D){
int id=lb(d,ii(D,0));
int num=0;
int l=root[id]->qmn(L,R);
int r=root[id]->qmx(L,R);
if(l==INF){
int lo=L,hi=R,mid,res=R;
while(lo<=hi){
mid=(lo+hi)>>1;
if(seg->qmxd(L,mid).fi>=D)res=mid,hi=mid-1;
else lo=mid+1;
}
if(seg->qmnd(res,R).fi<=-D)return 2;
return 1;
}
int ans=root[id]->qcnt(L,R);
int li=seg->findr(L,l,h[l]+D);
if(li!=-1&&seg->qmxd(L,li).fi>=D)++ans;
int ri=seg->findl(r,R,h[r]+D);
if(ri!=-1&&seg->qmnd(ri,R).fi<=-D)++ans;
return ans;
}
Compilation message
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:213:6: warning: unused variable 'num' [-Wunused-variable]
213 | int num=0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
846 ms |
80656 KB |
Output is correct |
2 |
Correct |
1927 ms |
140048 KB |
Output is correct |
3 |
Correct |
2016 ms |
140056 KB |
Output is correct |
4 |
Correct |
1821 ms |
139996 KB |
Output is correct |
5 |
Correct |
1906 ms |
140452 KB |
Output is correct |
6 |
Correct |
1719 ms |
139968 KB |
Output is correct |
7 |
Correct |
1787 ms |
140484 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
3 ms |
2384 KB |
Output is correct |
10 |
Correct |
3 ms |
2400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
3 ms |
2384 KB |
Output is correct |
5 |
Correct |
3 ms |
2364 KB |
Output is correct |
6 |
Correct |
3 ms |
2384 KB |
Output is correct |
7 |
Correct |
3 ms |
2384 KB |
Output is correct |
8 |
Correct |
2 ms |
2356 KB |
Output is correct |
9 |
Correct |
2 ms |
2384 KB |
Output is correct |
10 |
Correct |
3 ms |
2384 KB |
Output is correct |
11 |
Correct |
3 ms |
2384 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
2384 KB |
Output is correct |
14 |
Correct |
2 ms |
2320 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2388 KB |
Output is correct |
17 |
Correct |
3 ms |
2388 KB |
Output is correct |
18 |
Correct |
2 ms |
2388 KB |
Output is correct |
19 |
Correct |
3 ms |
2384 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
3 ms |
2392 KB |
Output is correct |
22 |
Correct |
3 ms |
2384 KB |
Output is correct |
23 |
Correct |
2 ms |
2384 KB |
Output is correct |
24 |
Correct |
3 ms |
2384 KB |
Output is correct |
25 |
Correct |
1 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2304 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
3 ms |
2400 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
3 ms |
2284 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
3 ms |
2384 KB |
Output is correct |
34 |
Correct |
3 ms |
2312 KB |
Output is correct |
35 |
Correct |
3 ms |
2384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
3 ms |
2384 KB |
Output is correct |
5 |
Correct |
3 ms |
2364 KB |
Output is correct |
6 |
Correct |
3 ms |
2384 KB |
Output is correct |
7 |
Correct |
3 ms |
2384 KB |
Output is correct |
8 |
Correct |
2 ms |
2356 KB |
Output is correct |
9 |
Correct |
2 ms |
2384 KB |
Output is correct |
10 |
Correct |
3 ms |
2384 KB |
Output is correct |
11 |
Correct |
3 ms |
2384 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
2384 KB |
Output is correct |
14 |
Correct |
2 ms |
2320 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2388 KB |
Output is correct |
17 |
Correct |
3 ms |
2388 KB |
Output is correct |
18 |
Correct |
2 ms |
2388 KB |
Output is correct |
19 |
Correct |
3 ms |
2384 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
3 ms |
2392 KB |
Output is correct |
22 |
Correct |
3 ms |
2384 KB |
Output is correct |
23 |
Correct |
2 ms |
2384 KB |
Output is correct |
24 |
Correct |
3 ms |
2384 KB |
Output is correct |
25 |
Correct |
1 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2304 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
3 ms |
2400 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
3 ms |
2284 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
3 ms |
2384 KB |
Output is correct |
34 |
Correct |
3 ms |
2312 KB |
Output is correct |
35 |
Correct |
3 ms |
2384 KB |
Output is correct |
36 |
Correct |
118 ms |
88460 KB |
Output is correct |
37 |
Correct |
187 ms |
139960 KB |
Output is correct |
38 |
Correct |
188 ms |
139944 KB |
Output is correct |
39 |
Correct |
208 ms |
139992 KB |
Output is correct |
40 |
Correct |
185 ms |
139944 KB |
Output is correct |
41 |
Correct |
198 ms |
140032 KB |
Output is correct |
42 |
Correct |
183 ms |
140112 KB |
Output is correct |
43 |
Correct |
139 ms |
139944 KB |
Output is correct |
44 |
Correct |
141 ms |
140408 KB |
Output is correct |
45 |
Correct |
169 ms |
140208 KB |
Output is correct |
46 |
Correct |
148 ms |
140204 KB |
Output is correct |
47 |
Correct |
174 ms |
140028 KB |
Output is correct |
48 |
Correct |
188 ms |
140116 KB |
Output is correct |
49 |
Correct |
187 ms |
139944 KB |
Output is correct |
50 |
Correct |
141 ms |
140456 KB |
Output is correct |
51 |
Correct |
152 ms |
139948 KB |
Output is correct |
52 |
Correct |
177 ms |
139932 KB |
Output is correct |
53 |
Correct |
184 ms |
139948 KB |
Output is correct |
54 |
Correct |
184 ms |
140116 KB |
Output is correct |
55 |
Correct |
140 ms |
140452 KB |
Output is correct |
56 |
Correct |
151 ms |
139964 KB |
Output is correct |
57 |
Correct |
165 ms |
134948 KB |
Output is correct |
58 |
Correct |
169 ms |
139940 KB |
Output is correct |
59 |
Correct |
192 ms |
140036 KB |
Output is correct |
60 |
Correct |
179 ms |
139936 KB |
Output is correct |
61 |
Correct |
184 ms |
140040 KB |
Output is correct |
62 |
Correct |
178 ms |
139972 KB |
Output is correct |
63 |
Correct |
177 ms |
139956 KB |
Output is correct |
64 |
Correct |
147 ms |
139960 KB |
Output is correct |
65 |
Correct |
143 ms |
140448 KB |
Output is correct |
66 |
Correct |
154 ms |
139932 KB |
Output is correct |
67 |
Correct |
150 ms |
140372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1114 ms |
138912 KB |
Output is correct |
2 |
Correct |
1322 ms |
139932 KB |
Output is correct |
3 |
Correct |
1307 ms |
140100 KB |
Output is correct |
4 |
Correct |
1345 ms |
139944 KB |
Output is correct |
5 |
Correct |
1270 ms |
140044 KB |
Output is correct |
6 |
Correct |
1407 ms |
139964 KB |
Output is correct |
7 |
Correct |
1440 ms |
140036 KB |
Output is correct |
8 |
Correct |
1785 ms |
139944 KB |
Output is correct |
9 |
Correct |
1930 ms |
140340 KB |
Output is correct |
10 |
Correct |
1423 ms |
139940 KB |
Output is correct |
11 |
Correct |
1502 ms |
140100 KB |
Output is correct |
12 |
Correct |
1667 ms |
140060 KB |
Output is correct |
13 |
Correct |
1788 ms |
140436 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
2 ms |
2384 KB |
Output is correct |
17 |
Correct |
174 ms |
139956 KB |
Output is correct |
18 |
Correct |
187 ms |
139972 KB |
Output is correct |
19 |
Correct |
187 ms |
140020 KB |
Output is correct |
20 |
Correct |
139 ms |
140404 KB |
Output is correct |
21 |
Correct |
148 ms |
139964 KB |
Output is correct |
22 |
Correct |
171 ms |
140172 KB |
Output is correct |
23 |
Correct |
196 ms |
140044 KB |
Output is correct |
24 |
Correct |
180 ms |
139980 KB |
Output is correct |
25 |
Correct |
142 ms |
140432 KB |
Output is correct |
26 |
Correct |
157 ms |
140060 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
3 ms |
2384 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
2 ms |
2384 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
3 ms |
2384 KB |
Output is correct |
34 |
Correct |
3 ms |
2384 KB |
Output is correct |
35 |
Correct |
2 ms |
2384 KB |
Output is correct |
36 |
Correct |
3 ms |
2384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
238 ms |
30596 KB |
Output is correct |
2 |
Correct |
1008 ms |
139952 KB |
Output is correct |
3 |
Correct |
948 ms |
140008 KB |
Output is correct |
4 |
Correct |
1033 ms |
140084 KB |
Output is correct |
5 |
Correct |
1084 ms |
139956 KB |
Output is correct |
6 |
Correct |
994 ms |
139984 KB |
Output is correct |
7 |
Correct |
1045 ms |
139972 KB |
Output is correct |
8 |
Correct |
1059 ms |
139944 KB |
Output is correct |
9 |
Correct |
760 ms |
140352 KB |
Output is correct |
10 |
Correct |
1026 ms |
139944 KB |
Output is correct |
11 |
Correct |
944 ms |
140020 KB |
Output is correct |
12 |
Correct |
173 ms |
139948 KB |
Output is correct |
13 |
Correct |
182 ms |
139952 KB |
Output is correct |
14 |
Correct |
214 ms |
140036 KB |
Output is correct |
15 |
Correct |
141 ms |
140416 KB |
Output is correct |
16 |
Correct |
157 ms |
140020 KB |
Output is correct |
17 |
Correct |
167 ms |
134912 KB |
Output is correct |
18 |
Correct |
174 ms |
139972 KB |
Output is correct |
19 |
Correct |
178 ms |
139944 KB |
Output is correct |
20 |
Correct |
188 ms |
139956 KB |
Output is correct |
21 |
Correct |
191 ms |
140112 KB |
Output is correct |
22 |
Correct |
181 ms |
139944 KB |
Output is correct |
23 |
Correct |
181 ms |
139944 KB |
Output is correct |
24 |
Correct |
143 ms |
140048 KB |
Output is correct |
25 |
Correct |
140 ms |
140444 KB |
Output is correct |
26 |
Correct |
158 ms |
139936 KB |
Output is correct |
27 |
Correct |
151 ms |
140352 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
3 ms |
2392 KB |
Output is correct |
30 |
Correct |
3 ms |
2400 KB |
Output is correct |
31 |
Correct |
3 ms |
2384 KB |
Output is correct |
32 |
Correct |
3 ms |
2372 KB |
Output is correct |
33 |
Correct |
2 ms |
1112 KB |
Output is correct |
34 |
Correct |
3 ms |
2392 KB |
Output is correct |
35 |
Correct |
3 ms |
2392 KB |
Output is correct |
36 |
Correct |
3 ms |
2392 KB |
Output is correct |
37 |
Correct |
3 ms |
2388 KB |
Output is correct |
38 |
Correct |
3 ms |
2384 KB |
Output is correct |
39 |
Correct |
3 ms |
2384 KB |
Output is correct |
40 |
Correct |
3 ms |
2384 KB |
Output is correct |
41 |
Correct |
3 ms |
2384 KB |
Output is correct |
42 |
Correct |
4 ms |
2384 KB |
Output is correct |
43 |
Correct |
3 ms |
2356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
3 ms |
2384 KB |
Output is correct |
5 |
Correct |
3 ms |
2364 KB |
Output is correct |
6 |
Correct |
3 ms |
2384 KB |
Output is correct |
7 |
Correct |
3 ms |
2384 KB |
Output is correct |
8 |
Correct |
2 ms |
2356 KB |
Output is correct |
9 |
Correct |
2 ms |
2384 KB |
Output is correct |
10 |
Correct |
3 ms |
2384 KB |
Output is correct |
11 |
Correct |
3 ms |
2384 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
2384 KB |
Output is correct |
14 |
Correct |
2 ms |
2320 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2388 KB |
Output is correct |
17 |
Correct |
3 ms |
2388 KB |
Output is correct |
18 |
Correct |
2 ms |
2388 KB |
Output is correct |
19 |
Correct |
3 ms |
2384 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
3 ms |
2392 KB |
Output is correct |
22 |
Correct |
3 ms |
2384 KB |
Output is correct |
23 |
Correct |
2 ms |
2384 KB |
Output is correct |
24 |
Correct |
3 ms |
2384 KB |
Output is correct |
25 |
Correct |
1 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2304 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
3 ms |
2400 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
3 ms |
2284 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
3 ms |
2384 KB |
Output is correct |
34 |
Correct |
3 ms |
2312 KB |
Output is correct |
35 |
Correct |
3 ms |
2384 KB |
Output is correct |
36 |
Correct |
118 ms |
88460 KB |
Output is correct |
37 |
Correct |
187 ms |
139960 KB |
Output is correct |
38 |
Correct |
188 ms |
139944 KB |
Output is correct |
39 |
Correct |
208 ms |
139992 KB |
Output is correct |
40 |
Correct |
185 ms |
139944 KB |
Output is correct |
41 |
Correct |
198 ms |
140032 KB |
Output is correct |
42 |
Correct |
183 ms |
140112 KB |
Output is correct |
43 |
Correct |
139 ms |
139944 KB |
Output is correct |
44 |
Correct |
141 ms |
140408 KB |
Output is correct |
45 |
Correct |
169 ms |
140208 KB |
Output is correct |
46 |
Correct |
148 ms |
140204 KB |
Output is correct |
47 |
Correct |
174 ms |
140028 KB |
Output is correct |
48 |
Correct |
188 ms |
140116 KB |
Output is correct |
49 |
Correct |
187 ms |
139944 KB |
Output is correct |
50 |
Correct |
141 ms |
140456 KB |
Output is correct |
51 |
Correct |
152 ms |
139948 KB |
Output is correct |
52 |
Correct |
177 ms |
139932 KB |
Output is correct |
53 |
Correct |
184 ms |
139948 KB |
Output is correct |
54 |
Correct |
184 ms |
140116 KB |
Output is correct |
55 |
Correct |
140 ms |
140452 KB |
Output is correct |
56 |
Correct |
151 ms |
139964 KB |
Output is correct |
57 |
Correct |
165 ms |
134948 KB |
Output is correct |
58 |
Correct |
169 ms |
139940 KB |
Output is correct |
59 |
Correct |
192 ms |
140036 KB |
Output is correct |
60 |
Correct |
179 ms |
139936 KB |
Output is correct |
61 |
Correct |
184 ms |
140040 KB |
Output is correct |
62 |
Correct |
178 ms |
139972 KB |
Output is correct |
63 |
Correct |
177 ms |
139956 KB |
Output is correct |
64 |
Correct |
147 ms |
139960 KB |
Output is correct |
65 |
Correct |
143 ms |
140448 KB |
Output is correct |
66 |
Correct |
154 ms |
139932 KB |
Output is correct |
67 |
Correct |
150 ms |
140372 KB |
Output is correct |
68 |
Correct |
1114 ms |
138912 KB |
Output is correct |
69 |
Correct |
1322 ms |
139932 KB |
Output is correct |
70 |
Correct |
1307 ms |
140100 KB |
Output is correct |
71 |
Correct |
1345 ms |
139944 KB |
Output is correct |
72 |
Correct |
1270 ms |
140044 KB |
Output is correct |
73 |
Correct |
1407 ms |
139964 KB |
Output is correct |
74 |
Correct |
1440 ms |
140036 KB |
Output is correct |
75 |
Correct |
1785 ms |
139944 KB |
Output is correct |
76 |
Correct |
1930 ms |
140340 KB |
Output is correct |
77 |
Correct |
1423 ms |
139940 KB |
Output is correct |
78 |
Correct |
1502 ms |
140100 KB |
Output is correct |
79 |
Correct |
1667 ms |
140060 KB |
Output is correct |
80 |
Correct |
1788 ms |
140436 KB |
Output is correct |
81 |
Correct |
0 ms |
208 KB |
Output is correct |
82 |
Correct |
3 ms |
2384 KB |
Output is correct |
83 |
Correct |
2 ms |
2384 KB |
Output is correct |
84 |
Correct |
174 ms |
139956 KB |
Output is correct |
85 |
Correct |
187 ms |
139972 KB |
Output is correct |
86 |
Correct |
187 ms |
140020 KB |
Output is correct |
87 |
Correct |
139 ms |
140404 KB |
Output is correct |
88 |
Correct |
148 ms |
139964 KB |
Output is correct |
89 |
Correct |
171 ms |
140172 KB |
Output is correct |
90 |
Correct |
196 ms |
140044 KB |
Output is correct |
91 |
Correct |
180 ms |
139980 KB |
Output is correct |
92 |
Correct |
142 ms |
140432 KB |
Output is correct |
93 |
Correct |
157 ms |
140060 KB |
Output is correct |
94 |
Correct |
3 ms |
2384 KB |
Output is correct |
95 |
Correct |
3 ms |
2384 KB |
Output is correct |
96 |
Correct |
3 ms |
2384 KB |
Output is correct |
97 |
Correct |
3 ms |
2384 KB |
Output is correct |
98 |
Correct |
2 ms |
2384 KB |
Output is correct |
99 |
Correct |
3 ms |
2384 KB |
Output is correct |
100 |
Correct |
3 ms |
2384 KB |
Output is correct |
101 |
Correct |
3 ms |
2384 KB |
Output is correct |
102 |
Correct |
2 ms |
2384 KB |
Output is correct |
103 |
Correct |
3 ms |
2384 KB |
Output is correct |
104 |
Correct |
1157 ms |
123328 KB |
Output is correct |
105 |
Correct |
1195 ms |
140020 KB |
Output is correct |
106 |
Correct |
1353 ms |
139984 KB |
Output is correct |
107 |
Correct |
1429 ms |
140136 KB |
Output is correct |
108 |
Correct |
1505 ms |
140000 KB |
Output is correct |
109 |
Correct |
1315 ms |
139964 KB |
Output is correct |
110 |
Correct |
1388 ms |
139940 KB |
Output is correct |
111 |
Correct |
1895 ms |
139944 KB |
Output is correct |
112 |
Correct |
1864 ms |
140448 KB |
Output is correct |
113 |
Correct |
1639 ms |
140048 KB |
Output is correct |
114 |
Correct |
1636 ms |
140316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
846 ms |
80656 KB |
Output is correct |
2 |
Correct |
1927 ms |
140048 KB |
Output is correct |
3 |
Correct |
2016 ms |
140056 KB |
Output is correct |
4 |
Correct |
1821 ms |
139996 KB |
Output is correct |
5 |
Correct |
1906 ms |
140452 KB |
Output is correct |
6 |
Correct |
1719 ms |
139968 KB |
Output is correct |
7 |
Correct |
1787 ms |
140484 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
3 ms |
2384 KB |
Output is correct |
10 |
Correct |
3 ms |
2400 KB |
Output is correct |
11 |
Correct |
1 ms |
592 KB |
Output is correct |
12 |
Correct |
3 ms |
2384 KB |
Output is correct |
13 |
Correct |
3 ms |
2384 KB |
Output is correct |
14 |
Correct |
3 ms |
2384 KB |
Output is correct |
15 |
Correct |
3 ms |
2364 KB |
Output is correct |
16 |
Correct |
3 ms |
2384 KB |
Output is correct |
17 |
Correct |
3 ms |
2384 KB |
Output is correct |
18 |
Correct |
2 ms |
2356 KB |
Output is correct |
19 |
Correct |
2 ms |
2384 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
3 ms |
2384 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
3 ms |
2384 KB |
Output is correct |
24 |
Correct |
2 ms |
2320 KB |
Output is correct |
25 |
Correct |
3 ms |
2384 KB |
Output is correct |
26 |
Correct |
3 ms |
2388 KB |
Output is correct |
27 |
Correct |
3 ms |
2388 KB |
Output is correct |
28 |
Correct |
2 ms |
2388 KB |
Output is correct |
29 |
Correct |
3 ms |
2384 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
3 ms |
2392 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
2 ms |
2384 KB |
Output is correct |
34 |
Correct |
3 ms |
2384 KB |
Output is correct |
35 |
Correct |
1 ms |
1104 KB |
Output is correct |
36 |
Correct |
3 ms |
2384 KB |
Output is correct |
37 |
Correct |
3 ms |
2304 KB |
Output is correct |
38 |
Correct |
3 ms |
2384 KB |
Output is correct |
39 |
Correct |
3 ms |
2400 KB |
Output is correct |
40 |
Correct |
3 ms |
2384 KB |
Output is correct |
41 |
Correct |
3 ms |
2284 KB |
Output is correct |
42 |
Correct |
3 ms |
2384 KB |
Output is correct |
43 |
Correct |
3 ms |
2384 KB |
Output is correct |
44 |
Correct |
3 ms |
2312 KB |
Output is correct |
45 |
Correct |
3 ms |
2384 KB |
Output is correct |
46 |
Correct |
118 ms |
88460 KB |
Output is correct |
47 |
Correct |
187 ms |
139960 KB |
Output is correct |
48 |
Correct |
188 ms |
139944 KB |
Output is correct |
49 |
Correct |
208 ms |
139992 KB |
Output is correct |
50 |
Correct |
185 ms |
139944 KB |
Output is correct |
51 |
Correct |
198 ms |
140032 KB |
Output is correct |
52 |
Correct |
183 ms |
140112 KB |
Output is correct |
53 |
Correct |
139 ms |
139944 KB |
Output is correct |
54 |
Correct |
141 ms |
140408 KB |
Output is correct |
55 |
Correct |
169 ms |
140208 KB |
Output is correct |
56 |
Correct |
148 ms |
140204 KB |
Output is correct |
57 |
Correct |
174 ms |
140028 KB |
Output is correct |
58 |
Correct |
188 ms |
140116 KB |
Output is correct |
59 |
Correct |
187 ms |
139944 KB |
Output is correct |
60 |
Correct |
141 ms |
140456 KB |
Output is correct |
61 |
Correct |
152 ms |
139948 KB |
Output is correct |
62 |
Correct |
177 ms |
139932 KB |
Output is correct |
63 |
Correct |
184 ms |
139948 KB |
Output is correct |
64 |
Correct |
184 ms |
140116 KB |
Output is correct |
65 |
Correct |
140 ms |
140452 KB |
Output is correct |
66 |
Correct |
151 ms |
139964 KB |
Output is correct |
67 |
Correct |
165 ms |
134948 KB |
Output is correct |
68 |
Correct |
169 ms |
139940 KB |
Output is correct |
69 |
Correct |
192 ms |
140036 KB |
Output is correct |
70 |
Correct |
179 ms |
139936 KB |
Output is correct |
71 |
Correct |
184 ms |
140040 KB |
Output is correct |
72 |
Correct |
178 ms |
139972 KB |
Output is correct |
73 |
Correct |
177 ms |
139956 KB |
Output is correct |
74 |
Correct |
147 ms |
139960 KB |
Output is correct |
75 |
Correct |
143 ms |
140448 KB |
Output is correct |
76 |
Correct |
154 ms |
139932 KB |
Output is correct |
77 |
Correct |
150 ms |
140372 KB |
Output is correct |
78 |
Correct |
1114 ms |
138912 KB |
Output is correct |
79 |
Correct |
1322 ms |
139932 KB |
Output is correct |
80 |
Correct |
1307 ms |
140100 KB |
Output is correct |
81 |
Correct |
1345 ms |
139944 KB |
Output is correct |
82 |
Correct |
1270 ms |
140044 KB |
Output is correct |
83 |
Correct |
1407 ms |
139964 KB |
Output is correct |
84 |
Correct |
1440 ms |
140036 KB |
Output is correct |
85 |
Correct |
1785 ms |
139944 KB |
Output is correct |
86 |
Correct |
1930 ms |
140340 KB |
Output is correct |
87 |
Correct |
1423 ms |
139940 KB |
Output is correct |
88 |
Correct |
1502 ms |
140100 KB |
Output is correct |
89 |
Correct |
1667 ms |
140060 KB |
Output is correct |
90 |
Correct |
1788 ms |
140436 KB |
Output is correct |
91 |
Correct |
0 ms |
208 KB |
Output is correct |
92 |
Correct |
3 ms |
2384 KB |
Output is correct |
93 |
Correct |
2 ms |
2384 KB |
Output is correct |
94 |
Correct |
174 ms |
139956 KB |
Output is correct |
95 |
Correct |
187 ms |
139972 KB |
Output is correct |
96 |
Correct |
187 ms |
140020 KB |
Output is correct |
97 |
Correct |
139 ms |
140404 KB |
Output is correct |
98 |
Correct |
148 ms |
139964 KB |
Output is correct |
99 |
Correct |
171 ms |
140172 KB |
Output is correct |
100 |
Correct |
196 ms |
140044 KB |
Output is correct |
101 |
Correct |
180 ms |
139980 KB |
Output is correct |
102 |
Correct |
142 ms |
140432 KB |
Output is correct |
103 |
Correct |
157 ms |
140060 KB |
Output is correct |
104 |
Correct |
3 ms |
2384 KB |
Output is correct |
105 |
Correct |
3 ms |
2384 KB |
Output is correct |
106 |
Correct |
3 ms |
2384 KB |
Output is correct |
107 |
Correct |
3 ms |
2384 KB |
Output is correct |
108 |
Correct |
2 ms |
2384 KB |
Output is correct |
109 |
Correct |
3 ms |
2384 KB |
Output is correct |
110 |
Correct |
3 ms |
2384 KB |
Output is correct |
111 |
Correct |
3 ms |
2384 KB |
Output is correct |
112 |
Correct |
2 ms |
2384 KB |
Output is correct |
113 |
Correct |
3 ms |
2384 KB |
Output is correct |
114 |
Correct |
238 ms |
30596 KB |
Output is correct |
115 |
Correct |
1008 ms |
139952 KB |
Output is correct |
116 |
Correct |
948 ms |
140008 KB |
Output is correct |
117 |
Correct |
1033 ms |
140084 KB |
Output is correct |
118 |
Correct |
1084 ms |
139956 KB |
Output is correct |
119 |
Correct |
994 ms |
139984 KB |
Output is correct |
120 |
Correct |
1045 ms |
139972 KB |
Output is correct |
121 |
Correct |
1059 ms |
139944 KB |
Output is correct |
122 |
Correct |
760 ms |
140352 KB |
Output is correct |
123 |
Correct |
1026 ms |
139944 KB |
Output is correct |
124 |
Correct |
944 ms |
140020 KB |
Output is correct |
125 |
Correct |
173 ms |
139948 KB |
Output is correct |
126 |
Correct |
182 ms |
139952 KB |
Output is correct |
127 |
Correct |
214 ms |
140036 KB |
Output is correct |
128 |
Correct |
141 ms |
140416 KB |
Output is correct |
129 |
Correct |
157 ms |
140020 KB |
Output is correct |
130 |
Correct |
167 ms |
134912 KB |
Output is correct |
131 |
Correct |
174 ms |
139972 KB |
Output is correct |
132 |
Correct |
178 ms |
139944 KB |
Output is correct |
133 |
Correct |
188 ms |
139956 KB |
Output is correct |
134 |
Correct |
191 ms |
140112 KB |
Output is correct |
135 |
Correct |
181 ms |
139944 KB |
Output is correct |
136 |
Correct |
181 ms |
139944 KB |
Output is correct |
137 |
Correct |
143 ms |
140048 KB |
Output is correct |
138 |
Correct |
140 ms |
140444 KB |
Output is correct |
139 |
Correct |
158 ms |
139936 KB |
Output is correct |
140 |
Correct |
151 ms |
140352 KB |
Output is correct |
141 |
Correct |
3 ms |
2384 KB |
Output is correct |
142 |
Correct |
3 ms |
2392 KB |
Output is correct |
143 |
Correct |
3 ms |
2400 KB |
Output is correct |
144 |
Correct |
3 ms |
2384 KB |
Output is correct |
145 |
Correct |
3 ms |
2372 KB |
Output is correct |
146 |
Correct |
2 ms |
1112 KB |
Output is correct |
147 |
Correct |
3 ms |
2392 KB |
Output is correct |
148 |
Correct |
3 ms |
2392 KB |
Output is correct |
149 |
Correct |
3 ms |
2392 KB |
Output is correct |
150 |
Correct |
3 ms |
2388 KB |
Output is correct |
151 |
Correct |
3 ms |
2384 KB |
Output is correct |
152 |
Correct |
3 ms |
2384 KB |
Output is correct |
153 |
Correct |
3 ms |
2384 KB |
Output is correct |
154 |
Correct |
3 ms |
2384 KB |
Output is correct |
155 |
Correct |
4 ms |
2384 KB |
Output is correct |
156 |
Correct |
3 ms |
2356 KB |
Output is correct |
157 |
Correct |
1157 ms |
123328 KB |
Output is correct |
158 |
Correct |
1195 ms |
140020 KB |
Output is correct |
159 |
Correct |
1353 ms |
139984 KB |
Output is correct |
160 |
Correct |
1429 ms |
140136 KB |
Output is correct |
161 |
Correct |
1505 ms |
140000 KB |
Output is correct |
162 |
Correct |
1315 ms |
139964 KB |
Output is correct |
163 |
Correct |
1388 ms |
139940 KB |
Output is correct |
164 |
Correct |
1895 ms |
139944 KB |
Output is correct |
165 |
Correct |
1864 ms |
140448 KB |
Output is correct |
166 |
Correct |
1639 ms |
140048 KB |
Output is correct |
167 |
Correct |
1636 ms |
140316 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Correct |
977 ms |
45412 KB |
Output is correct |
170 |
Correct |
1463 ms |
139948 KB |
Output is correct |
171 |
Correct |
1453 ms |
139964 KB |
Output is correct |
172 |
Correct |
1392 ms |
139972 KB |
Output is correct |
173 |
Correct |
1617 ms |
139944 KB |
Output is correct |
174 |
Correct |
1539 ms |
139948 KB |
Output is correct |
175 |
Correct |
1552 ms |
139972 KB |
Output is correct |
176 |
Correct |
1840 ms |
140008 KB |
Output is correct |
177 |
Correct |
1947 ms |
140452 KB |
Output is correct |
178 |
Correct |
1679 ms |
139964 KB |
Output is correct |
179 |
Correct |
1779 ms |
140196 KB |
Output is correct |