#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define en cout << '\n'
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
const int N = 100005, K = 18;
struct Node{
Node *L, *R;
int sum, mostleft, mostright;
Node(){
L=R=nullptr;
sum=0;
mostleft=mostright=0;
}
Node(Node*l, Node*r): L(l), R(r){
sum = 0;
mostleft = 100000000;
mostright = -1;
if(l != nullptr) sum += l->sum, mostleft = min(mostleft, l->mostleft), mostright = max(mostright, l->mostright);
if(r != nullptr) sum += r->sum, mostleft = min(mostleft, r->mostleft), mostright = max(mostright, r->mostright);
}
Node(int s, int pos): sum(s){
if(s == 1)
mostleft = mostright = pos;
else
mostleft = 100000000, mostright = -1;
L=R=nullptr;
}
};
bitset<100005> is_peak;
Node *build(int l, int r){
if(l == r){
return new Node(is_peak[l], l);
}
int m = l+r>>1;
return new Node(build(l, m), build(m+1, r));
}
Node *upd(Node *v, int l, int r, int p, int val){
if(l == r){
return new Node(val, l);
}
int m = l+r>>1;
if(p <= m) return new Node(upd(v->L, l, m, p, val), v->R);
return new Node(v->L, upd(v->R, m+1, r, p, val));
}
array<int, 3> get(Node *v, int l, int r, int ql, int qr){
if(ql > r || l > qr) return {0, 100000000, -1};
if(ql <= l && r <= qr){
return {v->sum, v->mostleft, v->mostright};
}
int m = l+r>>1;
auto x = get(v->L, l, m, ql, qr);
auto y = get(v->R, m+1, r, ql, qr);
return {x[0] + y[0], min(x[1], y[1]), max(x[2], y[2])};
}
int rmq[N][K];
int getmin(int l, int r){
int k = int(log2(r-l+1));
return min(rmq[l][k], rmq[r-(1<<k)+1][k]);
}
void op(vector<int> &a, vector<int> &A, vector<int> &B){
if(a.size() <= 1){
A = a;
B.pb(0);
return;
}
A.pb(a[0]);
A.pb(a[1]);
B.pb(0);
B.pb(1);
for(int i = 2; i < a.size(); ++i){
if(a[i] > A.back() && A.back() > A[int(A.size()) - 2]){
A.pop_back();
B.pop_back();
A.pb(a[i]);
B.pb(i);
}else if(a[i] < A.back() && A.back() < A[int(A.size()) - 2]){
A.pop_back();
B.pop_back();
A.pb(a[i]);
B.pb(i);
}else{
A.pb(a[i]);
B.pb(i);
}
}
}
int n;
vector<int> A, B, a;
vector<pair<int, int>> ans;
vector<Node*> roots;
void init(int nn, vector<int> aa) { n=nn;a=aa;
if(n == 1) return;
op(a, A, B);
for(int i = 0; i < n; ++i) rmq[i][0] = a[i];
for(int j = 1; j < K; ++j){
for(int i = 0; i + (1<<j) <= n; ++i){
rmq[i][j] = min(rmq[i][j - 1], rmq[i + (1<<(j-1))][j - 1]);
}
}
if(A[0] > A[1]) A.erase(A.begin()), B.erase(B.begin());
if(A.size()==1) return;
if(A.back() > A[A.size() - 2]) A.pop_back(), B.pop_back();
if(A.size()==1) return;
set<array<int, 3>> S;
priority_queue<array<int, 3>> Q;
int m = A.size();
for(int i = 0; i < m; ++i){
S.insert({i, A[i], B[i]});
if(i%2) is_peak[B[i]] = 1;
if(i + 1 < m && A[i + 1] > A[i]) Q.push({-(A[i + 1] - A[i]), i, i + 1});
if(i > 0 && A[i - 1] > A[i]) Q.push({-(A[i - 1] - A[i]), i, i - 1});
}
roots.pb(build(0, n - 1));
ans.pb({0, A.size() / 2 + 1});
vector<bool> rem(A.size());
while(!Q.empty()){
auto V = Q.top();
int v = V[1], u = V[2];
int val = V[0];
Q.pop();
if(rem[u] || rem[v]) continue;
S.erase({v, A[v], B[v]});
S.erase({u, A[u], B[u]});
rem[u] = rem[v] = 1;
int mx = max(u, v);
auto it = S.lower_bound(array<int,3>{mx, -1, -1});
if(it != S.begin() && it != S.end()){
auto it2 = prev(it);
auto x = *it;
auto y = *it2;
Q.push({-abs(x[1] - y[1]), x[0], y[0]});
}
if(ans.back().ff == -val){
roots.back() = upd(roots.back(), 0, n - 1, (A[v] > A[u] ? B[v] : B[u]), 0);
ans.back().ss = S.size() / 2 + 1;
}else{
roots.pb(upd(roots.back(), 0, n - 1, (A[v] > A[u] ? B[v] : B[u]), 0));
ans.pb({-val, S.size() / 2 + 1});
}
}
}
int max_towers(int L, int R, int D) {
if(n == 1 || L == R || A.size() == 1) return 1;
int pos = upper_bound(all(ans), pii{D, -1}) - ans.begin() - 1;
if(pos == ans.size()) return 1;
auto F = get(roots[pos], 0, n - 1, L, R);
int l = F[1], r = F[2], cur = F[0];
if(cur == 0) return 1;
if(L < l){
cur += getmin(L, l-1) <= a[F[1]] - D;
}
if(r < R){
cur += getmin(r + 1, R) <= a[F[2]] - D;
}
return max(1, cur - 1);
// if(D==1) return ans[0].ss;
// return max(pos == ans.size() ? 1 : ans[pos].ss, 1);
}
Compilation message
towers.cpp: In function 'Node* build(int, int)':
towers.cpp:43:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
43 | int m = l+r>>1;
| ~^~
towers.cpp: In function 'Node* upd(Node*, int, int, int, int)':
towers.cpp:51:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
51 | int m = l+r>>1;
| ~^~
towers.cpp: In function 'std::array<int, 3> get(Node*, int, int, int, int)':
towers.cpp:61:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
61 | int m = l+r>>1;
| ~^~
towers.cpp: In function 'void op(std::vector<int>&, std::vector<int>&, std::vector<int>&)':
towers.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
83 | for(int i = 2; i < a.size(); ++i){
| ~~^~~~~~~~~~
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:167:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
167 | if(pos == ans.size()) return 1;
| ~~~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
10840 KB |
Output is correct |
2 |
Correct |
606 ms |
17992 KB |
Output is correct |
3 |
Correct |
665 ms |
18008 KB |
Output is correct |
4 |
Correct |
450 ms |
8536 KB |
Output is correct |
5 |
Correct |
471 ms |
8536 KB |
Output is correct |
6 |
Correct |
657 ms |
18008 KB |
Output is correct |
7 |
Correct |
540 ms |
8536 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
1112 KB |
Output is correct |
3 |
Correct |
1 ms |
1112 KB |
Output is correct |
4 |
Correct |
1 ms |
1328 KB |
Output is correct |
5 |
Correct |
2 ms |
1368 KB |
Output is correct |
6 |
Correct |
1 ms |
1368 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
612 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
1 ms |
1112 KB |
Output is correct |
16 |
Correct |
2 ms |
1368 KB |
Output is correct |
17 |
Correct |
1 ms |
1368 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
600 KB |
Output is correct |
20 |
Correct |
1 ms |
1112 KB |
Output is correct |
21 |
Correct |
2 ms |
1368 KB |
Output is correct |
22 |
Correct |
1 ms |
1368 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
756 KB |
Output is correct |
26 |
Correct |
1 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1368 KB |
Output is correct |
29 |
Correct |
1 ms |
1368 KB |
Output is correct |
30 |
Correct |
2 ms |
1368 KB |
Output is correct |
31 |
Correct |
2 ms |
1620 KB |
Output is correct |
32 |
Correct |
0 ms |
600 KB |
Output is correct |
33 |
Correct |
1 ms |
600 KB |
Output is correct |
34 |
Correct |
0 ms |
600 KB |
Output is correct |
35 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
1112 KB |
Output is correct |
3 |
Correct |
1 ms |
1112 KB |
Output is correct |
4 |
Correct |
1 ms |
1328 KB |
Output is correct |
5 |
Correct |
2 ms |
1368 KB |
Output is correct |
6 |
Correct |
1 ms |
1368 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
612 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
1 ms |
1112 KB |
Output is correct |
16 |
Correct |
2 ms |
1368 KB |
Output is correct |
17 |
Correct |
1 ms |
1368 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
600 KB |
Output is correct |
20 |
Correct |
1 ms |
1112 KB |
Output is correct |
21 |
Correct |
2 ms |
1368 KB |
Output is correct |
22 |
Correct |
1 ms |
1368 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
756 KB |
Output is correct |
26 |
Correct |
1 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1368 KB |
Output is correct |
29 |
Correct |
1 ms |
1368 KB |
Output is correct |
30 |
Correct |
2 ms |
1368 KB |
Output is correct |
31 |
Correct |
2 ms |
1620 KB |
Output is correct |
32 |
Correct |
0 ms |
600 KB |
Output is correct |
33 |
Correct |
1 ms |
600 KB |
Output is correct |
34 |
Correct |
0 ms |
600 KB |
Output is correct |
35 |
Correct |
0 ms |
600 KB |
Output is correct |
36 |
Correct |
52 ms |
32076 KB |
Output is correct |
37 |
Correct |
84 ms |
47932 KB |
Output is correct |
38 |
Correct |
95 ms |
47832 KB |
Output is correct |
39 |
Correct |
131 ms |
62780 KB |
Output is correct |
40 |
Correct |
128 ms |
62780 KB |
Output is correct |
41 |
Correct |
128 ms |
62824 KB |
Output is correct |
42 |
Correct |
131 ms |
62824 KB |
Output is correct |
43 |
Correct |
10 ms |
8536 KB |
Output is correct |
44 |
Correct |
10 ms |
8536 KB |
Output is correct |
45 |
Correct |
15 ms |
18008 KB |
Output is correct |
46 |
Correct |
20 ms |
18052 KB |
Output is correct |
47 |
Correct |
86 ms |
47932 KB |
Output is correct |
48 |
Correct |
133 ms |
62776 KB |
Output is correct |
49 |
Correct |
139 ms |
62716 KB |
Output is correct |
50 |
Correct |
16 ms |
8536 KB |
Output is correct |
51 |
Correct |
15 ms |
17992 KB |
Output is correct |
52 |
Correct |
91 ms |
47956 KB |
Output is correct |
53 |
Correct |
123 ms |
62780 KB |
Output is correct |
54 |
Correct |
125 ms |
62780 KB |
Output is correct |
55 |
Correct |
10 ms |
8536 KB |
Output is correct |
56 |
Correct |
15 ms |
18008 KB |
Output is correct |
57 |
Correct |
86 ms |
46196 KB |
Output is correct |
58 |
Correct |
85 ms |
47932 KB |
Output is correct |
59 |
Correct |
90 ms |
47932 KB |
Output is correct |
60 |
Correct |
127 ms |
62780 KB |
Output is correct |
61 |
Correct |
140 ms |
62744 KB |
Output is correct |
62 |
Correct |
129 ms |
62780 KB |
Output is correct |
63 |
Correct |
163 ms |
62840 KB |
Output is correct |
64 |
Correct |
16 ms |
8536 KB |
Output is correct |
65 |
Correct |
12 ms |
8536 KB |
Output is correct |
66 |
Correct |
18 ms |
18008 KB |
Output is correct |
67 |
Correct |
28 ms |
17980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
612 ms |
47724 KB |
Output is correct |
2 |
Correct |
680 ms |
47832 KB |
Output is correct |
3 |
Correct |
789 ms |
47932 KB |
Output is correct |
4 |
Correct |
733 ms |
62768 KB |
Output is correct |
5 |
Correct |
738 ms |
62780 KB |
Output is correct |
6 |
Correct |
705 ms |
62744 KB |
Output is correct |
7 |
Correct |
736 ms |
63036 KB |
Output is correct |
8 |
Correct |
494 ms |
8524 KB |
Output is correct |
9 |
Correct |
479 ms |
8536 KB |
Output is correct |
10 |
Correct |
592 ms |
18008 KB |
Output is correct |
11 |
Correct |
556 ms |
18008 KB |
Output is correct |
12 |
Correct |
639 ms |
18008 KB |
Output is correct |
13 |
Correct |
550 ms |
8536 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
600 KB |
Output is correct |
16 |
Correct |
0 ms |
600 KB |
Output is correct |
17 |
Correct |
86 ms |
47796 KB |
Output is correct |
18 |
Correct |
127 ms |
62780 KB |
Output is correct |
19 |
Correct |
135 ms |
62768 KB |
Output is correct |
20 |
Correct |
12 ms |
8536 KB |
Output is correct |
21 |
Correct |
17 ms |
18008 KB |
Output is correct |
22 |
Correct |
123 ms |
47828 KB |
Output is correct |
23 |
Correct |
147 ms |
62844 KB |
Output is correct |
24 |
Correct |
149 ms |
62644 KB |
Output is correct |
25 |
Correct |
11 ms |
8628 KB |
Output is correct |
26 |
Correct |
15 ms |
18008 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
1 ms |
1368 KB |
Output is correct |
29 |
Correct |
2 ms |
1376 KB |
Output is correct |
30 |
Correct |
0 ms |
600 KB |
Output is correct |
31 |
Correct |
0 ms |
600 KB |
Output is correct |
32 |
Correct |
1 ms |
1112 KB |
Output is correct |
33 |
Correct |
2 ms |
1368 KB |
Output is correct |
34 |
Correct |
3 ms |
1368 KB |
Output is correct |
35 |
Correct |
0 ms |
600 KB |
Output is correct |
36 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
136 ms |
11464 KB |
Output is correct |
2 |
Correct |
553 ms |
47932 KB |
Output is correct |
3 |
Correct |
513 ms |
48052 KB |
Output is correct |
4 |
Correct |
555 ms |
62648 KB |
Output is correct |
5 |
Correct |
600 ms |
62844 KB |
Output is correct |
6 |
Correct |
630 ms |
62780 KB |
Output is correct |
7 |
Correct |
700 ms |
62660 KB |
Output is correct |
8 |
Correct |
507 ms |
8536 KB |
Output is correct |
9 |
Correct |
463 ms |
8536 KB |
Output is correct |
10 |
Correct |
523 ms |
18008 KB |
Output is correct |
11 |
Correct |
497 ms |
17996 KB |
Output is correct |
12 |
Correct |
100 ms |
47884 KB |
Output is correct |
13 |
Correct |
140 ms |
62780 KB |
Output is correct |
14 |
Correct |
168 ms |
62700 KB |
Output is correct |
15 |
Correct |
10 ms |
8536 KB |
Output is correct |
16 |
Correct |
29 ms |
17984 KB |
Output is correct |
17 |
Correct |
90 ms |
46212 KB |
Output is correct |
18 |
Correct |
84 ms |
47928 KB |
Output is correct |
19 |
Correct |
90 ms |
47932 KB |
Output is correct |
20 |
Correct |
125 ms |
62652 KB |
Output is correct |
21 |
Correct |
135 ms |
62780 KB |
Output is correct |
22 |
Correct |
129 ms |
62860 KB |
Output is correct |
23 |
Correct |
123 ms |
62780 KB |
Output is correct |
24 |
Correct |
10 ms |
8536 KB |
Output is correct |
25 |
Correct |
17 ms |
8524 KB |
Output is correct |
26 |
Correct |
16 ms |
18008 KB |
Output is correct |
27 |
Correct |
15 ms |
18008 KB |
Output is correct |
28 |
Correct |
2 ms |
1112 KB |
Output is correct |
29 |
Correct |
1 ms |
1368 KB |
Output is correct |
30 |
Correct |
2 ms |
1208 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
600 KB |
Output is correct |
33 |
Correct |
0 ms |
600 KB |
Output is correct |
34 |
Correct |
1 ms |
1112 KB |
Output is correct |
35 |
Correct |
2 ms |
1112 KB |
Output is correct |
36 |
Correct |
2 ms |
1368 KB |
Output is correct |
37 |
Correct |
2 ms |
1368 KB |
Output is correct |
38 |
Correct |
2 ms |
1376 KB |
Output is correct |
39 |
Correct |
1 ms |
1412 KB |
Output is correct |
40 |
Correct |
1 ms |
600 KB |
Output is correct |
41 |
Correct |
0 ms |
344 KB |
Output is correct |
42 |
Correct |
1 ms |
600 KB |
Output is correct |
43 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
1112 KB |
Output is correct |
3 |
Correct |
1 ms |
1112 KB |
Output is correct |
4 |
Correct |
1 ms |
1328 KB |
Output is correct |
5 |
Correct |
2 ms |
1368 KB |
Output is correct |
6 |
Correct |
1 ms |
1368 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
612 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
1 ms |
1112 KB |
Output is correct |
16 |
Correct |
2 ms |
1368 KB |
Output is correct |
17 |
Correct |
1 ms |
1368 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
600 KB |
Output is correct |
20 |
Correct |
1 ms |
1112 KB |
Output is correct |
21 |
Correct |
2 ms |
1368 KB |
Output is correct |
22 |
Correct |
1 ms |
1368 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
756 KB |
Output is correct |
26 |
Correct |
1 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1368 KB |
Output is correct |
29 |
Correct |
1 ms |
1368 KB |
Output is correct |
30 |
Correct |
2 ms |
1368 KB |
Output is correct |
31 |
Correct |
2 ms |
1620 KB |
Output is correct |
32 |
Correct |
0 ms |
600 KB |
Output is correct |
33 |
Correct |
1 ms |
600 KB |
Output is correct |
34 |
Correct |
0 ms |
600 KB |
Output is correct |
35 |
Correct |
0 ms |
600 KB |
Output is correct |
36 |
Correct |
52 ms |
32076 KB |
Output is correct |
37 |
Correct |
84 ms |
47932 KB |
Output is correct |
38 |
Correct |
95 ms |
47832 KB |
Output is correct |
39 |
Correct |
131 ms |
62780 KB |
Output is correct |
40 |
Correct |
128 ms |
62780 KB |
Output is correct |
41 |
Correct |
128 ms |
62824 KB |
Output is correct |
42 |
Correct |
131 ms |
62824 KB |
Output is correct |
43 |
Correct |
10 ms |
8536 KB |
Output is correct |
44 |
Correct |
10 ms |
8536 KB |
Output is correct |
45 |
Correct |
15 ms |
18008 KB |
Output is correct |
46 |
Correct |
20 ms |
18052 KB |
Output is correct |
47 |
Correct |
86 ms |
47932 KB |
Output is correct |
48 |
Correct |
133 ms |
62776 KB |
Output is correct |
49 |
Correct |
139 ms |
62716 KB |
Output is correct |
50 |
Correct |
16 ms |
8536 KB |
Output is correct |
51 |
Correct |
15 ms |
17992 KB |
Output is correct |
52 |
Correct |
91 ms |
47956 KB |
Output is correct |
53 |
Correct |
123 ms |
62780 KB |
Output is correct |
54 |
Correct |
125 ms |
62780 KB |
Output is correct |
55 |
Correct |
10 ms |
8536 KB |
Output is correct |
56 |
Correct |
15 ms |
18008 KB |
Output is correct |
57 |
Correct |
86 ms |
46196 KB |
Output is correct |
58 |
Correct |
85 ms |
47932 KB |
Output is correct |
59 |
Correct |
90 ms |
47932 KB |
Output is correct |
60 |
Correct |
127 ms |
62780 KB |
Output is correct |
61 |
Correct |
140 ms |
62744 KB |
Output is correct |
62 |
Correct |
129 ms |
62780 KB |
Output is correct |
63 |
Correct |
163 ms |
62840 KB |
Output is correct |
64 |
Correct |
16 ms |
8536 KB |
Output is correct |
65 |
Correct |
12 ms |
8536 KB |
Output is correct |
66 |
Correct |
18 ms |
18008 KB |
Output is correct |
67 |
Correct |
28 ms |
17980 KB |
Output is correct |
68 |
Correct |
612 ms |
47724 KB |
Output is correct |
69 |
Correct |
680 ms |
47832 KB |
Output is correct |
70 |
Correct |
789 ms |
47932 KB |
Output is correct |
71 |
Correct |
733 ms |
62768 KB |
Output is correct |
72 |
Correct |
738 ms |
62780 KB |
Output is correct |
73 |
Correct |
705 ms |
62744 KB |
Output is correct |
74 |
Correct |
736 ms |
63036 KB |
Output is correct |
75 |
Correct |
494 ms |
8524 KB |
Output is correct |
76 |
Correct |
479 ms |
8536 KB |
Output is correct |
77 |
Correct |
592 ms |
18008 KB |
Output is correct |
78 |
Correct |
556 ms |
18008 KB |
Output is correct |
79 |
Correct |
639 ms |
18008 KB |
Output is correct |
80 |
Correct |
550 ms |
8536 KB |
Output is correct |
81 |
Correct |
0 ms |
344 KB |
Output is correct |
82 |
Correct |
0 ms |
600 KB |
Output is correct |
83 |
Correct |
0 ms |
600 KB |
Output is correct |
84 |
Correct |
86 ms |
47796 KB |
Output is correct |
85 |
Correct |
127 ms |
62780 KB |
Output is correct |
86 |
Correct |
135 ms |
62768 KB |
Output is correct |
87 |
Correct |
12 ms |
8536 KB |
Output is correct |
88 |
Correct |
17 ms |
18008 KB |
Output is correct |
89 |
Correct |
123 ms |
47828 KB |
Output is correct |
90 |
Correct |
147 ms |
62844 KB |
Output is correct |
91 |
Correct |
149 ms |
62644 KB |
Output is correct |
92 |
Correct |
11 ms |
8628 KB |
Output is correct |
93 |
Correct |
15 ms |
18008 KB |
Output is correct |
94 |
Correct |
1 ms |
1112 KB |
Output is correct |
95 |
Correct |
1 ms |
1368 KB |
Output is correct |
96 |
Correct |
2 ms |
1376 KB |
Output is correct |
97 |
Correct |
0 ms |
600 KB |
Output is correct |
98 |
Correct |
0 ms |
600 KB |
Output is correct |
99 |
Correct |
1 ms |
1112 KB |
Output is correct |
100 |
Correct |
2 ms |
1368 KB |
Output is correct |
101 |
Correct |
3 ms |
1368 KB |
Output is correct |
102 |
Correct |
0 ms |
600 KB |
Output is correct |
103 |
Correct |
0 ms |
600 KB |
Output is correct |
104 |
Correct |
657 ms |
42460 KB |
Output is correct |
105 |
Correct |
765 ms |
47932 KB |
Output is correct |
106 |
Correct |
715 ms |
47932 KB |
Output is correct |
107 |
Correct |
748 ms |
62780 KB |
Output is correct |
108 |
Correct |
766 ms |
62644 KB |
Output is correct |
109 |
Correct |
776 ms |
62780 KB |
Output is correct |
110 |
Correct |
770 ms |
62848 KB |
Output is correct |
111 |
Correct |
513 ms |
8536 KB |
Output is correct |
112 |
Correct |
478 ms |
8536 KB |
Output is correct |
113 |
Correct |
612 ms |
18008 KB |
Output is correct |
114 |
Correct |
558 ms |
17992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
10840 KB |
Output is correct |
2 |
Correct |
606 ms |
17992 KB |
Output is correct |
3 |
Correct |
665 ms |
18008 KB |
Output is correct |
4 |
Correct |
450 ms |
8536 KB |
Output is correct |
5 |
Correct |
471 ms |
8536 KB |
Output is correct |
6 |
Correct |
657 ms |
18008 KB |
Output is correct |
7 |
Correct |
540 ms |
8536 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
1112 KB |
Output is correct |
13 |
Correct |
1 ms |
1112 KB |
Output is correct |
14 |
Correct |
1 ms |
1328 KB |
Output is correct |
15 |
Correct |
2 ms |
1368 KB |
Output is correct |
16 |
Correct |
1 ms |
1368 KB |
Output is correct |
17 |
Correct |
2 ms |
1368 KB |
Output is correct |
18 |
Correct |
0 ms |
600 KB |
Output is correct |
19 |
Correct |
1 ms |
600 KB |
Output is correct |
20 |
Correct |
0 ms |
600 KB |
Output is correct |
21 |
Correct |
0 ms |
612 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
1112 KB |
Output is correct |
26 |
Correct |
2 ms |
1368 KB |
Output is correct |
27 |
Correct |
1 ms |
1368 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
600 KB |
Output is correct |
30 |
Correct |
1 ms |
1112 KB |
Output is correct |
31 |
Correct |
2 ms |
1368 KB |
Output is correct |
32 |
Correct |
1 ms |
1368 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
600 KB |
Output is correct |
35 |
Correct |
1 ms |
756 KB |
Output is correct |
36 |
Correct |
1 ms |
1112 KB |
Output is correct |
37 |
Correct |
1 ms |
1112 KB |
Output is correct |
38 |
Correct |
2 ms |
1368 KB |
Output is correct |
39 |
Correct |
1 ms |
1368 KB |
Output is correct |
40 |
Correct |
2 ms |
1368 KB |
Output is correct |
41 |
Correct |
2 ms |
1620 KB |
Output is correct |
42 |
Correct |
0 ms |
600 KB |
Output is correct |
43 |
Correct |
1 ms |
600 KB |
Output is correct |
44 |
Correct |
0 ms |
600 KB |
Output is correct |
45 |
Correct |
0 ms |
600 KB |
Output is correct |
46 |
Correct |
52 ms |
32076 KB |
Output is correct |
47 |
Correct |
84 ms |
47932 KB |
Output is correct |
48 |
Correct |
95 ms |
47832 KB |
Output is correct |
49 |
Correct |
131 ms |
62780 KB |
Output is correct |
50 |
Correct |
128 ms |
62780 KB |
Output is correct |
51 |
Correct |
128 ms |
62824 KB |
Output is correct |
52 |
Correct |
131 ms |
62824 KB |
Output is correct |
53 |
Correct |
10 ms |
8536 KB |
Output is correct |
54 |
Correct |
10 ms |
8536 KB |
Output is correct |
55 |
Correct |
15 ms |
18008 KB |
Output is correct |
56 |
Correct |
20 ms |
18052 KB |
Output is correct |
57 |
Correct |
86 ms |
47932 KB |
Output is correct |
58 |
Correct |
133 ms |
62776 KB |
Output is correct |
59 |
Correct |
139 ms |
62716 KB |
Output is correct |
60 |
Correct |
16 ms |
8536 KB |
Output is correct |
61 |
Correct |
15 ms |
17992 KB |
Output is correct |
62 |
Correct |
91 ms |
47956 KB |
Output is correct |
63 |
Correct |
123 ms |
62780 KB |
Output is correct |
64 |
Correct |
125 ms |
62780 KB |
Output is correct |
65 |
Correct |
10 ms |
8536 KB |
Output is correct |
66 |
Correct |
15 ms |
18008 KB |
Output is correct |
67 |
Correct |
86 ms |
46196 KB |
Output is correct |
68 |
Correct |
85 ms |
47932 KB |
Output is correct |
69 |
Correct |
90 ms |
47932 KB |
Output is correct |
70 |
Correct |
127 ms |
62780 KB |
Output is correct |
71 |
Correct |
140 ms |
62744 KB |
Output is correct |
72 |
Correct |
129 ms |
62780 KB |
Output is correct |
73 |
Correct |
163 ms |
62840 KB |
Output is correct |
74 |
Correct |
16 ms |
8536 KB |
Output is correct |
75 |
Correct |
12 ms |
8536 KB |
Output is correct |
76 |
Correct |
18 ms |
18008 KB |
Output is correct |
77 |
Correct |
28 ms |
17980 KB |
Output is correct |
78 |
Correct |
612 ms |
47724 KB |
Output is correct |
79 |
Correct |
680 ms |
47832 KB |
Output is correct |
80 |
Correct |
789 ms |
47932 KB |
Output is correct |
81 |
Correct |
733 ms |
62768 KB |
Output is correct |
82 |
Correct |
738 ms |
62780 KB |
Output is correct |
83 |
Correct |
705 ms |
62744 KB |
Output is correct |
84 |
Correct |
736 ms |
63036 KB |
Output is correct |
85 |
Correct |
494 ms |
8524 KB |
Output is correct |
86 |
Correct |
479 ms |
8536 KB |
Output is correct |
87 |
Correct |
592 ms |
18008 KB |
Output is correct |
88 |
Correct |
556 ms |
18008 KB |
Output is correct |
89 |
Correct |
639 ms |
18008 KB |
Output is correct |
90 |
Correct |
550 ms |
8536 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
0 ms |
600 KB |
Output is correct |
93 |
Correct |
0 ms |
600 KB |
Output is correct |
94 |
Correct |
86 ms |
47796 KB |
Output is correct |
95 |
Correct |
127 ms |
62780 KB |
Output is correct |
96 |
Correct |
135 ms |
62768 KB |
Output is correct |
97 |
Correct |
12 ms |
8536 KB |
Output is correct |
98 |
Correct |
17 ms |
18008 KB |
Output is correct |
99 |
Correct |
123 ms |
47828 KB |
Output is correct |
100 |
Correct |
147 ms |
62844 KB |
Output is correct |
101 |
Correct |
149 ms |
62644 KB |
Output is correct |
102 |
Correct |
11 ms |
8628 KB |
Output is correct |
103 |
Correct |
15 ms |
18008 KB |
Output is correct |
104 |
Correct |
1 ms |
1112 KB |
Output is correct |
105 |
Correct |
1 ms |
1368 KB |
Output is correct |
106 |
Correct |
2 ms |
1376 KB |
Output is correct |
107 |
Correct |
0 ms |
600 KB |
Output is correct |
108 |
Correct |
0 ms |
600 KB |
Output is correct |
109 |
Correct |
1 ms |
1112 KB |
Output is correct |
110 |
Correct |
2 ms |
1368 KB |
Output is correct |
111 |
Correct |
3 ms |
1368 KB |
Output is correct |
112 |
Correct |
0 ms |
600 KB |
Output is correct |
113 |
Correct |
0 ms |
600 KB |
Output is correct |
114 |
Correct |
136 ms |
11464 KB |
Output is correct |
115 |
Correct |
553 ms |
47932 KB |
Output is correct |
116 |
Correct |
513 ms |
48052 KB |
Output is correct |
117 |
Correct |
555 ms |
62648 KB |
Output is correct |
118 |
Correct |
600 ms |
62844 KB |
Output is correct |
119 |
Correct |
630 ms |
62780 KB |
Output is correct |
120 |
Correct |
700 ms |
62660 KB |
Output is correct |
121 |
Correct |
507 ms |
8536 KB |
Output is correct |
122 |
Correct |
463 ms |
8536 KB |
Output is correct |
123 |
Correct |
523 ms |
18008 KB |
Output is correct |
124 |
Correct |
497 ms |
17996 KB |
Output is correct |
125 |
Correct |
100 ms |
47884 KB |
Output is correct |
126 |
Correct |
140 ms |
62780 KB |
Output is correct |
127 |
Correct |
168 ms |
62700 KB |
Output is correct |
128 |
Correct |
10 ms |
8536 KB |
Output is correct |
129 |
Correct |
29 ms |
17984 KB |
Output is correct |
130 |
Correct |
90 ms |
46212 KB |
Output is correct |
131 |
Correct |
84 ms |
47928 KB |
Output is correct |
132 |
Correct |
90 ms |
47932 KB |
Output is correct |
133 |
Correct |
125 ms |
62652 KB |
Output is correct |
134 |
Correct |
135 ms |
62780 KB |
Output is correct |
135 |
Correct |
129 ms |
62860 KB |
Output is correct |
136 |
Correct |
123 ms |
62780 KB |
Output is correct |
137 |
Correct |
10 ms |
8536 KB |
Output is correct |
138 |
Correct |
17 ms |
8524 KB |
Output is correct |
139 |
Correct |
16 ms |
18008 KB |
Output is correct |
140 |
Correct |
15 ms |
18008 KB |
Output is correct |
141 |
Correct |
2 ms |
1112 KB |
Output is correct |
142 |
Correct |
1 ms |
1368 KB |
Output is correct |
143 |
Correct |
2 ms |
1208 KB |
Output is correct |
144 |
Correct |
1 ms |
344 KB |
Output is correct |
145 |
Correct |
0 ms |
600 KB |
Output is correct |
146 |
Correct |
0 ms |
600 KB |
Output is correct |
147 |
Correct |
1 ms |
1112 KB |
Output is correct |
148 |
Correct |
2 ms |
1112 KB |
Output is correct |
149 |
Correct |
2 ms |
1368 KB |
Output is correct |
150 |
Correct |
2 ms |
1368 KB |
Output is correct |
151 |
Correct |
2 ms |
1376 KB |
Output is correct |
152 |
Correct |
1 ms |
1412 KB |
Output is correct |
153 |
Correct |
1 ms |
600 KB |
Output is correct |
154 |
Correct |
0 ms |
344 KB |
Output is correct |
155 |
Correct |
1 ms |
600 KB |
Output is correct |
156 |
Correct |
0 ms |
600 KB |
Output is correct |
157 |
Correct |
657 ms |
42460 KB |
Output is correct |
158 |
Correct |
765 ms |
47932 KB |
Output is correct |
159 |
Correct |
715 ms |
47932 KB |
Output is correct |
160 |
Correct |
748 ms |
62780 KB |
Output is correct |
161 |
Correct |
766 ms |
62644 KB |
Output is correct |
162 |
Correct |
776 ms |
62780 KB |
Output is correct |
163 |
Correct |
770 ms |
62848 KB |
Output is correct |
164 |
Correct |
513 ms |
8536 KB |
Output is correct |
165 |
Correct |
478 ms |
8536 KB |
Output is correct |
166 |
Correct |
612 ms |
18008 KB |
Output is correct |
167 |
Correct |
558 ms |
17992 KB |
Output is correct |
168 |
Correct |
0 ms |
344 KB |
Output is correct |
169 |
Correct |
426 ms |
17900 KB |
Output is correct |
170 |
Correct |
863 ms |
47968 KB |
Output is correct |
171 |
Correct |
858 ms |
47932 KB |
Output is correct |
172 |
Correct |
962 ms |
62780 KB |
Output is correct |
173 |
Correct |
897 ms |
62780 KB |
Output is correct |
174 |
Correct |
908 ms |
62804 KB |
Output is correct |
175 |
Correct |
905 ms |
62760 KB |
Output is correct |
176 |
Correct |
508 ms |
8536 KB |
Output is correct |
177 |
Correct |
501 ms |
8536 KB |
Output is correct |
178 |
Correct |
630 ms |
18008 KB |
Output is correct |
179 |
Correct |
625 ms |
18008 KB |
Output is correct |