#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
struct node1 {
pair<int, int> max_val, min_val;
int max_diff, min_diff;
node1(): max_val(make_pair(0, 0)), min_val(make_pair(0, 0)), max_diff(0), min_diff(0) {};
node1(pair<int, int> _max_val, pair<int, int> _min_val, int _max_diff, int _min_diff): max_val(_max_val), min_val(_min_val), max_diff(_max_diff), min_diff(_min_diff) {};
};
struct node2 {
int cnt, min_pos, max_pos;
node2 *left;
node2 *right;
node2(): cnt(0), min_pos(0), max_pos(0), left(nullptr), right(nullptr) {};
node2(int _cnt, int _min_pos, int _max_pos, node2 *_left, node2 *_right): cnt(_cnt), min_pos(_min_pos), max_pos(_max_pos), left(_left), right(_right) {};
};
const int inf = 1e9 + 20;
const int maxN = 1e5 + 20;
int H[maxN];
node1 tree1[maxN * 4];
int N;
node1 merge1(node1 left, node1 right) {
return node1(max(left.max_val, right.max_val), min(left.min_val, right.min_val), max(max(left.max_diff, right.max_diff), left.max_val.first - right.min_val.first), min(min(left.min_diff, right.min_diff), left.min_val.first - right.max_val.first));
}
node2* merge2(node2 *left, node2 *right) {
return new node2(left->cnt + right->cnt, min(left->min_pos, right->min_pos), max(left->max_pos, right->max_pos), left, right);
}
void build1(int id, int lt, int rt) {
if (lt == rt) {
tree1[id] = node1(make_pair(H[lt], lt), make_pair(H[lt], lt), 0, 0);
return;
}
int mt = (lt + rt) / 2;
build1(id * 2, lt, mt);
build1(id * 2 + 1, mt + 1, rt);
tree1[id] = merge1(tree1[id * 2], tree1[id * 2 + 1]);
}
node2* build2(int lt, int rt) {
if (lt == rt) {
return new node2(0, N + 1, 0, nullptr, nullptr);
}
int mt = (lt + rt) / 2;
return new node2(0, N + 1, 0, build2(lt, mt), build2(mt + 1, rt));
}
node2* update2(node2 *cur, int lt, int rt, int pos) {
if (lt == rt) {
return new node2(1, pos, pos, nullptr, nullptr);
}
int mt = (lt + rt) / 2;
if (pos <= mt) {
return merge2(update2(cur->left, lt, mt, pos), cur->right);
}
else {
return merge2(cur->left, update2(cur->right, mt + 1, rt, pos));
}
}
node2* get2(node2 *cur, int lt, int rt, int ql, int qr) {
if (lt == ql && rt == qr) {
return cur;
}
int mt = (lt + rt) / 2;
if (qr <= mt) {
return get2(cur->left, lt, mt, ql, qr);
}
else if (ql >= mt + 1) {
return get2(cur->right, mt + 1, rt, ql, qr);
}
else {
return merge2(get2(cur->left, lt, mt, ql, mt), get2(cur->right, mt + 1, rt, mt + 1, qr));
}
}
int _get_firstL(int id, int lt, int rt, int pos, int low) {
if (lt == rt) {
return lt - (H[lt] < low);
}
if (tree1[id].max_val.first < low) {
return lt - 1;
}
int mt = (lt + rt) / 2;
if (pos <= mt) {
return _get_firstL(id * 2, lt, mt, pos, low);
}
else {
int res = _get_firstL(id * 2 + 1, mt + 1, rt, pos, low);
return (res >= mt + 1 ? res : _get_firstL(id * 2, lt, mt, pos, low));
}
}
int _get_firstR(int id, int lt, int rt, int pos, int low) {
if (lt == rt) {
return rt + (H[rt] < low);
}
if (tree1[id].max_val.first < low) {
return rt + 1;
}
int mt = (lt + rt) / 2;
if (pos >= mt + 1) {
return _get_firstR(id * 2 + 1, mt + 1, rt, pos, low);
}
else {
int res = _get_firstR(id * 2, lt, mt, pos, low);
return (res <= mt ? res : _get_firstR(id * 2 + 1, mt + 1, rt, pos, low));
}
}
node1 get1(int id, int lt, int rt, int ql, int qr) {
if (lt == ql && rt == qr) {
return tree1[id];
}
int mt = (lt + rt) / 2;
if (qr <= mt) {
return get1(id * 2, lt, mt, ql, qr);
}
else if (ql >= mt + 1) {
return get1(id * 2 + 1, mt + 1, rt, ql, qr);
}
else {
return merge1(get1(id * 2, lt, mt, ql, mt), get1(id * 2 + 1, mt + 1, rt, mt + 1, qr));
}
}
int get_firstL(int pos, int D) {
return _get_firstL(1, 1, N, pos, H[pos] + D);
}
int get_firstR(int pos, int D) {
return _get_firstR(1, 1, N, pos, H[pos] + D);
}
bool checkL(int pos, int D, int L) {
int firstL = get_firstL(pos, D);
if (firstL <= L) {
return false;
}
auto left = get1(1, 1, N, L, firstL - 1);
auto right = get1(1, 1, N, firstL, pos);
return (left.min_diff <= -D) || (right.max_val.first - left.min_val.first >= D);
}
bool checkR(int pos, int D, int R) {
int firstR = get_firstR(pos, D);
if (firstR >= R) {
return false;
}
auto right = get1(1, 1, N, firstR + 1, R);
auto left = get1(1, 1, N, pos, firstR);
return (right.max_diff >= D) || (left.max_val.first - right.min_val.first >= D);
}
vector<int> dists;
vector<int> add;
vector<node2*> roots;
void init(int _N, vector<int> _H) {
if (_N <= 2) {
return;
}
N = _N;
for (int i = 1; i <= N; i++) {
H[i] = _H[i - 1];
}
build1(1, 1, N);
vector<int> extr;
if (H[1] < H[2]) {
extr.push_back(1);
}
for (int i = 2; i <= N - 1; i++) {
if ((H[i - 1] < H[i]) ^ (H[i] < H[i + 1])) {
extr.push_back(i);
}
}
if (H[N - 1] > H[N]) {
extr.push_back(N);
}
set<int> S(extr.begin(), extr.end());
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> Q;
for (int i = 1; i < (int)extr.size(); i++) {
Q.emplace(abs(H[extr[i - 1]] - H[extr[i]]), make_pair(extr[i - 1], extr[i]));
}
while (!Q.empty()) {
int dist = Q.top().first;
int X = Q.top().second.first;
int Y = Q.top().second.second;
Q.pop();
auto it = S.find(X);
if (it == S.end() || next(it) == S.end() || *next(it) != Y) {
continue;
}
dists.push_back(dist);
add.push_back(H[X] < H[Y] ? X : Y);
it = S.erase(it);
it = S.erase(it);
if (it != S.begin() && it != S.end()) {
int prv = *prev(it);
int nxt = *it;
Q.emplace(abs(H[prv] - H[nxt]), make_pair(prv, nxt));
}
}
dists.push_back(inf);
add.push_back(*S.begin());
roots.resize((int)dists.size() + 1);
roots.back() = build2(1, N);
for (int i = (int)roots.size() - 2; i >= 0; i--) {
roots[i] = update2(roots[i + 1], 1, N, add[i]);
}
}
int max_towers(int L, int R, int D) {
L++;
R++;
if (R - L <= 1) {
return 1;
}
node2 *range = get2(roots[lower_bound(dists.begin(), dists.end(), D) - dists.begin()], 1, N, L, R);
if (!range->cnt) {
int pos = get1(1, 1, N, L, R).min_val.second;
return 1 + (checkL(pos, D, L) || checkR(pos, D, R));
}
else {
return range->cnt + checkL(range->min_pos, D, L) + checkR(range->max_pos, D, R);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
484 ms |
44200 KB |
Output is correct |
2 |
Correct |
850 ms |
84168 KB |
Output is correct |
3 |
Correct |
982 ms |
84188 KB |
Output is correct |
4 |
Correct |
1094 ms |
84148 KB |
Output is correct |
5 |
Correct |
976 ms |
84028 KB |
Output is correct |
6 |
Correct |
1012 ms |
84108 KB |
Output is correct |
7 |
Correct |
1028 ms |
84144 KB |
Output is correct |
8 |
Correct |
4 ms |
9680 KB |
Output is correct |
9 |
Correct |
4 ms |
9808 KB |
Output is correct |
10 |
Correct |
4 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9808 KB |
Output is correct |
2 |
Correct |
5 ms |
10320 KB |
Output is correct |
3 |
Correct |
6 ms |
10320 KB |
Output is correct |
4 |
Correct |
6 ms |
10448 KB |
Output is correct |
5 |
Correct |
6 ms |
10448 KB |
Output is correct |
6 |
Correct |
7 ms |
10448 KB |
Output is correct |
7 |
Correct |
5 ms |
10448 KB |
Output is correct |
8 |
Correct |
4 ms |
9808 KB |
Output is correct |
9 |
Correct |
4 ms |
9808 KB |
Output is correct |
10 |
Correct |
4 ms |
9888 KB |
Output is correct |
11 |
Correct |
5 ms |
9808 KB |
Output is correct |
12 |
Correct |
4 ms |
9680 KB |
Output is correct |
13 |
Correct |
5 ms |
9808 KB |
Output is correct |
14 |
Correct |
4 ms |
9808 KB |
Output is correct |
15 |
Correct |
6 ms |
10320 KB |
Output is correct |
16 |
Correct |
5 ms |
10448 KB |
Output is correct |
17 |
Correct |
5 ms |
10448 KB |
Output is correct |
18 |
Correct |
4 ms |
9888 KB |
Output is correct |
19 |
Correct |
4 ms |
9808 KB |
Output is correct |
20 |
Correct |
5 ms |
10264 KB |
Output is correct |
21 |
Correct |
5 ms |
10396 KB |
Output is correct |
22 |
Correct |
7 ms |
10448 KB |
Output is correct |
23 |
Correct |
5 ms |
9808 KB |
Output is correct |
24 |
Correct |
4 ms |
9808 KB |
Output is correct |
25 |
Correct |
4 ms |
9936 KB |
Output is correct |
26 |
Correct |
5 ms |
10320 KB |
Output is correct |
27 |
Correct |
5 ms |
10320 KB |
Output is correct |
28 |
Correct |
5 ms |
10448 KB |
Output is correct |
29 |
Correct |
5 ms |
10412 KB |
Output is correct |
30 |
Correct |
5 ms |
10448 KB |
Output is correct |
31 |
Correct |
6 ms |
10448 KB |
Output is correct |
32 |
Correct |
4 ms |
9808 KB |
Output is correct |
33 |
Correct |
4 ms |
9808 KB |
Output is correct |
34 |
Correct |
4 ms |
9808 KB |
Output is correct |
35 |
Correct |
4 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9808 KB |
Output is correct |
2 |
Correct |
5 ms |
10320 KB |
Output is correct |
3 |
Correct |
6 ms |
10320 KB |
Output is correct |
4 |
Correct |
6 ms |
10448 KB |
Output is correct |
5 |
Correct |
6 ms |
10448 KB |
Output is correct |
6 |
Correct |
7 ms |
10448 KB |
Output is correct |
7 |
Correct |
5 ms |
10448 KB |
Output is correct |
8 |
Correct |
4 ms |
9808 KB |
Output is correct |
9 |
Correct |
4 ms |
9808 KB |
Output is correct |
10 |
Correct |
4 ms |
9888 KB |
Output is correct |
11 |
Correct |
5 ms |
9808 KB |
Output is correct |
12 |
Correct |
4 ms |
9680 KB |
Output is correct |
13 |
Correct |
5 ms |
9808 KB |
Output is correct |
14 |
Correct |
4 ms |
9808 KB |
Output is correct |
15 |
Correct |
6 ms |
10320 KB |
Output is correct |
16 |
Correct |
5 ms |
10448 KB |
Output is correct |
17 |
Correct |
5 ms |
10448 KB |
Output is correct |
18 |
Correct |
4 ms |
9888 KB |
Output is correct |
19 |
Correct |
4 ms |
9808 KB |
Output is correct |
20 |
Correct |
5 ms |
10264 KB |
Output is correct |
21 |
Correct |
5 ms |
10396 KB |
Output is correct |
22 |
Correct |
7 ms |
10448 KB |
Output is correct |
23 |
Correct |
5 ms |
9808 KB |
Output is correct |
24 |
Correct |
4 ms |
9808 KB |
Output is correct |
25 |
Correct |
4 ms |
9936 KB |
Output is correct |
26 |
Correct |
5 ms |
10320 KB |
Output is correct |
27 |
Correct |
5 ms |
10320 KB |
Output is correct |
28 |
Correct |
5 ms |
10448 KB |
Output is correct |
29 |
Correct |
5 ms |
10412 KB |
Output is correct |
30 |
Correct |
5 ms |
10448 KB |
Output is correct |
31 |
Correct |
6 ms |
10448 KB |
Output is correct |
32 |
Correct |
4 ms |
9808 KB |
Output is correct |
33 |
Correct |
4 ms |
9808 KB |
Output is correct |
34 |
Correct |
4 ms |
9808 KB |
Output is correct |
35 |
Correct |
4 ms |
9808 KB |
Output is correct |
36 |
Correct |
57 ms |
34840 KB |
Output is correct |
37 |
Correct |
100 ms |
49620 KB |
Output is correct |
38 |
Correct |
94 ms |
49428 KB |
Output is correct |
39 |
Correct |
131 ms |
64092 KB |
Output is correct |
40 |
Correct |
137 ms |
64076 KB |
Output is correct |
41 |
Correct |
135 ms |
64072 KB |
Output is correct |
42 |
Correct |
137 ms |
64124 KB |
Output is correct |
43 |
Correct |
21 ms |
20176 KB |
Output is correct |
44 |
Correct |
21 ms |
20196 KB |
Output is correct |
45 |
Correct |
21 ms |
20176 KB |
Output is correct |
46 |
Correct |
23 ms |
20168 KB |
Output is correct |
47 |
Correct |
92 ms |
49472 KB |
Output is correct |
48 |
Correct |
145 ms |
64096 KB |
Output is correct |
49 |
Correct |
139 ms |
64060 KB |
Output is correct |
50 |
Correct |
21 ms |
20220 KB |
Output is correct |
51 |
Correct |
21 ms |
20184 KB |
Output is correct |
52 |
Correct |
98 ms |
49452 KB |
Output is correct |
53 |
Correct |
138 ms |
64056 KB |
Output is correct |
54 |
Correct |
140 ms |
64080 KB |
Output is correct |
55 |
Correct |
21 ms |
20164 KB |
Output is correct |
56 |
Correct |
22 ms |
20132 KB |
Output is correct |
57 |
Correct |
90 ms |
48076 KB |
Output is correct |
58 |
Correct |
94 ms |
49484 KB |
Output is correct |
59 |
Correct |
101 ms |
49592 KB |
Output is correct |
60 |
Correct |
133 ms |
64072 KB |
Output is correct |
61 |
Correct |
136 ms |
64088 KB |
Output is correct |
62 |
Correct |
140 ms |
64068 KB |
Output is correct |
63 |
Correct |
139 ms |
64104 KB |
Output is correct |
64 |
Correct |
21 ms |
20172 KB |
Output is correct |
65 |
Correct |
21 ms |
20200 KB |
Output is correct |
66 |
Correct |
22 ms |
20208 KB |
Output is correct |
67 |
Correct |
28 ms |
20184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
710 ms |
96860 KB |
Output is correct |
2 |
Correct |
997 ms |
112368 KB |
Output is correct |
3 |
Correct |
943 ms |
112372 KB |
Output is correct |
4 |
Correct |
1132 ms |
126352 KB |
Output is correct |
5 |
Correct |
1010 ms |
126332 KB |
Output is correct |
6 |
Correct |
1032 ms |
126400 KB |
Output is correct |
7 |
Correct |
1079 ms |
126368 KB |
Output is correct |
8 |
Correct |
929 ms |
84024 KB |
Output is correct |
9 |
Correct |
955 ms |
84140 KB |
Output is correct |
10 |
Correct |
998 ms |
84096 KB |
Output is correct |
11 |
Correct |
1089 ms |
84104 KB |
Output is correct |
12 |
Correct |
1060 ms |
84256 KB |
Output is correct |
13 |
Correct |
828 ms |
84244 KB |
Output is correct |
14 |
Correct |
5 ms |
9680 KB |
Output is correct |
15 |
Correct |
5 ms |
9840 KB |
Output is correct |
16 |
Correct |
5 ms |
9808 KB |
Output is correct |
17 |
Correct |
90 ms |
49368 KB |
Output is correct |
18 |
Correct |
134 ms |
64108 KB |
Output is correct |
19 |
Correct |
172 ms |
64112 KB |
Output is correct |
20 |
Correct |
27 ms |
20204 KB |
Output is correct |
21 |
Correct |
32 ms |
20200 KB |
Output is correct |
22 |
Correct |
106 ms |
49480 KB |
Output is correct |
23 |
Correct |
139 ms |
64104 KB |
Output is correct |
24 |
Correct |
142 ms |
64060 KB |
Output is correct |
25 |
Correct |
21 ms |
20204 KB |
Output is correct |
26 |
Correct |
22 ms |
20208 KB |
Output is correct |
27 |
Correct |
5 ms |
10320 KB |
Output is correct |
28 |
Correct |
6 ms |
10448 KB |
Output is correct |
29 |
Correct |
5 ms |
10448 KB |
Output is correct |
30 |
Correct |
4 ms |
9808 KB |
Output is correct |
31 |
Correct |
4 ms |
9808 KB |
Output is correct |
32 |
Correct |
5 ms |
10212 KB |
Output is correct |
33 |
Correct |
6 ms |
10448 KB |
Output is correct |
34 |
Correct |
6 ms |
10508 KB |
Output is correct |
35 |
Correct |
4 ms |
9808 KB |
Output is correct |
36 |
Correct |
4 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
283 ms |
18352 KB |
Output is correct |
2 |
Correct |
799 ms |
49468 KB |
Output is correct |
3 |
Correct |
733 ms |
49480 KB |
Output is correct |
4 |
Correct |
827 ms |
64084 KB |
Output is correct |
5 |
Correct |
834 ms |
64092 KB |
Output is correct |
6 |
Correct |
739 ms |
64048 KB |
Output is correct |
7 |
Correct |
781 ms |
64108 KB |
Output is correct |
8 |
Correct |
773 ms |
20180 KB |
Output is correct |
9 |
Correct |
751 ms |
20184 KB |
Output is correct |
10 |
Correct |
648 ms |
20188 KB |
Output is correct |
11 |
Correct |
677 ms |
20180 KB |
Output is correct |
12 |
Correct |
95 ms |
49448 KB |
Output is correct |
13 |
Correct |
140 ms |
64104 KB |
Output is correct |
14 |
Correct |
140 ms |
64056 KB |
Output is correct |
15 |
Correct |
29 ms |
20188 KB |
Output is correct |
16 |
Correct |
22 ms |
20176 KB |
Output is correct |
17 |
Correct |
87 ms |
48032 KB |
Output is correct |
18 |
Correct |
112 ms |
49532 KB |
Output is correct |
19 |
Correct |
106 ms |
49508 KB |
Output is correct |
20 |
Correct |
139 ms |
64060 KB |
Output is correct |
21 |
Correct |
130 ms |
64092 KB |
Output is correct |
22 |
Correct |
130 ms |
64036 KB |
Output is correct |
23 |
Correct |
139 ms |
64088 KB |
Output is correct |
24 |
Correct |
21 ms |
20200 KB |
Output is correct |
25 |
Correct |
28 ms |
20236 KB |
Output is correct |
26 |
Correct |
28 ms |
20180 KB |
Output is correct |
27 |
Correct |
22 ms |
20180 KB |
Output is correct |
28 |
Correct |
5 ms |
10320 KB |
Output is correct |
29 |
Correct |
6 ms |
10448 KB |
Output is correct |
30 |
Correct |
6 ms |
10468 KB |
Output is correct |
31 |
Correct |
5 ms |
9808 KB |
Output is correct |
32 |
Correct |
4 ms |
9808 KB |
Output is correct |
33 |
Correct |
4 ms |
9936 KB |
Output is correct |
34 |
Correct |
5 ms |
10320 KB |
Output is correct |
35 |
Correct |
5 ms |
10192 KB |
Output is correct |
36 |
Correct |
6 ms |
10448 KB |
Output is correct |
37 |
Correct |
6 ms |
10448 KB |
Output is correct |
38 |
Correct |
8 ms |
10472 KB |
Output is correct |
39 |
Correct |
6 ms |
10448 KB |
Output is correct |
40 |
Correct |
5 ms |
9836 KB |
Output is correct |
41 |
Correct |
5 ms |
9888 KB |
Output is correct |
42 |
Correct |
6 ms |
9812 KB |
Output is correct |
43 |
Correct |
5 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9808 KB |
Output is correct |
2 |
Correct |
5 ms |
10320 KB |
Output is correct |
3 |
Correct |
6 ms |
10320 KB |
Output is correct |
4 |
Correct |
6 ms |
10448 KB |
Output is correct |
5 |
Correct |
6 ms |
10448 KB |
Output is correct |
6 |
Correct |
7 ms |
10448 KB |
Output is correct |
7 |
Correct |
5 ms |
10448 KB |
Output is correct |
8 |
Correct |
4 ms |
9808 KB |
Output is correct |
9 |
Correct |
4 ms |
9808 KB |
Output is correct |
10 |
Correct |
4 ms |
9888 KB |
Output is correct |
11 |
Correct |
5 ms |
9808 KB |
Output is correct |
12 |
Correct |
4 ms |
9680 KB |
Output is correct |
13 |
Correct |
5 ms |
9808 KB |
Output is correct |
14 |
Correct |
4 ms |
9808 KB |
Output is correct |
15 |
Correct |
6 ms |
10320 KB |
Output is correct |
16 |
Correct |
5 ms |
10448 KB |
Output is correct |
17 |
Correct |
5 ms |
10448 KB |
Output is correct |
18 |
Correct |
4 ms |
9888 KB |
Output is correct |
19 |
Correct |
4 ms |
9808 KB |
Output is correct |
20 |
Correct |
5 ms |
10264 KB |
Output is correct |
21 |
Correct |
5 ms |
10396 KB |
Output is correct |
22 |
Correct |
7 ms |
10448 KB |
Output is correct |
23 |
Correct |
5 ms |
9808 KB |
Output is correct |
24 |
Correct |
4 ms |
9808 KB |
Output is correct |
25 |
Correct |
4 ms |
9936 KB |
Output is correct |
26 |
Correct |
5 ms |
10320 KB |
Output is correct |
27 |
Correct |
5 ms |
10320 KB |
Output is correct |
28 |
Correct |
5 ms |
10448 KB |
Output is correct |
29 |
Correct |
5 ms |
10412 KB |
Output is correct |
30 |
Correct |
5 ms |
10448 KB |
Output is correct |
31 |
Correct |
6 ms |
10448 KB |
Output is correct |
32 |
Correct |
4 ms |
9808 KB |
Output is correct |
33 |
Correct |
4 ms |
9808 KB |
Output is correct |
34 |
Correct |
4 ms |
9808 KB |
Output is correct |
35 |
Correct |
4 ms |
9808 KB |
Output is correct |
36 |
Correct |
57 ms |
34840 KB |
Output is correct |
37 |
Correct |
100 ms |
49620 KB |
Output is correct |
38 |
Correct |
94 ms |
49428 KB |
Output is correct |
39 |
Correct |
131 ms |
64092 KB |
Output is correct |
40 |
Correct |
137 ms |
64076 KB |
Output is correct |
41 |
Correct |
135 ms |
64072 KB |
Output is correct |
42 |
Correct |
137 ms |
64124 KB |
Output is correct |
43 |
Correct |
21 ms |
20176 KB |
Output is correct |
44 |
Correct |
21 ms |
20196 KB |
Output is correct |
45 |
Correct |
21 ms |
20176 KB |
Output is correct |
46 |
Correct |
23 ms |
20168 KB |
Output is correct |
47 |
Correct |
92 ms |
49472 KB |
Output is correct |
48 |
Correct |
145 ms |
64096 KB |
Output is correct |
49 |
Correct |
139 ms |
64060 KB |
Output is correct |
50 |
Correct |
21 ms |
20220 KB |
Output is correct |
51 |
Correct |
21 ms |
20184 KB |
Output is correct |
52 |
Correct |
98 ms |
49452 KB |
Output is correct |
53 |
Correct |
138 ms |
64056 KB |
Output is correct |
54 |
Correct |
140 ms |
64080 KB |
Output is correct |
55 |
Correct |
21 ms |
20164 KB |
Output is correct |
56 |
Correct |
22 ms |
20132 KB |
Output is correct |
57 |
Correct |
90 ms |
48076 KB |
Output is correct |
58 |
Correct |
94 ms |
49484 KB |
Output is correct |
59 |
Correct |
101 ms |
49592 KB |
Output is correct |
60 |
Correct |
133 ms |
64072 KB |
Output is correct |
61 |
Correct |
136 ms |
64088 KB |
Output is correct |
62 |
Correct |
140 ms |
64068 KB |
Output is correct |
63 |
Correct |
139 ms |
64104 KB |
Output is correct |
64 |
Correct |
21 ms |
20172 KB |
Output is correct |
65 |
Correct |
21 ms |
20200 KB |
Output is correct |
66 |
Correct |
22 ms |
20208 KB |
Output is correct |
67 |
Correct |
28 ms |
20184 KB |
Output is correct |
68 |
Correct |
710 ms |
96860 KB |
Output is correct |
69 |
Correct |
997 ms |
112368 KB |
Output is correct |
70 |
Correct |
943 ms |
112372 KB |
Output is correct |
71 |
Correct |
1132 ms |
126352 KB |
Output is correct |
72 |
Correct |
1010 ms |
126332 KB |
Output is correct |
73 |
Correct |
1032 ms |
126400 KB |
Output is correct |
74 |
Correct |
1079 ms |
126368 KB |
Output is correct |
75 |
Correct |
929 ms |
84024 KB |
Output is correct |
76 |
Correct |
955 ms |
84140 KB |
Output is correct |
77 |
Correct |
998 ms |
84096 KB |
Output is correct |
78 |
Correct |
1089 ms |
84104 KB |
Output is correct |
79 |
Correct |
1060 ms |
84256 KB |
Output is correct |
80 |
Correct |
828 ms |
84244 KB |
Output is correct |
81 |
Correct |
5 ms |
9680 KB |
Output is correct |
82 |
Correct |
5 ms |
9840 KB |
Output is correct |
83 |
Correct |
5 ms |
9808 KB |
Output is correct |
84 |
Correct |
90 ms |
49368 KB |
Output is correct |
85 |
Correct |
134 ms |
64108 KB |
Output is correct |
86 |
Correct |
172 ms |
64112 KB |
Output is correct |
87 |
Correct |
27 ms |
20204 KB |
Output is correct |
88 |
Correct |
32 ms |
20200 KB |
Output is correct |
89 |
Correct |
106 ms |
49480 KB |
Output is correct |
90 |
Correct |
139 ms |
64104 KB |
Output is correct |
91 |
Correct |
142 ms |
64060 KB |
Output is correct |
92 |
Correct |
21 ms |
20204 KB |
Output is correct |
93 |
Correct |
22 ms |
20208 KB |
Output is correct |
94 |
Correct |
5 ms |
10320 KB |
Output is correct |
95 |
Correct |
6 ms |
10448 KB |
Output is correct |
96 |
Correct |
5 ms |
10448 KB |
Output is correct |
97 |
Correct |
4 ms |
9808 KB |
Output is correct |
98 |
Correct |
4 ms |
9808 KB |
Output is correct |
99 |
Correct |
5 ms |
10212 KB |
Output is correct |
100 |
Correct |
6 ms |
10448 KB |
Output is correct |
101 |
Correct |
6 ms |
10508 KB |
Output is correct |
102 |
Correct |
4 ms |
9808 KB |
Output is correct |
103 |
Correct |
4 ms |
9808 KB |
Output is correct |
104 |
Correct |
881 ms |
98144 KB |
Output is correct |
105 |
Correct |
1018 ms |
112216 KB |
Output is correct |
106 |
Correct |
1052 ms |
112588 KB |
Output is correct |
107 |
Correct |
1178 ms |
126376 KB |
Output is correct |
108 |
Correct |
1092 ms |
126472 KB |
Output is correct |
109 |
Correct |
1084 ms |
126412 KB |
Output is correct |
110 |
Correct |
1083 ms |
126592 KB |
Output is correct |
111 |
Correct |
1016 ms |
84236 KB |
Output is correct |
112 |
Correct |
835 ms |
84116 KB |
Output is correct |
113 |
Correct |
1014 ms |
84012 KB |
Output is correct |
114 |
Correct |
907 ms |
84216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
484 ms |
44200 KB |
Output is correct |
2 |
Correct |
850 ms |
84168 KB |
Output is correct |
3 |
Correct |
982 ms |
84188 KB |
Output is correct |
4 |
Correct |
1094 ms |
84148 KB |
Output is correct |
5 |
Correct |
976 ms |
84028 KB |
Output is correct |
6 |
Correct |
1012 ms |
84108 KB |
Output is correct |
7 |
Correct |
1028 ms |
84144 KB |
Output is correct |
8 |
Correct |
4 ms |
9680 KB |
Output is correct |
9 |
Correct |
4 ms |
9808 KB |
Output is correct |
10 |
Correct |
4 ms |
9808 KB |
Output is correct |
11 |
Correct |
4 ms |
9808 KB |
Output is correct |
12 |
Correct |
5 ms |
10320 KB |
Output is correct |
13 |
Correct |
6 ms |
10320 KB |
Output is correct |
14 |
Correct |
6 ms |
10448 KB |
Output is correct |
15 |
Correct |
6 ms |
10448 KB |
Output is correct |
16 |
Correct |
7 ms |
10448 KB |
Output is correct |
17 |
Correct |
5 ms |
10448 KB |
Output is correct |
18 |
Correct |
4 ms |
9808 KB |
Output is correct |
19 |
Correct |
4 ms |
9808 KB |
Output is correct |
20 |
Correct |
4 ms |
9888 KB |
Output is correct |
21 |
Correct |
5 ms |
9808 KB |
Output is correct |
22 |
Correct |
4 ms |
9680 KB |
Output is correct |
23 |
Correct |
5 ms |
9808 KB |
Output is correct |
24 |
Correct |
4 ms |
9808 KB |
Output is correct |
25 |
Correct |
6 ms |
10320 KB |
Output is correct |
26 |
Correct |
5 ms |
10448 KB |
Output is correct |
27 |
Correct |
5 ms |
10448 KB |
Output is correct |
28 |
Correct |
4 ms |
9888 KB |
Output is correct |
29 |
Correct |
4 ms |
9808 KB |
Output is correct |
30 |
Correct |
5 ms |
10264 KB |
Output is correct |
31 |
Correct |
5 ms |
10396 KB |
Output is correct |
32 |
Correct |
7 ms |
10448 KB |
Output is correct |
33 |
Correct |
5 ms |
9808 KB |
Output is correct |
34 |
Correct |
4 ms |
9808 KB |
Output is correct |
35 |
Correct |
4 ms |
9936 KB |
Output is correct |
36 |
Correct |
5 ms |
10320 KB |
Output is correct |
37 |
Correct |
5 ms |
10320 KB |
Output is correct |
38 |
Correct |
5 ms |
10448 KB |
Output is correct |
39 |
Correct |
5 ms |
10412 KB |
Output is correct |
40 |
Correct |
5 ms |
10448 KB |
Output is correct |
41 |
Correct |
6 ms |
10448 KB |
Output is correct |
42 |
Correct |
4 ms |
9808 KB |
Output is correct |
43 |
Correct |
4 ms |
9808 KB |
Output is correct |
44 |
Correct |
4 ms |
9808 KB |
Output is correct |
45 |
Correct |
4 ms |
9808 KB |
Output is correct |
46 |
Correct |
57 ms |
34840 KB |
Output is correct |
47 |
Correct |
100 ms |
49620 KB |
Output is correct |
48 |
Correct |
94 ms |
49428 KB |
Output is correct |
49 |
Correct |
131 ms |
64092 KB |
Output is correct |
50 |
Correct |
137 ms |
64076 KB |
Output is correct |
51 |
Correct |
135 ms |
64072 KB |
Output is correct |
52 |
Correct |
137 ms |
64124 KB |
Output is correct |
53 |
Correct |
21 ms |
20176 KB |
Output is correct |
54 |
Correct |
21 ms |
20196 KB |
Output is correct |
55 |
Correct |
21 ms |
20176 KB |
Output is correct |
56 |
Correct |
23 ms |
20168 KB |
Output is correct |
57 |
Correct |
92 ms |
49472 KB |
Output is correct |
58 |
Correct |
145 ms |
64096 KB |
Output is correct |
59 |
Correct |
139 ms |
64060 KB |
Output is correct |
60 |
Correct |
21 ms |
20220 KB |
Output is correct |
61 |
Correct |
21 ms |
20184 KB |
Output is correct |
62 |
Correct |
98 ms |
49452 KB |
Output is correct |
63 |
Correct |
138 ms |
64056 KB |
Output is correct |
64 |
Correct |
140 ms |
64080 KB |
Output is correct |
65 |
Correct |
21 ms |
20164 KB |
Output is correct |
66 |
Correct |
22 ms |
20132 KB |
Output is correct |
67 |
Correct |
90 ms |
48076 KB |
Output is correct |
68 |
Correct |
94 ms |
49484 KB |
Output is correct |
69 |
Correct |
101 ms |
49592 KB |
Output is correct |
70 |
Correct |
133 ms |
64072 KB |
Output is correct |
71 |
Correct |
136 ms |
64088 KB |
Output is correct |
72 |
Correct |
140 ms |
64068 KB |
Output is correct |
73 |
Correct |
139 ms |
64104 KB |
Output is correct |
74 |
Correct |
21 ms |
20172 KB |
Output is correct |
75 |
Correct |
21 ms |
20200 KB |
Output is correct |
76 |
Correct |
22 ms |
20208 KB |
Output is correct |
77 |
Correct |
28 ms |
20184 KB |
Output is correct |
78 |
Correct |
710 ms |
96860 KB |
Output is correct |
79 |
Correct |
997 ms |
112368 KB |
Output is correct |
80 |
Correct |
943 ms |
112372 KB |
Output is correct |
81 |
Correct |
1132 ms |
126352 KB |
Output is correct |
82 |
Correct |
1010 ms |
126332 KB |
Output is correct |
83 |
Correct |
1032 ms |
126400 KB |
Output is correct |
84 |
Correct |
1079 ms |
126368 KB |
Output is correct |
85 |
Correct |
929 ms |
84024 KB |
Output is correct |
86 |
Correct |
955 ms |
84140 KB |
Output is correct |
87 |
Correct |
998 ms |
84096 KB |
Output is correct |
88 |
Correct |
1089 ms |
84104 KB |
Output is correct |
89 |
Correct |
1060 ms |
84256 KB |
Output is correct |
90 |
Correct |
828 ms |
84244 KB |
Output is correct |
91 |
Correct |
5 ms |
9680 KB |
Output is correct |
92 |
Correct |
5 ms |
9840 KB |
Output is correct |
93 |
Correct |
5 ms |
9808 KB |
Output is correct |
94 |
Correct |
90 ms |
49368 KB |
Output is correct |
95 |
Correct |
134 ms |
64108 KB |
Output is correct |
96 |
Correct |
172 ms |
64112 KB |
Output is correct |
97 |
Correct |
27 ms |
20204 KB |
Output is correct |
98 |
Correct |
32 ms |
20200 KB |
Output is correct |
99 |
Correct |
106 ms |
49480 KB |
Output is correct |
100 |
Correct |
139 ms |
64104 KB |
Output is correct |
101 |
Correct |
142 ms |
64060 KB |
Output is correct |
102 |
Correct |
21 ms |
20204 KB |
Output is correct |
103 |
Correct |
22 ms |
20208 KB |
Output is correct |
104 |
Correct |
5 ms |
10320 KB |
Output is correct |
105 |
Correct |
6 ms |
10448 KB |
Output is correct |
106 |
Correct |
5 ms |
10448 KB |
Output is correct |
107 |
Correct |
4 ms |
9808 KB |
Output is correct |
108 |
Correct |
4 ms |
9808 KB |
Output is correct |
109 |
Correct |
5 ms |
10212 KB |
Output is correct |
110 |
Correct |
6 ms |
10448 KB |
Output is correct |
111 |
Correct |
6 ms |
10508 KB |
Output is correct |
112 |
Correct |
4 ms |
9808 KB |
Output is correct |
113 |
Correct |
4 ms |
9808 KB |
Output is correct |
114 |
Correct |
283 ms |
18352 KB |
Output is correct |
115 |
Correct |
799 ms |
49468 KB |
Output is correct |
116 |
Correct |
733 ms |
49480 KB |
Output is correct |
117 |
Correct |
827 ms |
64084 KB |
Output is correct |
118 |
Correct |
834 ms |
64092 KB |
Output is correct |
119 |
Correct |
739 ms |
64048 KB |
Output is correct |
120 |
Correct |
781 ms |
64108 KB |
Output is correct |
121 |
Correct |
773 ms |
20180 KB |
Output is correct |
122 |
Correct |
751 ms |
20184 KB |
Output is correct |
123 |
Correct |
648 ms |
20188 KB |
Output is correct |
124 |
Correct |
677 ms |
20180 KB |
Output is correct |
125 |
Correct |
95 ms |
49448 KB |
Output is correct |
126 |
Correct |
140 ms |
64104 KB |
Output is correct |
127 |
Correct |
140 ms |
64056 KB |
Output is correct |
128 |
Correct |
29 ms |
20188 KB |
Output is correct |
129 |
Correct |
22 ms |
20176 KB |
Output is correct |
130 |
Correct |
87 ms |
48032 KB |
Output is correct |
131 |
Correct |
112 ms |
49532 KB |
Output is correct |
132 |
Correct |
106 ms |
49508 KB |
Output is correct |
133 |
Correct |
139 ms |
64060 KB |
Output is correct |
134 |
Correct |
130 ms |
64092 KB |
Output is correct |
135 |
Correct |
130 ms |
64036 KB |
Output is correct |
136 |
Correct |
139 ms |
64088 KB |
Output is correct |
137 |
Correct |
21 ms |
20200 KB |
Output is correct |
138 |
Correct |
28 ms |
20236 KB |
Output is correct |
139 |
Correct |
28 ms |
20180 KB |
Output is correct |
140 |
Correct |
22 ms |
20180 KB |
Output is correct |
141 |
Correct |
5 ms |
10320 KB |
Output is correct |
142 |
Correct |
6 ms |
10448 KB |
Output is correct |
143 |
Correct |
6 ms |
10468 KB |
Output is correct |
144 |
Correct |
5 ms |
9808 KB |
Output is correct |
145 |
Correct |
4 ms |
9808 KB |
Output is correct |
146 |
Correct |
4 ms |
9936 KB |
Output is correct |
147 |
Correct |
5 ms |
10320 KB |
Output is correct |
148 |
Correct |
5 ms |
10192 KB |
Output is correct |
149 |
Correct |
6 ms |
10448 KB |
Output is correct |
150 |
Correct |
6 ms |
10448 KB |
Output is correct |
151 |
Correct |
8 ms |
10472 KB |
Output is correct |
152 |
Correct |
6 ms |
10448 KB |
Output is correct |
153 |
Correct |
5 ms |
9836 KB |
Output is correct |
154 |
Correct |
5 ms |
9888 KB |
Output is correct |
155 |
Correct |
6 ms |
9812 KB |
Output is correct |
156 |
Correct |
5 ms |
9808 KB |
Output is correct |
157 |
Correct |
881 ms |
98144 KB |
Output is correct |
158 |
Correct |
1018 ms |
112216 KB |
Output is correct |
159 |
Correct |
1052 ms |
112588 KB |
Output is correct |
160 |
Correct |
1178 ms |
126376 KB |
Output is correct |
161 |
Correct |
1092 ms |
126472 KB |
Output is correct |
162 |
Correct |
1084 ms |
126412 KB |
Output is correct |
163 |
Correct |
1083 ms |
126592 KB |
Output is correct |
164 |
Correct |
1016 ms |
84236 KB |
Output is correct |
165 |
Correct |
835 ms |
84116 KB |
Output is correct |
166 |
Correct |
1014 ms |
84012 KB |
Output is correct |
167 |
Correct |
907 ms |
84216 KB |
Output is correct |
168 |
Correct |
6 ms |
9680 KB |
Output is correct |
169 |
Correct |
737 ms |
61276 KB |
Output is correct |
170 |
Correct |
1411 ms |
112224 KB |
Output is correct |
171 |
Correct |
1471 ms |
112244 KB |
Output is correct |
172 |
Correct |
1247 ms |
126528 KB |
Output is correct |
173 |
Correct |
1274 ms |
126452 KB |
Output is correct |
174 |
Correct |
1311 ms |
126416 KB |
Output is correct |
175 |
Correct |
1234 ms |
126524 KB |
Output is correct |
176 |
Correct |
983 ms |
84244 KB |
Output is correct |
177 |
Correct |
919 ms |
84136 KB |
Output is correct |
178 |
Correct |
1006 ms |
84136 KB |
Output is correct |
179 |
Correct |
880 ms |
84292 KB |
Output is correct |