#include <bits/stdc++.h>
#include "towers.h"
#define F first
#define S second
using namespace std;
const int N = 1e5 + 10 , inf = 1e9 , Lg = 17;
int n , a[N] , rmxq[N][Lg] , rmnq[N][Lg] , lg2[N] , nexL[N] , nexR[N] , las;
int b[N] , psum[N] , m;
vector <int> all;
vector <pair<int , int>> good;
int mn_pos(int aa , int bb)
{
if(a[aa] < a[bb])
return aa;
return bb;
}
int mx_pos(int aa , int bb)
{
if(a[aa] > a[bb])
return aa;
return bb;
}
int Get_mx(int l , int r)
{
r++;
int sz = (r - l); sz = lg2[sz];
return mx_pos(rmxq[l][sz] , rmxq[r - (1 << sz)][sz]);
}
int Get_mn(int l , int r)
{
r++;
int sz = (r - l); sz = lg2[sz];
return mn_pos(rmnq[l][sz] , rmnq[r - (1 << sz)][sz]);
}
void Build()
{
lg2[1] = 0;
for(int i = 2 ; i < N ; i++)
lg2[i] = lg2[i / 2] + 1;
for(int i = 0 ; i < n ; i++)
rmnq[i][0] = rmxq[i][0] = i;
for(int j = 1 ; j < Lg ; j++)
{
int len = (1 << j);
for(int i = 0 ; i + len <= n ; i++)
{
rmnq[i][j] = mn_pos(rmnq[i][j - 1] , rmnq[i + len / 2][j - 1]);
rmxq[i][j] = mx_pos(rmxq[i][j - 1] , rmxq[i + len / 2][j - 1]);
}
}
for(int i = 1 ; i + 1 < n ; i++) if(a[i] > a[i - 1] && a[i] > a[i + 1])
b[i] = 1;
for(int i = 1 ; i < n ; i++)
psum[i] = psum[i - 1] + b[i];
vector <int> st;
for(int i = 0 ; i < n ; i++)
{
nexL[i] = -1;
nexR[i] = n;
while(!st.empty())
{
if(a[st.back()] < a[i])
{
nexR[st.back()] = i;
st.pop_back();
}
else
{
nexL[i] = st.back();
break;
}
}
st.push_back(i);
}
for(int i = 0 ; i < n ; i++) if(i - nexL[i] > 1 && nexR[i] - i > 1)
{
int lc = Get_mn(nexL[i] + 1 , i - 1) , rc = Get_mn(i + 1 , nexR[i] - 1);
all.push_back(a[i] - max(a[lc] , a[rc]));
}
sort(all.begin() , all.end());
}
void init(int nn , vector <int> vec)
{
n = nn;
for(int i = 0 ; i < n ; i++)
a[i] = vec[i];
Build();
}
int Solve(int l , int r , int d)
{
if(l > r)
return 0;
int pos_mx = Get_mx(l , r);
int res = Solve(l , pos_mx - 1 , d) + Solve(pos_mx + 1 , r , d);
if(pos_mx != l && pos_mx != r)
{
int lc = Get_mn(l , pos_mx - 1) , rc = Get_mn(pos_mx + 1 , r);
if(a[pos_mx] - a[lc] >= d && a[pos_mx] - a[rc] >= d)
res++;
}
return res;
}
bool cmp(pair <int , int> aa , pair <int , int> bb)
{
return aa.S < bb.S;
}
struct SEG
{
vector <int> t[N << 2];
int mx[N << 2] , mn[N << 2];
void Build(int node = 1 , int nl = 0 , int nr = m)
{
t[node].clear();
if(nr - nl == 1)
{
t[node].push_back(good[nl].F);
mx[node] = good[nl].S;
mn[node] = good[nl].S;
return;
}
int mid = (nl + nr) >> 1 , lc = node << 1 , rc = lc | 1;
Build(lc , nl , mid); Build(rc , mid , nr);
t[node] = t[lc];
for(auto u : t[rc])
t[node].push_back(u);
sort(t[node].begin() , t[node].end());
mx[node] = max(mx[lc] , mx[rc]);
mn[node] = min(mn[lc] , mn[rc]);
}
int Get(int l , int r , int node = 1 , int nl = 0 , int nr = m)
{
//cout << node << " " << nl << " " << nr << " " << mx[node] << endl;
if(mx[node] <= r)
{
int id = lower_bound(t[node].begin() , t[node].end() , l) - t[node].begin();
//cout << "WTF " << id << endl;
return t[node].size() - id;
}
if(mn[node] > r)
return 0;
int mid = (nl + nr) >> 1 , lc = node << 1 , rc = lc | 1;
return Get(l , r , lc , nl , mid) + Get(l , r , rc , mid , nr);
}
} seg;
void Prep(int d)
{
good.clear();
for(int i = 0 ; i < n ; i++) if(i - nexL[i] > 1 && nexR[i] - i > 1)
{
int lc = Get_mn(nexL[i] + 1 , i - 1) , rc = Get_mn(i + 1 , nexR[i] - 1);
int mx_d = a[i] - max(a[lc] , a[rc]);
if(d > mx_d)
continue;
int low = nexL[i] + 1 , high = i;
while(high - low > 1)
{
int mid = (low + high) >> 1;
lc = Get_mn(mid , i - 1);
if(a[i] - a[lc] >= d)
low = mid;
else
high = mid;
}
int L = low;
low = i; high = nexR[i] - 1;
while(high - low > 1)
{
int mid = (low + high) >> 1;
rc = Get_mn(i + 1 , mid);
if(a[i] - a[rc] >= d)
high = mid;
else
low = mid;
}
int R = high;
//cout << i << " " << d << " WTF " << L << " " << R << endl;
good.push_back({L , R});
}
m = good.size();
sort(good.begin() , good.end() , cmp);
if(m != 0)
seg.Build();
}
int max_towers(int l , int r , int d)
{
if(d == 1)
{
if(l + 1 >= r)
return 1;
return 1 + psum[r - 1] - psum[l];
}
if(psum[r - 1] - psum[l] == 0)
return 1;
/*if(psum[r - 1] - psum[l] == 1)
{
int id = Get_mx(l , r);
int lc = Get_mn(l , id - 1) , rc = Get_mn(id + 1 , r);
if(a[id] - d >= a[lc] && a[id] - d >= a[rc])
return 2;
return 1;
}*/
if(l == 0 && r == n - 1)
{
int id = lower_bound(all.begin() , all.end() , d) - all.begin();
return all.size() - id + 1;
}
if(las != d)
{
Prep(d);
las = d;
}
if(las == d)
{
if(m == 0)
return 1;
return seg.Get(l , r) + 1;
}
return 1 + Solve(l , r , d);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1055 ms |
25708 KB |
Output is correct |
2 |
Correct |
1433 ms |
28880 KB |
Output is correct |
3 |
Correct |
1338 ms |
28880 KB |
Output is correct |
4 |
Correct |
524 ms |
27224 KB |
Output is correct |
5 |
Correct |
524 ms |
27860 KB |
Output is correct |
6 |
Correct |
514 ms |
27224 KB |
Output is correct |
7 |
Correct |
484 ms |
27860 KB |
Output is correct |
8 |
Correct |
2 ms |
14932 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
2 ms |
16984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16984 KB |
Output is correct |
2 |
Correct |
2 ms |
19032 KB |
Output is correct |
3 |
Correct |
3 ms |
19032 KB |
Output is correct |
4 |
Correct |
2 ms |
19032 KB |
Output is correct |
5 |
Correct |
2 ms |
19032 KB |
Output is correct |
6 |
Correct |
2 ms |
19032 KB |
Output is correct |
7 |
Correct |
2 ms |
19032 KB |
Output is correct |
8 |
Correct |
2 ms |
16984 KB |
Output is correct |
9 |
Correct |
2 ms |
16984 KB |
Output is correct |
10 |
Correct |
2 ms |
16984 KB |
Output is correct |
11 |
Correct |
2 ms |
16984 KB |
Output is correct |
12 |
Correct |
2 ms |
14936 KB |
Output is correct |
13 |
Correct |
2 ms |
16984 KB |
Output is correct |
14 |
Correct |
2 ms |
16984 KB |
Output is correct |
15 |
Correct |
2 ms |
16984 KB |
Output is correct |
16 |
Correct |
2 ms |
16984 KB |
Output is correct |
17 |
Correct |
2 ms |
16984 KB |
Output is correct |
18 |
Correct |
2 ms |
16984 KB |
Output is correct |
19 |
Correct |
2 ms |
16984 KB |
Output is correct |
20 |
Correct |
2 ms |
16984 KB |
Output is correct |
21 |
Correct |
2 ms |
16984 KB |
Output is correct |
22 |
Correct |
2 ms |
16984 KB |
Output is correct |
23 |
Correct |
2 ms |
17004 KB |
Output is correct |
24 |
Correct |
2 ms |
16984 KB |
Output is correct |
25 |
Correct |
3 ms |
16984 KB |
Output is correct |
26 |
Correct |
2 ms |
16984 KB |
Output is correct |
27 |
Correct |
2 ms |
16984 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
3 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
16984 KB |
Output is correct |
34 |
Correct |
2 ms |
16984 KB |
Output is correct |
35 |
Correct |
2 ms |
16984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16984 KB |
Output is correct |
2 |
Correct |
2 ms |
19032 KB |
Output is correct |
3 |
Correct |
3 ms |
19032 KB |
Output is correct |
4 |
Correct |
2 ms |
19032 KB |
Output is correct |
5 |
Correct |
2 ms |
19032 KB |
Output is correct |
6 |
Correct |
2 ms |
19032 KB |
Output is correct |
7 |
Correct |
2 ms |
19032 KB |
Output is correct |
8 |
Correct |
2 ms |
16984 KB |
Output is correct |
9 |
Correct |
2 ms |
16984 KB |
Output is correct |
10 |
Correct |
2 ms |
16984 KB |
Output is correct |
11 |
Correct |
2 ms |
16984 KB |
Output is correct |
12 |
Correct |
2 ms |
14936 KB |
Output is correct |
13 |
Correct |
2 ms |
16984 KB |
Output is correct |
14 |
Correct |
2 ms |
16984 KB |
Output is correct |
15 |
Correct |
2 ms |
16984 KB |
Output is correct |
16 |
Correct |
2 ms |
16984 KB |
Output is correct |
17 |
Correct |
2 ms |
16984 KB |
Output is correct |
18 |
Correct |
2 ms |
16984 KB |
Output is correct |
19 |
Correct |
2 ms |
16984 KB |
Output is correct |
20 |
Correct |
2 ms |
16984 KB |
Output is correct |
21 |
Correct |
2 ms |
16984 KB |
Output is correct |
22 |
Correct |
2 ms |
16984 KB |
Output is correct |
23 |
Correct |
2 ms |
17004 KB |
Output is correct |
24 |
Correct |
2 ms |
16984 KB |
Output is correct |
25 |
Correct |
3 ms |
16984 KB |
Output is correct |
26 |
Correct |
2 ms |
16984 KB |
Output is correct |
27 |
Correct |
2 ms |
16984 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
3 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
16984 KB |
Output is correct |
34 |
Correct |
2 ms |
16984 KB |
Output is correct |
35 |
Correct |
2 ms |
16984 KB |
Output is correct |
36 |
Correct |
21 ms |
30552 KB |
Output is correct |
37 |
Correct |
21 ms |
30028 KB |
Output is correct |
38 |
Correct |
26 ms |
32068 KB |
Output is correct |
39 |
Correct |
18 ms |
29260 KB |
Output is correct |
40 |
Correct |
31 ms |
34812 KB |
Output is correct |
41 |
Correct |
26 ms |
32460 KB |
Output is correct |
42 |
Correct |
34 ms |
36428 KB |
Output is correct |
43 |
Correct |
14 ms |
27360 KB |
Output is correct |
44 |
Correct |
15 ms |
27860 KB |
Output is correct |
45 |
Correct |
14 ms |
27224 KB |
Output is correct |
46 |
Correct |
14 ms |
27608 KB |
Output is correct |
47 |
Correct |
23 ms |
27736 KB |
Output is correct |
48 |
Correct |
17 ms |
27736 KB |
Output is correct |
49 |
Correct |
17 ms |
27736 KB |
Output is correct |
50 |
Correct |
14 ms |
27992 KB |
Output is correct |
51 |
Correct |
19 ms |
27252 KB |
Output is correct |
52 |
Correct |
17 ms |
27616 KB |
Output is correct |
53 |
Correct |
17 ms |
27736 KB |
Output is correct |
54 |
Correct |
17 ms |
27608 KB |
Output is correct |
55 |
Correct |
15 ms |
27776 KB |
Output is correct |
56 |
Correct |
14 ms |
27364 KB |
Output is correct |
57 |
Correct |
22 ms |
27132 KB |
Output is correct |
58 |
Correct |
17 ms |
27732 KB |
Output is correct |
59 |
Correct |
23 ms |
27676 KB |
Output is correct |
60 |
Correct |
18 ms |
27736 KB |
Output is correct |
61 |
Correct |
18 ms |
27656 KB |
Output is correct |
62 |
Correct |
19 ms |
27736 KB |
Output is correct |
63 |
Correct |
20 ms |
27736 KB |
Output is correct |
64 |
Correct |
21 ms |
27144 KB |
Output is correct |
65 |
Correct |
20 ms |
27780 KB |
Output is correct |
66 |
Correct |
14 ms |
27224 KB |
Output is correct |
67 |
Correct |
14 ms |
27788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
426 ms |
27480 KB |
Output is correct |
2 |
Correct |
516 ms |
27736 KB |
Output is correct |
3 |
Correct |
559 ms |
27736 KB |
Output is correct |
4 |
Correct |
546 ms |
27736 KB |
Output is correct |
5 |
Correct |
490 ms |
27612 KB |
Output is correct |
6 |
Correct |
540 ms |
27736 KB |
Output is correct |
7 |
Correct |
495 ms |
27644 KB |
Output is correct |
8 |
Correct |
497 ms |
27224 KB |
Output is correct |
9 |
Correct |
520 ms |
27860 KB |
Output is correct |
10 |
Correct |
587 ms |
27224 KB |
Output is correct |
11 |
Correct |
430 ms |
27780 KB |
Output is correct |
12 |
Correct |
508 ms |
27224 KB |
Output is correct |
13 |
Correct |
516 ms |
27860 KB |
Output is correct |
14 |
Correct |
2 ms |
14936 KB |
Output is correct |
15 |
Correct |
2 ms |
16992 KB |
Output is correct |
16 |
Correct |
2 ms |
16984 KB |
Output is correct |
17 |
Correct |
17 ms |
27736 KB |
Output is correct |
18 |
Correct |
17 ms |
27660 KB |
Output is correct |
19 |
Correct |
18 ms |
27612 KB |
Output is correct |
20 |
Correct |
15 ms |
27860 KB |
Output is correct |
21 |
Correct |
14 ms |
27224 KB |
Output is correct |
22 |
Correct |
17 ms |
27744 KB |
Output is correct |
23 |
Correct |
18 ms |
27736 KB |
Output is correct |
24 |
Correct |
18 ms |
27736 KB |
Output is correct |
25 |
Correct |
21 ms |
27936 KB |
Output is correct |
26 |
Correct |
15 ms |
27224 KB |
Output is correct |
27 |
Correct |
2 ms |
16984 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
2 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
16984 KB |
Output is correct |
34 |
Correct |
3 ms |
16984 KB |
Output is correct |
35 |
Correct |
2 ms |
16984 KB |
Output is correct |
36 |
Correct |
2 ms |
16984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
154 ms |
17348 KB |
Output is correct |
2 |
Correct |
573 ms |
27736 KB |
Output is correct |
3 |
Correct |
578 ms |
27648 KB |
Output is correct |
4 |
Correct |
596 ms |
27736 KB |
Output is correct |
5 |
Correct |
558 ms |
27736 KB |
Output is correct |
6 |
Correct |
556 ms |
27736 KB |
Output is correct |
7 |
Correct |
545 ms |
27728 KB |
Output is correct |
8 |
Correct |
485 ms |
27224 KB |
Output is correct |
9 |
Correct |
540 ms |
27860 KB |
Output is correct |
10 |
Correct |
538 ms |
27224 KB |
Output is correct |
11 |
Correct |
556 ms |
27860 KB |
Output is correct |
12 |
Correct |
17 ms |
27736 KB |
Output is correct |
13 |
Correct |
17 ms |
27736 KB |
Output is correct |
14 |
Correct |
17 ms |
27656 KB |
Output is correct |
15 |
Correct |
14 ms |
27860 KB |
Output is correct |
16 |
Correct |
15 ms |
27224 KB |
Output is correct |
17 |
Correct |
17 ms |
27112 KB |
Output is correct |
18 |
Correct |
17 ms |
27660 KB |
Output is correct |
19 |
Correct |
17 ms |
27736 KB |
Output is correct |
20 |
Correct |
17 ms |
27736 KB |
Output is correct |
21 |
Correct |
20 ms |
27652 KB |
Output is correct |
22 |
Correct |
17 ms |
27736 KB |
Output is correct |
23 |
Correct |
17 ms |
27736 KB |
Output is correct |
24 |
Correct |
14 ms |
27224 KB |
Output is correct |
25 |
Correct |
14 ms |
27860 KB |
Output is correct |
26 |
Correct |
14 ms |
27224 KB |
Output is correct |
27 |
Correct |
18 ms |
27988 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
2 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
16984 KB |
Output is correct |
34 |
Correct |
2 ms |
16984 KB |
Output is correct |
35 |
Correct |
2 ms |
16984 KB |
Output is correct |
36 |
Correct |
2 ms |
17004 KB |
Output is correct |
37 |
Correct |
2 ms |
16984 KB |
Output is correct |
38 |
Correct |
2 ms |
16984 KB |
Output is correct |
39 |
Correct |
2 ms |
16984 KB |
Output is correct |
40 |
Correct |
2 ms |
16984 KB |
Output is correct |
41 |
Correct |
2 ms |
16984 KB |
Output is correct |
42 |
Correct |
2 ms |
17000 KB |
Output is correct |
43 |
Correct |
2 ms |
16984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16984 KB |
Output is correct |
2 |
Correct |
2 ms |
19032 KB |
Output is correct |
3 |
Correct |
3 ms |
19032 KB |
Output is correct |
4 |
Correct |
2 ms |
19032 KB |
Output is correct |
5 |
Correct |
2 ms |
19032 KB |
Output is correct |
6 |
Correct |
2 ms |
19032 KB |
Output is correct |
7 |
Correct |
2 ms |
19032 KB |
Output is correct |
8 |
Correct |
2 ms |
16984 KB |
Output is correct |
9 |
Correct |
2 ms |
16984 KB |
Output is correct |
10 |
Correct |
2 ms |
16984 KB |
Output is correct |
11 |
Correct |
2 ms |
16984 KB |
Output is correct |
12 |
Correct |
2 ms |
14936 KB |
Output is correct |
13 |
Correct |
2 ms |
16984 KB |
Output is correct |
14 |
Correct |
2 ms |
16984 KB |
Output is correct |
15 |
Correct |
2 ms |
16984 KB |
Output is correct |
16 |
Correct |
2 ms |
16984 KB |
Output is correct |
17 |
Correct |
2 ms |
16984 KB |
Output is correct |
18 |
Correct |
2 ms |
16984 KB |
Output is correct |
19 |
Correct |
2 ms |
16984 KB |
Output is correct |
20 |
Correct |
2 ms |
16984 KB |
Output is correct |
21 |
Correct |
2 ms |
16984 KB |
Output is correct |
22 |
Correct |
2 ms |
16984 KB |
Output is correct |
23 |
Correct |
2 ms |
17004 KB |
Output is correct |
24 |
Correct |
2 ms |
16984 KB |
Output is correct |
25 |
Correct |
3 ms |
16984 KB |
Output is correct |
26 |
Correct |
2 ms |
16984 KB |
Output is correct |
27 |
Correct |
2 ms |
16984 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
3 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
16984 KB |
Output is correct |
34 |
Correct |
2 ms |
16984 KB |
Output is correct |
35 |
Correct |
2 ms |
16984 KB |
Output is correct |
36 |
Correct |
21 ms |
30552 KB |
Output is correct |
37 |
Correct |
21 ms |
30028 KB |
Output is correct |
38 |
Correct |
26 ms |
32068 KB |
Output is correct |
39 |
Correct |
18 ms |
29260 KB |
Output is correct |
40 |
Correct |
31 ms |
34812 KB |
Output is correct |
41 |
Correct |
26 ms |
32460 KB |
Output is correct |
42 |
Correct |
34 ms |
36428 KB |
Output is correct |
43 |
Correct |
14 ms |
27360 KB |
Output is correct |
44 |
Correct |
15 ms |
27860 KB |
Output is correct |
45 |
Correct |
14 ms |
27224 KB |
Output is correct |
46 |
Correct |
14 ms |
27608 KB |
Output is correct |
47 |
Correct |
23 ms |
27736 KB |
Output is correct |
48 |
Correct |
17 ms |
27736 KB |
Output is correct |
49 |
Correct |
17 ms |
27736 KB |
Output is correct |
50 |
Correct |
14 ms |
27992 KB |
Output is correct |
51 |
Correct |
19 ms |
27252 KB |
Output is correct |
52 |
Correct |
17 ms |
27616 KB |
Output is correct |
53 |
Correct |
17 ms |
27736 KB |
Output is correct |
54 |
Correct |
17 ms |
27608 KB |
Output is correct |
55 |
Correct |
15 ms |
27776 KB |
Output is correct |
56 |
Correct |
14 ms |
27364 KB |
Output is correct |
57 |
Correct |
22 ms |
27132 KB |
Output is correct |
58 |
Correct |
17 ms |
27732 KB |
Output is correct |
59 |
Correct |
23 ms |
27676 KB |
Output is correct |
60 |
Correct |
18 ms |
27736 KB |
Output is correct |
61 |
Correct |
18 ms |
27656 KB |
Output is correct |
62 |
Correct |
19 ms |
27736 KB |
Output is correct |
63 |
Correct |
20 ms |
27736 KB |
Output is correct |
64 |
Correct |
21 ms |
27144 KB |
Output is correct |
65 |
Correct |
20 ms |
27780 KB |
Output is correct |
66 |
Correct |
14 ms |
27224 KB |
Output is correct |
67 |
Correct |
14 ms |
27788 KB |
Output is correct |
68 |
Correct |
426 ms |
27480 KB |
Output is correct |
69 |
Correct |
516 ms |
27736 KB |
Output is correct |
70 |
Correct |
559 ms |
27736 KB |
Output is correct |
71 |
Correct |
546 ms |
27736 KB |
Output is correct |
72 |
Correct |
490 ms |
27612 KB |
Output is correct |
73 |
Correct |
540 ms |
27736 KB |
Output is correct |
74 |
Correct |
495 ms |
27644 KB |
Output is correct |
75 |
Correct |
497 ms |
27224 KB |
Output is correct |
76 |
Correct |
520 ms |
27860 KB |
Output is correct |
77 |
Correct |
587 ms |
27224 KB |
Output is correct |
78 |
Correct |
430 ms |
27780 KB |
Output is correct |
79 |
Correct |
508 ms |
27224 KB |
Output is correct |
80 |
Correct |
516 ms |
27860 KB |
Output is correct |
81 |
Correct |
2 ms |
14936 KB |
Output is correct |
82 |
Correct |
2 ms |
16992 KB |
Output is correct |
83 |
Correct |
2 ms |
16984 KB |
Output is correct |
84 |
Correct |
17 ms |
27736 KB |
Output is correct |
85 |
Correct |
17 ms |
27660 KB |
Output is correct |
86 |
Correct |
18 ms |
27612 KB |
Output is correct |
87 |
Correct |
15 ms |
27860 KB |
Output is correct |
88 |
Correct |
14 ms |
27224 KB |
Output is correct |
89 |
Correct |
17 ms |
27744 KB |
Output is correct |
90 |
Correct |
18 ms |
27736 KB |
Output is correct |
91 |
Correct |
18 ms |
27736 KB |
Output is correct |
92 |
Correct |
21 ms |
27936 KB |
Output is correct |
93 |
Correct |
15 ms |
27224 KB |
Output is correct |
94 |
Correct |
2 ms |
16984 KB |
Output is correct |
95 |
Correct |
2 ms |
16984 KB |
Output is correct |
96 |
Correct |
2 ms |
16984 KB |
Output is correct |
97 |
Correct |
2 ms |
16984 KB |
Output is correct |
98 |
Correct |
2 ms |
16984 KB |
Output is correct |
99 |
Correct |
2 ms |
16984 KB |
Output is correct |
100 |
Correct |
2 ms |
16984 KB |
Output is correct |
101 |
Correct |
3 ms |
16984 KB |
Output is correct |
102 |
Correct |
2 ms |
16984 KB |
Output is correct |
103 |
Correct |
2 ms |
16984 KB |
Output is correct |
104 |
Correct |
518 ms |
31740 KB |
Output is correct |
105 |
Correct |
582 ms |
32332 KB |
Output is correct |
106 |
Correct |
577 ms |
31044 KB |
Output is correct |
107 |
Correct |
570 ms |
33768 KB |
Output is correct |
108 |
Correct |
554 ms |
29648 KB |
Output is correct |
109 |
Correct |
608 ms |
32968 KB |
Output is correct |
110 |
Correct |
571 ms |
36184 KB |
Output is correct |
111 |
Correct |
461 ms |
27224 KB |
Output is correct |
112 |
Correct |
509 ms |
27860 KB |
Output is correct |
113 |
Correct |
526 ms |
28880 KB |
Output is correct |
114 |
Correct |
551 ms |
29076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1055 ms |
25708 KB |
Output is correct |
2 |
Correct |
1433 ms |
28880 KB |
Output is correct |
3 |
Correct |
1338 ms |
28880 KB |
Output is correct |
4 |
Correct |
524 ms |
27224 KB |
Output is correct |
5 |
Correct |
524 ms |
27860 KB |
Output is correct |
6 |
Correct |
514 ms |
27224 KB |
Output is correct |
7 |
Correct |
484 ms |
27860 KB |
Output is correct |
8 |
Correct |
2 ms |
14932 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
2 ms |
16984 KB |
Output is correct |
11 |
Correct |
2 ms |
16984 KB |
Output is correct |
12 |
Correct |
2 ms |
19032 KB |
Output is correct |
13 |
Correct |
3 ms |
19032 KB |
Output is correct |
14 |
Correct |
2 ms |
19032 KB |
Output is correct |
15 |
Correct |
2 ms |
19032 KB |
Output is correct |
16 |
Correct |
2 ms |
19032 KB |
Output is correct |
17 |
Correct |
2 ms |
19032 KB |
Output is correct |
18 |
Correct |
2 ms |
16984 KB |
Output is correct |
19 |
Correct |
2 ms |
16984 KB |
Output is correct |
20 |
Correct |
2 ms |
16984 KB |
Output is correct |
21 |
Correct |
2 ms |
16984 KB |
Output is correct |
22 |
Correct |
2 ms |
14936 KB |
Output is correct |
23 |
Correct |
2 ms |
16984 KB |
Output is correct |
24 |
Correct |
2 ms |
16984 KB |
Output is correct |
25 |
Correct |
2 ms |
16984 KB |
Output is correct |
26 |
Correct |
2 ms |
16984 KB |
Output is correct |
27 |
Correct |
2 ms |
16984 KB |
Output is correct |
28 |
Correct |
2 ms |
16984 KB |
Output is correct |
29 |
Correct |
2 ms |
16984 KB |
Output is correct |
30 |
Correct |
2 ms |
16984 KB |
Output is correct |
31 |
Correct |
2 ms |
16984 KB |
Output is correct |
32 |
Correct |
2 ms |
16984 KB |
Output is correct |
33 |
Correct |
2 ms |
17004 KB |
Output is correct |
34 |
Correct |
2 ms |
16984 KB |
Output is correct |
35 |
Correct |
3 ms |
16984 KB |
Output is correct |
36 |
Correct |
2 ms |
16984 KB |
Output is correct |
37 |
Correct |
2 ms |
16984 KB |
Output is correct |
38 |
Correct |
2 ms |
16984 KB |
Output is correct |
39 |
Correct |
2 ms |
16984 KB |
Output is correct |
40 |
Correct |
3 ms |
16984 KB |
Output is correct |
41 |
Correct |
2 ms |
16984 KB |
Output is correct |
42 |
Correct |
2 ms |
16984 KB |
Output is correct |
43 |
Correct |
2 ms |
16984 KB |
Output is correct |
44 |
Correct |
2 ms |
16984 KB |
Output is correct |
45 |
Correct |
2 ms |
16984 KB |
Output is correct |
46 |
Correct |
21 ms |
30552 KB |
Output is correct |
47 |
Correct |
21 ms |
30028 KB |
Output is correct |
48 |
Correct |
26 ms |
32068 KB |
Output is correct |
49 |
Correct |
18 ms |
29260 KB |
Output is correct |
50 |
Correct |
31 ms |
34812 KB |
Output is correct |
51 |
Correct |
26 ms |
32460 KB |
Output is correct |
52 |
Correct |
34 ms |
36428 KB |
Output is correct |
53 |
Correct |
14 ms |
27360 KB |
Output is correct |
54 |
Correct |
15 ms |
27860 KB |
Output is correct |
55 |
Correct |
14 ms |
27224 KB |
Output is correct |
56 |
Correct |
14 ms |
27608 KB |
Output is correct |
57 |
Correct |
23 ms |
27736 KB |
Output is correct |
58 |
Correct |
17 ms |
27736 KB |
Output is correct |
59 |
Correct |
17 ms |
27736 KB |
Output is correct |
60 |
Correct |
14 ms |
27992 KB |
Output is correct |
61 |
Correct |
19 ms |
27252 KB |
Output is correct |
62 |
Correct |
17 ms |
27616 KB |
Output is correct |
63 |
Correct |
17 ms |
27736 KB |
Output is correct |
64 |
Correct |
17 ms |
27608 KB |
Output is correct |
65 |
Correct |
15 ms |
27776 KB |
Output is correct |
66 |
Correct |
14 ms |
27364 KB |
Output is correct |
67 |
Correct |
22 ms |
27132 KB |
Output is correct |
68 |
Correct |
17 ms |
27732 KB |
Output is correct |
69 |
Correct |
23 ms |
27676 KB |
Output is correct |
70 |
Correct |
18 ms |
27736 KB |
Output is correct |
71 |
Correct |
18 ms |
27656 KB |
Output is correct |
72 |
Correct |
19 ms |
27736 KB |
Output is correct |
73 |
Correct |
20 ms |
27736 KB |
Output is correct |
74 |
Correct |
21 ms |
27144 KB |
Output is correct |
75 |
Correct |
20 ms |
27780 KB |
Output is correct |
76 |
Correct |
14 ms |
27224 KB |
Output is correct |
77 |
Correct |
14 ms |
27788 KB |
Output is correct |
78 |
Correct |
426 ms |
27480 KB |
Output is correct |
79 |
Correct |
516 ms |
27736 KB |
Output is correct |
80 |
Correct |
559 ms |
27736 KB |
Output is correct |
81 |
Correct |
546 ms |
27736 KB |
Output is correct |
82 |
Correct |
490 ms |
27612 KB |
Output is correct |
83 |
Correct |
540 ms |
27736 KB |
Output is correct |
84 |
Correct |
495 ms |
27644 KB |
Output is correct |
85 |
Correct |
497 ms |
27224 KB |
Output is correct |
86 |
Correct |
520 ms |
27860 KB |
Output is correct |
87 |
Correct |
587 ms |
27224 KB |
Output is correct |
88 |
Correct |
430 ms |
27780 KB |
Output is correct |
89 |
Correct |
508 ms |
27224 KB |
Output is correct |
90 |
Correct |
516 ms |
27860 KB |
Output is correct |
91 |
Correct |
2 ms |
14936 KB |
Output is correct |
92 |
Correct |
2 ms |
16992 KB |
Output is correct |
93 |
Correct |
2 ms |
16984 KB |
Output is correct |
94 |
Correct |
17 ms |
27736 KB |
Output is correct |
95 |
Correct |
17 ms |
27660 KB |
Output is correct |
96 |
Correct |
18 ms |
27612 KB |
Output is correct |
97 |
Correct |
15 ms |
27860 KB |
Output is correct |
98 |
Correct |
14 ms |
27224 KB |
Output is correct |
99 |
Correct |
17 ms |
27744 KB |
Output is correct |
100 |
Correct |
18 ms |
27736 KB |
Output is correct |
101 |
Correct |
18 ms |
27736 KB |
Output is correct |
102 |
Correct |
21 ms |
27936 KB |
Output is correct |
103 |
Correct |
15 ms |
27224 KB |
Output is correct |
104 |
Correct |
2 ms |
16984 KB |
Output is correct |
105 |
Correct |
2 ms |
16984 KB |
Output is correct |
106 |
Correct |
2 ms |
16984 KB |
Output is correct |
107 |
Correct |
2 ms |
16984 KB |
Output is correct |
108 |
Correct |
2 ms |
16984 KB |
Output is correct |
109 |
Correct |
2 ms |
16984 KB |
Output is correct |
110 |
Correct |
2 ms |
16984 KB |
Output is correct |
111 |
Correct |
3 ms |
16984 KB |
Output is correct |
112 |
Correct |
2 ms |
16984 KB |
Output is correct |
113 |
Correct |
2 ms |
16984 KB |
Output is correct |
114 |
Correct |
154 ms |
17348 KB |
Output is correct |
115 |
Correct |
573 ms |
27736 KB |
Output is correct |
116 |
Correct |
578 ms |
27648 KB |
Output is correct |
117 |
Correct |
596 ms |
27736 KB |
Output is correct |
118 |
Correct |
558 ms |
27736 KB |
Output is correct |
119 |
Correct |
556 ms |
27736 KB |
Output is correct |
120 |
Correct |
545 ms |
27728 KB |
Output is correct |
121 |
Correct |
485 ms |
27224 KB |
Output is correct |
122 |
Correct |
540 ms |
27860 KB |
Output is correct |
123 |
Correct |
538 ms |
27224 KB |
Output is correct |
124 |
Correct |
556 ms |
27860 KB |
Output is correct |
125 |
Correct |
17 ms |
27736 KB |
Output is correct |
126 |
Correct |
17 ms |
27736 KB |
Output is correct |
127 |
Correct |
17 ms |
27656 KB |
Output is correct |
128 |
Correct |
14 ms |
27860 KB |
Output is correct |
129 |
Correct |
15 ms |
27224 KB |
Output is correct |
130 |
Correct |
17 ms |
27112 KB |
Output is correct |
131 |
Correct |
17 ms |
27660 KB |
Output is correct |
132 |
Correct |
17 ms |
27736 KB |
Output is correct |
133 |
Correct |
17 ms |
27736 KB |
Output is correct |
134 |
Correct |
20 ms |
27652 KB |
Output is correct |
135 |
Correct |
17 ms |
27736 KB |
Output is correct |
136 |
Correct |
17 ms |
27736 KB |
Output is correct |
137 |
Correct |
14 ms |
27224 KB |
Output is correct |
138 |
Correct |
14 ms |
27860 KB |
Output is correct |
139 |
Correct |
14 ms |
27224 KB |
Output is correct |
140 |
Correct |
18 ms |
27988 KB |
Output is correct |
141 |
Correct |
2 ms |
16984 KB |
Output is correct |
142 |
Correct |
2 ms |
16984 KB |
Output is correct |
143 |
Correct |
2 ms |
16984 KB |
Output is correct |
144 |
Correct |
2 ms |
16984 KB |
Output is correct |
145 |
Correct |
2 ms |
16984 KB |
Output is correct |
146 |
Correct |
2 ms |
16984 KB |
Output is correct |
147 |
Correct |
2 ms |
16984 KB |
Output is correct |
148 |
Correct |
2 ms |
16984 KB |
Output is correct |
149 |
Correct |
2 ms |
17004 KB |
Output is correct |
150 |
Correct |
2 ms |
16984 KB |
Output is correct |
151 |
Correct |
2 ms |
16984 KB |
Output is correct |
152 |
Correct |
2 ms |
16984 KB |
Output is correct |
153 |
Correct |
2 ms |
16984 KB |
Output is correct |
154 |
Correct |
2 ms |
16984 KB |
Output is correct |
155 |
Correct |
2 ms |
17000 KB |
Output is correct |
156 |
Correct |
2 ms |
16984 KB |
Output is correct |
157 |
Correct |
518 ms |
31740 KB |
Output is correct |
158 |
Correct |
582 ms |
32332 KB |
Output is correct |
159 |
Correct |
577 ms |
31044 KB |
Output is correct |
160 |
Correct |
570 ms |
33768 KB |
Output is correct |
161 |
Correct |
554 ms |
29648 KB |
Output is correct |
162 |
Correct |
608 ms |
32968 KB |
Output is correct |
163 |
Correct |
571 ms |
36184 KB |
Output is correct |
164 |
Correct |
461 ms |
27224 KB |
Output is correct |
165 |
Correct |
509 ms |
27860 KB |
Output is correct |
166 |
Correct |
526 ms |
28880 KB |
Output is correct |
167 |
Correct |
551 ms |
29076 KB |
Output is correct |
168 |
Correct |
2 ms |
16984 KB |
Output is correct |
169 |
Execution timed out |
4037 ms |
25168 KB |
Time limit exceeded |
170 |
Halted |
0 ms |
0 KB |
- |