#include "towers.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll big = 1e9+10;
ll n;
ll w;
ll u;
vector<ll> h,lh,rh,hh,hs,inc,decc,hhs;
//ll mx;
vector<ll> ps;
vector<pair<ll,ll>> rgs;
struct obj{
ll v,c;
bool operator<(const obj &o) const{
return v<o.v;
}
bool operator>(const obj &o) const{
return v>o.v;
}
};
struct dat{
ll c,l,r;
dat():c(0),l(big),r(-big){}
dat(ll x, ll y, ll z):c(x),l(y),r(z){}
void put(ll i){
c = 1;
l = i;
r = i;
}
dat operator+(const dat &o) const{
return dat(c+o.c,min(l,o.l),max(r,o.r));
}
};
struct node{
ll l,r,m;
dat v;
node *L,*R;
node(ll a, ll b):l(a),r(b),m(a+b>>1),v(),L(nullptr),R(nullptr){
if(a<b){
L = new node(l,m);
R = new node(m+1,r);
}
}
void put(ll i){
if (l==r) v.put(i);
else{
if (i<=m) (L=new node(*L))->put(i);
else (R=new node(*R))->put(i);
v = L->v+R->v;
}
}
dat qry(ll ql, ll qr){
//cerr << "qry " << ql << " " << qr << " " << l << " " << r << " " << v.l << " " << v.r << " " << v.c << "\n";
if (ql<=l&&r<=qr) return v;
else{
if (qr<=m) return L->qry(ql,qr);
else if (ql>m) return R->qry(ql,qr);
else return L->qry(ql,qr)+R->qry(ql,qr);
}
}
};
struct segtree{
vector<node*> rt;
segtree(){}
segtree(ll n){
rt.push_back(new node(0,n-1));
}
void nw(){
rt.push_back(new node(*rt.back()));
}
void put(ll t, ll i){
rt[t]->put(i);
}
dat qry(ll t, ll ql, ll qr){
return rt[t]->qry(ql,qr);
}
};
segtree t,t0;
void init(int N, std::vector<int> H) {
n = N;
h = H;
//for(ll i = 0;i<n;i++) if((i==0||(h[i-1]<h[i]))&&(i==n-1||h[i]>h[i+1])) mx = i;
//for(ll i = 1;i<n-1;i++){
// if (h[i-1]<h[i]&&h[i]>h[i+1]){
// ps.push_back(i);
// }
//}
//for(auto [u,v] : ps) cerr << "[" << u << "," << v << "]" << " ";cerr << "\n";
lh.resize(n,0);
rh.resize(n,0);
hh.resize(n,0);
{
vector<pair<ll,ll>> v;
v.push_back({h[0],h[0]});
for(ll i = 1;i<n;i++){
ll mi = h[i];
while(v.size()&&v.back().first<h[i]){
mi = min(mi,v.back().second);
v.pop_back();
}
lh[i] = h[i]-mi;
v.push_back({h[i],mi});
}
}
{
vector<pair<ll,ll>> v;
v.push_back({h[n-1],h[n-1]});
for(ll i = n-2;i>=0;i--){
ll mi = h[i];
while(v.size()&&v.back().first<h[i]){
mi = min(mi,v.back().second);
v.pop_back();
}
rh[i] = h[i]-mi;
v.push_back({h[i],mi});
}
}
for(ll i = 0;i<n;i++) hh[i] = min(lh[i],rh[i]);
hs = hh;
sort(hs.begin(),hs.end());
hs.erase(unique(hs.begin(),hs.end()),hs.end());
t = segtree(n);
t0 = segtree(n);
w = hs.size();
vector<vector<ll>> adds(w);
for(ll i = 0;i<n;i++){
ll p = lower_bound(hs.begin(),hs.end(),hh[i])-hs.begin();
adds[p].push_back(i);
}
for(ll i = w-1;i>=0;i--){
t.nw();
for(ll j : adds[i]){
t.put(w-i,j);
//cerr << "add " << hs[i] << " " << j << "\n";
}
//dat o = t.qry(w-i,0,n-1);
//cerr << hs[i] << " " << o.l << " " << o.r << " " << o.c << "\n";
}
inc = decc = h;
for(ll i = 1;i<n;i++) decc[i] = min(decc[i],decc[i-1]);
for(ll i = n-2;i>=0;i--) inc[i] = min(inc[i],inc[i+1]);
hhs = h;
sort(hhs.begin(),hhs.end());
hhs.erase(unique(hhs.begin(),hhs.end()),hhs.end());
u = hhs.size();
vector<vector<ll>> opp(u);
for(ll i = 0;i<n;i++){
ll p = lower_bound(hhs.begin(),hhs.end(),h[i])-hhs.begin();
opp[p].push_back(i);
}
for(ll i = 0;i<u;i++){
for(ll j : opp[i]){
t0.put(i,j);
//cerr << "add " << hs[i] << " " << j << "\n";
}
//dat o = t.qry(w-i,0,n-1);
//cerr << hs[i] << " " << o.l << " " << o.r << " " << o.c << "\n";
t0.nw();
}
}
bool ps_inited = false;
void init_ps(ll d){
ps_inited = true;
vector<ll> ld(n,big),rd(n,big);
{
vector<pair<ll,ll>> v;
v.push_back({h[0],0});
for(ll i = 1;i<n;i++){
auto it = lower_bound(v.begin(),v.end(),make_pair(h[i]-d+1,0));
if (it!=v.begin()) ld[i] = i-(*--it).second;
while(v.size()&&v.back().first>h[i]) v.pop_back();
v.push_back({h[i],i});
}
}
{
vector<pair<ll,ll>> v;
v.push_back({h[n-1],n-1});
for(ll i = n-2;i>=0;i--){
auto it = lower_bound(v.begin(),v.end(),make_pair(h[i]-d+1,0));
if (it!=v.begin()) rd[i] = (*--it).second-i;
while(v.size()&&v.back().first>h[i]) v.pop_back();
v.push_back({h[i],i});
}
}
for(ll i = 0;i<n;i++) if(lh[i]>=d&&rh[i]>=d) {
ps.push_back(i);
rgs.push_back({i-ld[i],i+rd[i]});
//cerr << i-ld[i] << " " << i << " " << i+rd[i] << "\n";
}
}
int max_towers(int L, int R, int D) {
if(!ps_inited) init_ps(D);
ll l = L, r = R, d = D;
ll ans = 1;
ll idx = w-(lower_bound(hs.begin(),hs.end(),d)-hs.begin());
dat o = t.qry(idx,L,R);
//cerr << idx << " " << L << " " << R << " " << o.l << " " << o.r << " " << o.c << "\n";
if (o.c==0) return 1;
ll cur = o.c;
ll pl = upper_bound(hhs.begin(),hhs.end(),h[o.l]-d)-hhs.begin()-1;
dat l_need = t0.qry(pl,0,o.l);
if (l_need.r<L) cur--;
ll pr = upper_bound(hhs.begin(),hhs.end(),h[o.r]-d)-hhs.begin()-1;
dat r_need = t0.qry(pr,o.r,n-1);
if (r_need.l>R) cur--;
//ll l_need = upper_bound(inc.begin(),inc.begin(),h[o.l]-d)-inc.begin();
//if (l_need-1<L) cur--;
//ll r_need = lower_bound(decc.begin(),decc.end(),h[o.r]-d,greater<ll>())-decc.begin();
//if (r_need>R) cur--;
return 1+max(0,cur);
//auto it0 = lower_bound(ps.begin(),ps.end(),r);
//ll rf = it0-ps.begin();
//auto it1 = lower_bound(ps.begin(),ps.end(),l+1);
//ll lf = it1-ps.begin();
//cerr << lf << " " << rf << "\n";
//ans = max(0,rf-lf)+1;
auto it0 = lower_bound(rgs.begin(),rgs.end(),make_pair(r,0));
//if (it0!=rgs.begin()) --it0;
ll rf = it0-rgs.begin();
if (it0!=rgs.begin()){
if ((*--it0).second>r) --rf;
}
auto it1 = lower_bound(rgs.begin(),rgs.end(),make_pair(l,0));
ll lf = it1-rgs.begin();
ans = max(0,rf-lf)+1;
return ans;
/*vector<obj> a,b;
a.push_back({0,0});
b.push_back({big,0});
for(ll i = l;i<=r;i++){
ll cur = 0;
auto it = lower_bound(b.begin(),b.end(),obj({h[i]-1,0}),greater<obj>());
--it;
cur = (*it).c;
ans = max(ans,cur+1);
obj oa = {h[i],cur+1};
if (a.size()<=oa.c) a.push_back(oa);
else a[oa.c] = min(a[oa.c],oa);
auto it0 = lower_bound(a.begin(),a.end(),obj({h[i]-d+1,0}));
--it0;
obj ob = {h[i]-d,(*it0).c};
if (b.size()<=ob.c) b.push_back(ob);
else b[ob.c] = max(b[ob.c],ob);
ans = max(ans,cur+1);
//cerr << "a:";for(auto [u,v] : a) cerr << "(" << u <<"," << v << ") ";cerr << "\n";
//cerr << "b:";for(auto [u,v] : b) cerr << "(" << u <<"," << v << ") ";cerr << "\n";
}*/
return ans;
}
Compilation message
towers.cpp: In constructor 'node::node(ll, ll)':
towers.cpp:41:33: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
41 | node(ll a, ll b):l(a),r(b),m(a+b>>1),v(),L(nullptr),R(nullptr){
| ~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
482 ms |
109816 KB |
Output is correct |
2 |
Correct |
955 ms |
191172 KB |
Output is correct |
3 |
Correct |
871 ms |
191088 KB |
Output is correct |
4 |
Correct |
937 ms |
191152 KB |
Output is correct |
5 |
Correct |
1064 ms |
191152 KB |
Output is correct |
6 |
Correct |
964 ms |
191160 KB |
Output is correct |
7 |
Correct |
1002 ms |
191032 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
3160 KB |
Output is correct |
10 |
Correct |
5 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Output is correct |
2 |
Correct |
4 ms |
3160 KB |
Output is correct |
3 |
Correct |
4 ms |
3160 KB |
Output is correct |
4 |
Correct |
4 ms |
3160 KB |
Output is correct |
5 |
Correct |
5 ms |
3160 KB |
Output is correct |
6 |
Correct |
5 ms |
3160 KB |
Output is correct |
7 |
Correct |
6 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3128 KB |
Output is correct |
9 |
Correct |
3 ms |
3160 KB |
Output is correct |
10 |
Correct |
4 ms |
3160 KB |
Output is correct |
11 |
Correct |
3 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
5 ms |
3160 KB |
Output is correct |
14 |
Correct |
4 ms |
3160 KB |
Output is correct |
15 |
Correct |
4 ms |
3160 KB |
Output is correct |
16 |
Correct |
4 ms |
3160 KB |
Output is correct |
17 |
Correct |
4 ms |
3160 KB |
Output is correct |
18 |
Correct |
5 ms |
3160 KB |
Output is correct |
19 |
Correct |
5 ms |
3160 KB |
Output is correct |
20 |
Correct |
4 ms |
3160 KB |
Output is correct |
21 |
Correct |
5 ms |
3272 KB |
Output is correct |
22 |
Correct |
4 ms |
3160 KB |
Output is correct |
23 |
Correct |
3 ms |
3160 KB |
Output is correct |
24 |
Correct |
4 ms |
3160 KB |
Output is correct |
25 |
Correct |
2 ms |
1368 KB |
Output is correct |
26 |
Correct |
4 ms |
3176 KB |
Output is correct |
27 |
Correct |
4 ms |
3160 KB |
Output is correct |
28 |
Correct |
5 ms |
3160 KB |
Output is correct |
29 |
Correct |
6 ms |
3160 KB |
Output is correct |
30 |
Correct |
3 ms |
3160 KB |
Output is correct |
31 |
Correct |
5 ms |
3160 KB |
Output is correct |
32 |
Correct |
3 ms |
3160 KB |
Output is correct |
33 |
Correct |
3 ms |
3160 KB |
Output is correct |
34 |
Correct |
3 ms |
3160 KB |
Output is correct |
35 |
Correct |
4 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Output is correct |
2 |
Correct |
4 ms |
3160 KB |
Output is correct |
3 |
Correct |
4 ms |
3160 KB |
Output is correct |
4 |
Correct |
4 ms |
3160 KB |
Output is correct |
5 |
Correct |
5 ms |
3160 KB |
Output is correct |
6 |
Correct |
5 ms |
3160 KB |
Output is correct |
7 |
Correct |
6 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3128 KB |
Output is correct |
9 |
Correct |
3 ms |
3160 KB |
Output is correct |
10 |
Correct |
4 ms |
3160 KB |
Output is correct |
11 |
Correct |
3 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
5 ms |
3160 KB |
Output is correct |
14 |
Correct |
4 ms |
3160 KB |
Output is correct |
15 |
Correct |
4 ms |
3160 KB |
Output is correct |
16 |
Correct |
4 ms |
3160 KB |
Output is correct |
17 |
Correct |
4 ms |
3160 KB |
Output is correct |
18 |
Correct |
5 ms |
3160 KB |
Output is correct |
19 |
Correct |
5 ms |
3160 KB |
Output is correct |
20 |
Correct |
4 ms |
3160 KB |
Output is correct |
21 |
Correct |
5 ms |
3272 KB |
Output is correct |
22 |
Correct |
4 ms |
3160 KB |
Output is correct |
23 |
Correct |
3 ms |
3160 KB |
Output is correct |
24 |
Correct |
4 ms |
3160 KB |
Output is correct |
25 |
Correct |
2 ms |
1368 KB |
Output is correct |
26 |
Correct |
4 ms |
3176 KB |
Output is correct |
27 |
Correct |
4 ms |
3160 KB |
Output is correct |
28 |
Correct |
5 ms |
3160 KB |
Output is correct |
29 |
Correct |
6 ms |
3160 KB |
Output is correct |
30 |
Correct |
3 ms |
3160 KB |
Output is correct |
31 |
Correct |
5 ms |
3160 KB |
Output is correct |
32 |
Correct |
3 ms |
3160 KB |
Output is correct |
33 |
Correct |
3 ms |
3160 KB |
Output is correct |
34 |
Correct |
3 ms |
3160 KB |
Output is correct |
35 |
Correct |
4 ms |
3160 KB |
Output is correct |
36 |
Correct |
189 ms |
122568 KB |
Output is correct |
37 |
Correct |
304 ms |
194760 KB |
Output is correct |
38 |
Correct |
293 ms |
194520 KB |
Output is correct |
39 |
Correct |
314 ms |
196580 KB |
Output is correct |
40 |
Correct |
326 ms |
196648 KB |
Output is correct |
41 |
Correct |
304 ms |
196292 KB |
Output is correct |
42 |
Correct |
318 ms |
196400 KB |
Output is correct |
43 |
Correct |
186 ms |
191156 KB |
Output is correct |
44 |
Correct |
186 ms |
191000 KB |
Output is correct |
45 |
Correct |
192 ms |
191116 KB |
Output is correct |
46 |
Correct |
209 ms |
191068 KB |
Output is correct |
47 |
Correct |
309 ms |
194584 KB |
Output is correct |
48 |
Correct |
317 ms |
196292 KB |
Output is correct |
49 |
Correct |
324 ms |
196292 KB |
Output is correct |
50 |
Correct |
203 ms |
191124 KB |
Output is correct |
51 |
Correct |
185 ms |
191172 KB |
Output is correct |
52 |
Correct |
299 ms |
194612 KB |
Output is correct |
53 |
Correct |
359 ms |
196292 KB |
Output is correct |
54 |
Correct |
327 ms |
196292 KB |
Output is correct |
55 |
Correct |
196 ms |
191136 KB |
Output is correct |
56 |
Correct |
171 ms |
191228 KB |
Output is correct |
57 |
Correct |
274 ms |
187736 KB |
Output is correct |
58 |
Correct |
291 ms |
194756 KB |
Output is correct |
59 |
Correct |
290 ms |
194756 KB |
Output is correct |
60 |
Correct |
315 ms |
196328 KB |
Output is correct |
61 |
Correct |
292 ms |
196488 KB |
Output is correct |
62 |
Correct |
327 ms |
196508 KB |
Output is correct |
63 |
Correct |
305 ms |
196292 KB |
Output is correct |
64 |
Correct |
177 ms |
191060 KB |
Output is correct |
65 |
Correct |
189 ms |
191224 KB |
Output is correct |
66 |
Correct |
181 ms |
191208 KB |
Output is correct |
67 |
Correct |
214 ms |
191040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1152 ms |
193276 KB |
Output is correct |
2 |
Correct |
1507 ms |
194756 KB |
Output is correct |
3 |
Correct |
1506 ms |
194756 KB |
Output is correct |
4 |
Correct |
1532 ms |
196436 KB |
Output is correct |
5 |
Correct |
1532 ms |
196548 KB |
Output is correct |
6 |
Correct |
1646 ms |
196448 KB |
Output is correct |
7 |
Correct |
1506 ms |
196308 KB |
Output is correct |
8 |
Correct |
953 ms |
191152 KB |
Output is correct |
9 |
Correct |
875 ms |
191016 KB |
Output is correct |
10 |
Correct |
901 ms |
191096 KB |
Output is correct |
11 |
Correct |
849 ms |
191032 KB |
Output is correct |
12 |
Correct |
899 ms |
191176 KB |
Output is correct |
13 |
Correct |
918 ms |
191192 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
3 ms |
3112 KB |
Output is correct |
16 |
Correct |
3 ms |
3160 KB |
Output is correct |
17 |
Correct |
274 ms |
194728 KB |
Output is correct |
18 |
Correct |
295 ms |
196292 KB |
Output is correct |
19 |
Correct |
298 ms |
196440 KB |
Output is correct |
20 |
Correct |
181 ms |
191152 KB |
Output is correct |
21 |
Correct |
179 ms |
191040 KB |
Output is correct |
22 |
Correct |
277 ms |
194772 KB |
Output is correct |
23 |
Correct |
287 ms |
196292 KB |
Output is correct |
24 |
Correct |
285 ms |
196292 KB |
Output is correct |
25 |
Correct |
167 ms |
191152 KB |
Output is correct |
26 |
Correct |
174 ms |
191224 KB |
Output is correct |
27 |
Correct |
3 ms |
3160 KB |
Output is correct |
28 |
Correct |
4 ms |
3160 KB |
Output is correct |
29 |
Correct |
4 ms |
3160 KB |
Output is correct |
30 |
Correct |
3 ms |
3160 KB |
Output is correct |
31 |
Correct |
3 ms |
3112 KB |
Output is correct |
32 |
Correct |
5 ms |
3160 KB |
Output is correct |
33 |
Correct |
3 ms |
3160 KB |
Output is correct |
34 |
Correct |
3 ms |
3160 KB |
Output is correct |
35 |
Correct |
3 ms |
3160 KB |
Output is correct |
36 |
Correct |
3 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
276 ms |
41992 KB |
Output is correct |
2 |
Correct |
1064 ms |
194712 KB |
Output is correct |
3 |
Correct |
1099 ms |
194556 KB |
Output is correct |
4 |
Correct |
1085 ms |
196344 KB |
Output is correct |
5 |
Correct |
1060 ms |
196548 KB |
Output is correct |
6 |
Correct |
1136 ms |
196496 KB |
Output is correct |
7 |
Correct |
1162 ms |
196296 KB |
Output is correct |
8 |
Correct |
779 ms |
191152 KB |
Output is correct |
9 |
Correct |
822 ms |
191152 KB |
Output is correct |
10 |
Correct |
866 ms |
191216 KB |
Output is correct |
11 |
Correct |
882 ms |
191008 KB |
Output is correct |
12 |
Correct |
265 ms |
194756 KB |
Output is correct |
13 |
Correct |
273 ms |
196496 KB |
Output is correct |
14 |
Correct |
278 ms |
196436 KB |
Output is correct |
15 |
Correct |
176 ms |
191012 KB |
Output is correct |
16 |
Correct |
169 ms |
191224 KB |
Output is correct |
17 |
Correct |
255 ms |
187584 KB |
Output is correct |
18 |
Correct |
252 ms |
194756 KB |
Output is correct |
19 |
Correct |
267 ms |
194636 KB |
Output is correct |
20 |
Correct |
299 ms |
196388 KB |
Output is correct |
21 |
Correct |
311 ms |
196424 KB |
Output is correct |
22 |
Correct |
293 ms |
196372 KB |
Output is correct |
23 |
Correct |
274 ms |
196292 KB |
Output is correct |
24 |
Correct |
169 ms |
191000 KB |
Output is correct |
25 |
Correct |
191 ms |
191056 KB |
Output is correct |
26 |
Correct |
168 ms |
191208 KB |
Output is correct |
27 |
Correct |
181 ms |
191204 KB |
Output is correct |
28 |
Correct |
3 ms |
3160 KB |
Output is correct |
29 |
Correct |
4 ms |
3160 KB |
Output is correct |
30 |
Correct |
4 ms |
3160 KB |
Output is correct |
31 |
Correct |
3 ms |
3160 KB |
Output is correct |
32 |
Correct |
3 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
1368 KB |
Output is correct |
34 |
Correct |
4 ms |
3156 KB |
Output is correct |
35 |
Correct |
3 ms |
3160 KB |
Output is correct |
36 |
Correct |
4 ms |
3160 KB |
Output is correct |
37 |
Correct |
4 ms |
3160 KB |
Output is correct |
38 |
Correct |
3 ms |
3160 KB |
Output is correct |
39 |
Correct |
3 ms |
3160 KB |
Output is correct |
40 |
Correct |
3 ms |
3160 KB |
Output is correct |
41 |
Correct |
3 ms |
3160 KB |
Output is correct |
42 |
Correct |
3 ms |
3160 KB |
Output is correct |
43 |
Correct |
3 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Output is correct |
2 |
Correct |
4 ms |
3160 KB |
Output is correct |
3 |
Correct |
4 ms |
3160 KB |
Output is correct |
4 |
Correct |
4 ms |
3160 KB |
Output is correct |
5 |
Correct |
5 ms |
3160 KB |
Output is correct |
6 |
Correct |
5 ms |
3160 KB |
Output is correct |
7 |
Correct |
6 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3128 KB |
Output is correct |
9 |
Correct |
3 ms |
3160 KB |
Output is correct |
10 |
Correct |
4 ms |
3160 KB |
Output is correct |
11 |
Correct |
3 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
5 ms |
3160 KB |
Output is correct |
14 |
Correct |
4 ms |
3160 KB |
Output is correct |
15 |
Correct |
4 ms |
3160 KB |
Output is correct |
16 |
Correct |
4 ms |
3160 KB |
Output is correct |
17 |
Correct |
4 ms |
3160 KB |
Output is correct |
18 |
Correct |
5 ms |
3160 KB |
Output is correct |
19 |
Correct |
5 ms |
3160 KB |
Output is correct |
20 |
Correct |
4 ms |
3160 KB |
Output is correct |
21 |
Correct |
5 ms |
3272 KB |
Output is correct |
22 |
Correct |
4 ms |
3160 KB |
Output is correct |
23 |
Correct |
3 ms |
3160 KB |
Output is correct |
24 |
Correct |
4 ms |
3160 KB |
Output is correct |
25 |
Correct |
2 ms |
1368 KB |
Output is correct |
26 |
Correct |
4 ms |
3176 KB |
Output is correct |
27 |
Correct |
4 ms |
3160 KB |
Output is correct |
28 |
Correct |
5 ms |
3160 KB |
Output is correct |
29 |
Correct |
6 ms |
3160 KB |
Output is correct |
30 |
Correct |
3 ms |
3160 KB |
Output is correct |
31 |
Correct |
5 ms |
3160 KB |
Output is correct |
32 |
Correct |
3 ms |
3160 KB |
Output is correct |
33 |
Correct |
3 ms |
3160 KB |
Output is correct |
34 |
Correct |
3 ms |
3160 KB |
Output is correct |
35 |
Correct |
4 ms |
3160 KB |
Output is correct |
36 |
Correct |
189 ms |
122568 KB |
Output is correct |
37 |
Correct |
304 ms |
194760 KB |
Output is correct |
38 |
Correct |
293 ms |
194520 KB |
Output is correct |
39 |
Correct |
314 ms |
196580 KB |
Output is correct |
40 |
Correct |
326 ms |
196648 KB |
Output is correct |
41 |
Correct |
304 ms |
196292 KB |
Output is correct |
42 |
Correct |
318 ms |
196400 KB |
Output is correct |
43 |
Correct |
186 ms |
191156 KB |
Output is correct |
44 |
Correct |
186 ms |
191000 KB |
Output is correct |
45 |
Correct |
192 ms |
191116 KB |
Output is correct |
46 |
Correct |
209 ms |
191068 KB |
Output is correct |
47 |
Correct |
309 ms |
194584 KB |
Output is correct |
48 |
Correct |
317 ms |
196292 KB |
Output is correct |
49 |
Correct |
324 ms |
196292 KB |
Output is correct |
50 |
Correct |
203 ms |
191124 KB |
Output is correct |
51 |
Correct |
185 ms |
191172 KB |
Output is correct |
52 |
Correct |
299 ms |
194612 KB |
Output is correct |
53 |
Correct |
359 ms |
196292 KB |
Output is correct |
54 |
Correct |
327 ms |
196292 KB |
Output is correct |
55 |
Correct |
196 ms |
191136 KB |
Output is correct |
56 |
Correct |
171 ms |
191228 KB |
Output is correct |
57 |
Correct |
274 ms |
187736 KB |
Output is correct |
58 |
Correct |
291 ms |
194756 KB |
Output is correct |
59 |
Correct |
290 ms |
194756 KB |
Output is correct |
60 |
Correct |
315 ms |
196328 KB |
Output is correct |
61 |
Correct |
292 ms |
196488 KB |
Output is correct |
62 |
Correct |
327 ms |
196508 KB |
Output is correct |
63 |
Correct |
305 ms |
196292 KB |
Output is correct |
64 |
Correct |
177 ms |
191060 KB |
Output is correct |
65 |
Correct |
189 ms |
191224 KB |
Output is correct |
66 |
Correct |
181 ms |
191208 KB |
Output is correct |
67 |
Correct |
214 ms |
191040 KB |
Output is correct |
68 |
Correct |
1152 ms |
193276 KB |
Output is correct |
69 |
Correct |
1507 ms |
194756 KB |
Output is correct |
70 |
Correct |
1506 ms |
194756 KB |
Output is correct |
71 |
Correct |
1532 ms |
196436 KB |
Output is correct |
72 |
Correct |
1532 ms |
196548 KB |
Output is correct |
73 |
Correct |
1646 ms |
196448 KB |
Output is correct |
74 |
Correct |
1506 ms |
196308 KB |
Output is correct |
75 |
Correct |
953 ms |
191152 KB |
Output is correct |
76 |
Correct |
875 ms |
191016 KB |
Output is correct |
77 |
Correct |
901 ms |
191096 KB |
Output is correct |
78 |
Correct |
849 ms |
191032 KB |
Output is correct |
79 |
Correct |
899 ms |
191176 KB |
Output is correct |
80 |
Correct |
918 ms |
191192 KB |
Output is correct |
81 |
Correct |
0 ms |
344 KB |
Output is correct |
82 |
Correct |
3 ms |
3112 KB |
Output is correct |
83 |
Correct |
3 ms |
3160 KB |
Output is correct |
84 |
Correct |
274 ms |
194728 KB |
Output is correct |
85 |
Correct |
295 ms |
196292 KB |
Output is correct |
86 |
Correct |
298 ms |
196440 KB |
Output is correct |
87 |
Correct |
181 ms |
191152 KB |
Output is correct |
88 |
Correct |
179 ms |
191040 KB |
Output is correct |
89 |
Correct |
277 ms |
194772 KB |
Output is correct |
90 |
Correct |
287 ms |
196292 KB |
Output is correct |
91 |
Correct |
285 ms |
196292 KB |
Output is correct |
92 |
Correct |
167 ms |
191152 KB |
Output is correct |
93 |
Correct |
174 ms |
191224 KB |
Output is correct |
94 |
Correct |
3 ms |
3160 KB |
Output is correct |
95 |
Correct |
4 ms |
3160 KB |
Output is correct |
96 |
Correct |
4 ms |
3160 KB |
Output is correct |
97 |
Correct |
3 ms |
3160 KB |
Output is correct |
98 |
Correct |
3 ms |
3112 KB |
Output is correct |
99 |
Correct |
5 ms |
3160 KB |
Output is correct |
100 |
Correct |
3 ms |
3160 KB |
Output is correct |
101 |
Correct |
3 ms |
3160 KB |
Output is correct |
102 |
Correct |
3 ms |
3160 KB |
Output is correct |
103 |
Correct |
3 ms |
3160 KB |
Output is correct |
104 |
Correct |
1123 ms |
171460 KB |
Output is correct |
105 |
Correct |
1345 ms |
194756 KB |
Output is correct |
106 |
Correct |
1199 ms |
194752 KB |
Output is correct |
107 |
Correct |
1300 ms |
196516 KB |
Output is correct |
108 |
Correct |
1115 ms |
196476 KB |
Output is correct |
109 |
Correct |
1308 ms |
196292 KB |
Output is correct |
110 |
Correct |
1342 ms |
196560 KB |
Output is correct |
111 |
Correct |
869 ms |
191244 KB |
Output is correct |
112 |
Correct |
827 ms |
191232 KB |
Output is correct |
113 |
Correct |
893 ms |
191060 KB |
Output is correct |
114 |
Correct |
926 ms |
191044 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
482 ms |
109816 KB |
Output is correct |
2 |
Correct |
955 ms |
191172 KB |
Output is correct |
3 |
Correct |
871 ms |
191088 KB |
Output is correct |
4 |
Correct |
937 ms |
191152 KB |
Output is correct |
5 |
Correct |
1064 ms |
191152 KB |
Output is correct |
6 |
Correct |
964 ms |
191160 KB |
Output is correct |
7 |
Correct |
1002 ms |
191032 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
3160 KB |
Output is correct |
10 |
Correct |
5 ms |
3160 KB |
Output is correct |
11 |
Correct |
1 ms |
856 KB |
Output is correct |
12 |
Correct |
4 ms |
3160 KB |
Output is correct |
13 |
Correct |
4 ms |
3160 KB |
Output is correct |
14 |
Correct |
4 ms |
3160 KB |
Output is correct |
15 |
Correct |
5 ms |
3160 KB |
Output is correct |
16 |
Correct |
5 ms |
3160 KB |
Output is correct |
17 |
Correct |
6 ms |
3160 KB |
Output is correct |
18 |
Correct |
3 ms |
3128 KB |
Output is correct |
19 |
Correct |
3 ms |
3160 KB |
Output is correct |
20 |
Correct |
4 ms |
3160 KB |
Output is correct |
21 |
Correct |
3 ms |
3160 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
5 ms |
3160 KB |
Output is correct |
24 |
Correct |
4 ms |
3160 KB |
Output is correct |
25 |
Correct |
4 ms |
3160 KB |
Output is correct |
26 |
Correct |
4 ms |
3160 KB |
Output is correct |
27 |
Correct |
4 ms |
3160 KB |
Output is correct |
28 |
Correct |
5 ms |
3160 KB |
Output is correct |
29 |
Correct |
5 ms |
3160 KB |
Output is correct |
30 |
Correct |
4 ms |
3160 KB |
Output is correct |
31 |
Correct |
5 ms |
3272 KB |
Output is correct |
32 |
Correct |
4 ms |
3160 KB |
Output is correct |
33 |
Correct |
3 ms |
3160 KB |
Output is correct |
34 |
Correct |
4 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
1368 KB |
Output is correct |
36 |
Correct |
4 ms |
3176 KB |
Output is correct |
37 |
Correct |
4 ms |
3160 KB |
Output is correct |
38 |
Correct |
5 ms |
3160 KB |
Output is correct |
39 |
Correct |
6 ms |
3160 KB |
Output is correct |
40 |
Correct |
3 ms |
3160 KB |
Output is correct |
41 |
Correct |
5 ms |
3160 KB |
Output is correct |
42 |
Correct |
3 ms |
3160 KB |
Output is correct |
43 |
Correct |
3 ms |
3160 KB |
Output is correct |
44 |
Correct |
3 ms |
3160 KB |
Output is correct |
45 |
Correct |
4 ms |
3160 KB |
Output is correct |
46 |
Correct |
189 ms |
122568 KB |
Output is correct |
47 |
Correct |
304 ms |
194760 KB |
Output is correct |
48 |
Correct |
293 ms |
194520 KB |
Output is correct |
49 |
Correct |
314 ms |
196580 KB |
Output is correct |
50 |
Correct |
326 ms |
196648 KB |
Output is correct |
51 |
Correct |
304 ms |
196292 KB |
Output is correct |
52 |
Correct |
318 ms |
196400 KB |
Output is correct |
53 |
Correct |
186 ms |
191156 KB |
Output is correct |
54 |
Correct |
186 ms |
191000 KB |
Output is correct |
55 |
Correct |
192 ms |
191116 KB |
Output is correct |
56 |
Correct |
209 ms |
191068 KB |
Output is correct |
57 |
Correct |
309 ms |
194584 KB |
Output is correct |
58 |
Correct |
317 ms |
196292 KB |
Output is correct |
59 |
Correct |
324 ms |
196292 KB |
Output is correct |
60 |
Correct |
203 ms |
191124 KB |
Output is correct |
61 |
Correct |
185 ms |
191172 KB |
Output is correct |
62 |
Correct |
299 ms |
194612 KB |
Output is correct |
63 |
Correct |
359 ms |
196292 KB |
Output is correct |
64 |
Correct |
327 ms |
196292 KB |
Output is correct |
65 |
Correct |
196 ms |
191136 KB |
Output is correct |
66 |
Correct |
171 ms |
191228 KB |
Output is correct |
67 |
Correct |
274 ms |
187736 KB |
Output is correct |
68 |
Correct |
291 ms |
194756 KB |
Output is correct |
69 |
Correct |
290 ms |
194756 KB |
Output is correct |
70 |
Correct |
315 ms |
196328 KB |
Output is correct |
71 |
Correct |
292 ms |
196488 KB |
Output is correct |
72 |
Correct |
327 ms |
196508 KB |
Output is correct |
73 |
Correct |
305 ms |
196292 KB |
Output is correct |
74 |
Correct |
177 ms |
191060 KB |
Output is correct |
75 |
Correct |
189 ms |
191224 KB |
Output is correct |
76 |
Correct |
181 ms |
191208 KB |
Output is correct |
77 |
Correct |
214 ms |
191040 KB |
Output is correct |
78 |
Correct |
1152 ms |
193276 KB |
Output is correct |
79 |
Correct |
1507 ms |
194756 KB |
Output is correct |
80 |
Correct |
1506 ms |
194756 KB |
Output is correct |
81 |
Correct |
1532 ms |
196436 KB |
Output is correct |
82 |
Correct |
1532 ms |
196548 KB |
Output is correct |
83 |
Correct |
1646 ms |
196448 KB |
Output is correct |
84 |
Correct |
1506 ms |
196308 KB |
Output is correct |
85 |
Correct |
953 ms |
191152 KB |
Output is correct |
86 |
Correct |
875 ms |
191016 KB |
Output is correct |
87 |
Correct |
901 ms |
191096 KB |
Output is correct |
88 |
Correct |
849 ms |
191032 KB |
Output is correct |
89 |
Correct |
899 ms |
191176 KB |
Output is correct |
90 |
Correct |
918 ms |
191192 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
3 ms |
3112 KB |
Output is correct |
93 |
Correct |
3 ms |
3160 KB |
Output is correct |
94 |
Correct |
274 ms |
194728 KB |
Output is correct |
95 |
Correct |
295 ms |
196292 KB |
Output is correct |
96 |
Correct |
298 ms |
196440 KB |
Output is correct |
97 |
Correct |
181 ms |
191152 KB |
Output is correct |
98 |
Correct |
179 ms |
191040 KB |
Output is correct |
99 |
Correct |
277 ms |
194772 KB |
Output is correct |
100 |
Correct |
287 ms |
196292 KB |
Output is correct |
101 |
Correct |
285 ms |
196292 KB |
Output is correct |
102 |
Correct |
167 ms |
191152 KB |
Output is correct |
103 |
Correct |
174 ms |
191224 KB |
Output is correct |
104 |
Correct |
3 ms |
3160 KB |
Output is correct |
105 |
Correct |
4 ms |
3160 KB |
Output is correct |
106 |
Correct |
4 ms |
3160 KB |
Output is correct |
107 |
Correct |
3 ms |
3160 KB |
Output is correct |
108 |
Correct |
3 ms |
3112 KB |
Output is correct |
109 |
Correct |
5 ms |
3160 KB |
Output is correct |
110 |
Correct |
3 ms |
3160 KB |
Output is correct |
111 |
Correct |
3 ms |
3160 KB |
Output is correct |
112 |
Correct |
3 ms |
3160 KB |
Output is correct |
113 |
Correct |
3 ms |
3160 KB |
Output is correct |
114 |
Correct |
276 ms |
41992 KB |
Output is correct |
115 |
Correct |
1064 ms |
194712 KB |
Output is correct |
116 |
Correct |
1099 ms |
194556 KB |
Output is correct |
117 |
Correct |
1085 ms |
196344 KB |
Output is correct |
118 |
Correct |
1060 ms |
196548 KB |
Output is correct |
119 |
Correct |
1136 ms |
196496 KB |
Output is correct |
120 |
Correct |
1162 ms |
196296 KB |
Output is correct |
121 |
Correct |
779 ms |
191152 KB |
Output is correct |
122 |
Correct |
822 ms |
191152 KB |
Output is correct |
123 |
Correct |
866 ms |
191216 KB |
Output is correct |
124 |
Correct |
882 ms |
191008 KB |
Output is correct |
125 |
Correct |
265 ms |
194756 KB |
Output is correct |
126 |
Correct |
273 ms |
196496 KB |
Output is correct |
127 |
Correct |
278 ms |
196436 KB |
Output is correct |
128 |
Correct |
176 ms |
191012 KB |
Output is correct |
129 |
Correct |
169 ms |
191224 KB |
Output is correct |
130 |
Correct |
255 ms |
187584 KB |
Output is correct |
131 |
Correct |
252 ms |
194756 KB |
Output is correct |
132 |
Correct |
267 ms |
194636 KB |
Output is correct |
133 |
Correct |
299 ms |
196388 KB |
Output is correct |
134 |
Correct |
311 ms |
196424 KB |
Output is correct |
135 |
Correct |
293 ms |
196372 KB |
Output is correct |
136 |
Correct |
274 ms |
196292 KB |
Output is correct |
137 |
Correct |
169 ms |
191000 KB |
Output is correct |
138 |
Correct |
191 ms |
191056 KB |
Output is correct |
139 |
Correct |
168 ms |
191208 KB |
Output is correct |
140 |
Correct |
181 ms |
191204 KB |
Output is correct |
141 |
Correct |
3 ms |
3160 KB |
Output is correct |
142 |
Correct |
4 ms |
3160 KB |
Output is correct |
143 |
Correct |
4 ms |
3160 KB |
Output is correct |
144 |
Correct |
3 ms |
3160 KB |
Output is correct |
145 |
Correct |
3 ms |
3160 KB |
Output is correct |
146 |
Correct |
1 ms |
1368 KB |
Output is correct |
147 |
Correct |
4 ms |
3156 KB |
Output is correct |
148 |
Correct |
3 ms |
3160 KB |
Output is correct |
149 |
Correct |
4 ms |
3160 KB |
Output is correct |
150 |
Correct |
4 ms |
3160 KB |
Output is correct |
151 |
Correct |
3 ms |
3160 KB |
Output is correct |
152 |
Correct |
3 ms |
3160 KB |
Output is correct |
153 |
Correct |
3 ms |
3160 KB |
Output is correct |
154 |
Correct |
3 ms |
3160 KB |
Output is correct |
155 |
Correct |
3 ms |
3160 KB |
Output is correct |
156 |
Correct |
3 ms |
3160 KB |
Output is correct |
157 |
Correct |
1123 ms |
171460 KB |
Output is correct |
158 |
Correct |
1345 ms |
194756 KB |
Output is correct |
159 |
Correct |
1199 ms |
194752 KB |
Output is correct |
160 |
Correct |
1300 ms |
196516 KB |
Output is correct |
161 |
Correct |
1115 ms |
196476 KB |
Output is correct |
162 |
Correct |
1308 ms |
196292 KB |
Output is correct |
163 |
Correct |
1342 ms |
196560 KB |
Output is correct |
164 |
Correct |
869 ms |
191244 KB |
Output is correct |
165 |
Correct |
827 ms |
191232 KB |
Output is correct |
166 |
Correct |
893 ms |
191060 KB |
Output is correct |
167 |
Correct |
926 ms |
191044 KB |
Output is correct |
168 |
Correct |
1 ms |
344 KB |
Output is correct |
169 |
Correct |
832 ms |
62536 KB |
Output is correct |
170 |
Correct |
1574 ms |
194652 KB |
Output is correct |
171 |
Correct |
1553 ms |
194760 KB |
Output is correct |
172 |
Correct |
1596 ms |
196448 KB |
Output is correct |
173 |
Correct |
1601 ms |
196400 KB |
Output is correct |
174 |
Correct |
1629 ms |
196532 KB |
Output is correct |
175 |
Correct |
1604 ms |
196540 KB |
Output is correct |
176 |
Correct |
877 ms |
191096 KB |
Output is correct |
177 |
Correct |
899 ms |
191148 KB |
Output is correct |
178 |
Correct |
840 ms |
191184 KB |
Output is correct |
179 |
Correct |
927 ms |
191136 KB |
Output is correct |