#include "towers.h"
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
// <|°_°|>
// M. Broccoli
// The hardest choices require the strongest wills
// What is better - to be born good, or to overcome your evil nature with great effort ?
const int MAX_TOWERS = (1e5);
const int LOG = (17);
const int SIZE = (1 << LOG);
struct node_persistent {
int left, right, sum;
};
struct node {
int mini, maxi, id_maxi, delta_left, delta_right;
};
vector <pair <int, int>> Root;
node_persistent Tree[LOG * MAX_TOWERS];
int _size = 0;
node TreeOp[2 * MAX_TOWERS];
int Heights[MAX_TOWERS];
pair <int, int> Valleys[MAX_TOWERS];
int nbTowers;
node operator+(node a, node b) {
return {min(a.mini, b.mini), max(a.maxi, b.maxi), Heights[a.id_maxi] > Heights[b.id_maxi] ? a.id_maxi : b.id_maxi, max(max(a.delta_left, b.delta_left), b.maxi - a.mini), max(max(a.delta_right, b.delta_right), a.maxi - b.mini)};
}
int Copy(int a, int &b) {
Tree[_size ++] = Tree[a];
return b = _size - 1;
}
int MakeRoot(int a = 1) {
Root.push_back({0, Copy(Root.back().second, a)});
return Root.back().second;
}
void Remove(int node, int target, int left = 0, int right = SIZE) {
Tree[node].sum --;
if (right - left == 1)
return;
int mid = (left + right) >> 1;
if (target < mid)
Remove(Copy(Tree[node].left, Tree[node].left), target, left, mid);
else
Remove(Copy(Tree[node].right, Tree[node].right), target, mid, right);
return;
}
int GetSum(int node, int qleft, int qright, int left = 0, int right = SIZE) {
if (left >= qright || right <= qleft)
return 0;
if (qleft <= left && right <= qright)
return Tree[node].sum;
int mid = (left + right) >> 1;
return GetSum(Tree[node].left, qleft, qright, left, mid) + GetSum(Tree[node].right, qleft, qright, mid, right);
}
int GetPrev(int node, int target, int left = 0, int right = SIZE) {
if (!Tree[node].sum)
return -1;
if (right - left == 1)
return left;
int mid = (left + right) >> 1;
int ans = -1;
if (target > mid)
ans = GetPrev(Tree[node].right, target, mid, right);
return ans < 0 ? GetPrev(Tree[node].left, target, left, mid) : ans;
}
int GetNext(int node, int target, int left = 0, int right = SIZE) {
if (!Tree[node].sum)
return -1;
if (right - left == 1)
return left;
int mid = (left + right) >> 1;
int ans = -1;
if (target < mid)
ans = GetNext(Tree[node].left, target, left, mid);
return ans < 0 ? GetNext(Tree[node].right, target, mid, right) : ans;
}
node GetOp(int left, int right) {
node ansLeft = {1LL << 30, 0, left, 0, 0};
node ansRight = {1LL << 30, 0, left, 0, 0};
for (left += nbTowers, right += nbTowers; left < right; left >>= 1, right >>= 1)
{
if (left & 1)
ansLeft = ansLeft + TreeOp[left ++];
if (right & 1)
ansRight = TreeOp[-- right] + ansRight;
}
return ansLeft + ansRight;
}
int SearchLeft(int node, int target, int under) {
if (under ? TreeOp[node].mini > target : TreeOp[node].maxi < target)
{
if (node == 1)
return -1;
if (~node & 1)
return SearchLeft(-- node, target, under);
return SearchLeft(node >> 1, target, under);
}
if (node >= nbTowers)
return node - nbTowers;
if (under ? TreeOp[2 * node + 1].mini > target : TreeOp[2 * node + 1].maxi < target)
return SearchLeft(2 * node, target, under);
return SearchLeft(2 * node + 1, target, under);
}
int SearchRight(int node, int target, int under) {
if (under ? TreeOp[node].mini > target : TreeOp[node].maxi < target)
{
if (node == 1)
return -1;
if (node & 1)
return SearchRight(++ node, target, under);
return SearchRight(node >> 1, target, under);
}
if (node >= nbTowers)
return node - nbTowers;
if (under ? TreeOp[2 * node].mini > target : TreeOp[2 * node].maxi < target)
return SearchRight(2 * node + 1, target, under);
return SearchRight(2 * node, target, under);
}
void init(int N, vector <int> H) {
nbTowers = N;
_size = 2 * SIZE;
int cnt = 0;
for (int i = 0; i < nbTowers; i ++)
{
Heights[i] = H[i];
TreeOp[i + nbTowers] = {Heights[i], Heights[i], i, 0, 0};
if ((!i || H[i] < H[i - 1]) && (i + 1 == nbTowers || H[i] < H[i + 1]))
{
Tree[i + SIZE].sum = 1;
Valleys[cnt ++].second = i;
}
}
for (int i = SIZE - 1; i; i --)
{
Tree[i] = {2 * i, 2 * i + 1, Tree[2 * i].sum + Tree[2 * i + 1].sum};
}
for (int i = nbTowers - 1; i; i --)
{
TreeOp[i] = TreeOp[2 * i] + TreeOp[2 * i + 1];
}
for (int i = 0; i < cnt; i ++)
{
int id = Valleys[i].second;
int left = GetOp(0, id).mini < Heights[id] ? SearchLeft(id + nbTowers, Heights[id] - 1, 1) : -1;
int right = GetOp(id, nbTowers).mini < Heights[id] ? SearchRight(id + nbTowers, Heights[id] - 1, 1) : -1;
left = left < 0 ? 1 << 30 : GetOp(left, id).maxi;
right = right < 0 ? 1 << 30 : GetOp(id, right).maxi;
Valleys[i].first = min(left, right) - Heights[id];
}
Root.push_back({0, 1});
sort(Valleys, Valleys + cnt);
for (int i = 0; i < cnt; i ++)
{
Remove(MakeRoot(), Valleys[i].second);
Root.back().first = Valleys[i].first;
}
return;
}
int max_towers(int left, int right, int delta) {
int root = 0;
int sz = Root.size();
for (int jump = SIZE; jump; jump >>= 1)
{
if (jump + root < sz && delta > Root[jump + root].first)
root += jump;
}
root = Root[root].second;
int ans = GetSum(root, left, ++ right);
if (!ans)
{
int id = GetOp(left, right).id_maxi;
if (max(GetOp(left, id).mini, GetOp(id, right).mini) + delta <= Heights[id])
ans = 2;
else
ans = 1;
return ans;
}
int next = GetNext(root, left), prev = GetPrev(root, right);
ans += GetOp(left, next).maxi >= Heights[next] + delta && GetOp(left, SearchLeft(next + nbTowers, Heights[next] + delta, 0) + 1).delta_left >= delta;
ans += GetOp(prev, right).maxi >= Heights[prev] + delta && GetOp(SearchRight(prev + nbTowers, Heights[prev] + delta, 0), right).delta_right >= delta;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
435 ms |
4816 KB |
Output is correct |
2 |
Correct |
954 ms |
6828 KB |
Output is correct |
3 |
Correct |
1018 ms |
6944 KB |
Output is correct |
4 |
Correct |
1038 ms |
6812 KB |
Output is correct |
5 |
Correct |
931 ms |
6812 KB |
Output is correct |
6 |
Correct |
986 ms |
6828 KB |
Output is correct |
7 |
Correct |
992 ms |
6828 KB |
Output is correct |
8 |
Correct |
2 ms |
1744 KB |
Output is correct |
9 |
Correct |
2 ms |
1872 KB |
Output is correct |
10 |
Correct |
2 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1872 KB |
Output is correct |
2 |
Correct |
2 ms |
2128 KB |
Output is correct |
3 |
Correct |
3 ms |
2128 KB |
Output is correct |
4 |
Correct |
2 ms |
2128 KB |
Output is correct |
5 |
Correct |
2 ms |
2128 KB |
Output is correct |
6 |
Correct |
2 ms |
2168 KB |
Output is correct |
7 |
Correct |
2 ms |
2128 KB |
Output is correct |
8 |
Correct |
2 ms |
1872 KB |
Output is correct |
9 |
Correct |
2 ms |
1872 KB |
Output is correct |
10 |
Correct |
2 ms |
1872 KB |
Output is correct |
11 |
Correct |
2 ms |
1872 KB |
Output is correct |
12 |
Correct |
1 ms |
1744 KB |
Output is correct |
13 |
Correct |
2 ms |
1872 KB |
Output is correct |
14 |
Correct |
2 ms |
1872 KB |
Output is correct |
15 |
Correct |
2 ms |
2128 KB |
Output is correct |
16 |
Correct |
2 ms |
2128 KB |
Output is correct |
17 |
Correct |
2 ms |
2128 KB |
Output is correct |
18 |
Correct |
1 ms |
1872 KB |
Output is correct |
19 |
Correct |
2 ms |
1872 KB |
Output is correct |
20 |
Correct |
3 ms |
2128 KB |
Output is correct |
21 |
Correct |
2 ms |
2128 KB |
Output is correct |
22 |
Correct |
2 ms |
2128 KB |
Output is correct |
23 |
Correct |
1 ms |
1872 KB |
Output is correct |
24 |
Correct |
3 ms |
1872 KB |
Output is correct |
25 |
Correct |
2 ms |
1892 KB |
Output is correct |
26 |
Correct |
2 ms |
2128 KB |
Output is correct |
27 |
Correct |
2 ms |
2128 KB |
Output is correct |
28 |
Correct |
2 ms |
2128 KB |
Output is correct |
29 |
Correct |
2 ms |
2128 KB |
Output is correct |
30 |
Correct |
2 ms |
2128 KB |
Output is correct |
31 |
Correct |
2 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1872 KB |
Output is correct |
33 |
Correct |
2 ms |
1872 KB |
Output is correct |
34 |
Correct |
2 ms |
1872 KB |
Output is correct |
35 |
Correct |
1 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1872 KB |
Output is correct |
2 |
Correct |
2 ms |
2128 KB |
Output is correct |
3 |
Correct |
3 ms |
2128 KB |
Output is correct |
4 |
Correct |
2 ms |
2128 KB |
Output is correct |
5 |
Correct |
2 ms |
2128 KB |
Output is correct |
6 |
Correct |
2 ms |
2168 KB |
Output is correct |
7 |
Correct |
2 ms |
2128 KB |
Output is correct |
8 |
Correct |
2 ms |
1872 KB |
Output is correct |
9 |
Correct |
2 ms |
1872 KB |
Output is correct |
10 |
Correct |
2 ms |
1872 KB |
Output is correct |
11 |
Correct |
2 ms |
1872 KB |
Output is correct |
12 |
Correct |
1 ms |
1744 KB |
Output is correct |
13 |
Correct |
2 ms |
1872 KB |
Output is correct |
14 |
Correct |
2 ms |
1872 KB |
Output is correct |
15 |
Correct |
2 ms |
2128 KB |
Output is correct |
16 |
Correct |
2 ms |
2128 KB |
Output is correct |
17 |
Correct |
2 ms |
2128 KB |
Output is correct |
18 |
Correct |
1 ms |
1872 KB |
Output is correct |
19 |
Correct |
2 ms |
1872 KB |
Output is correct |
20 |
Correct |
3 ms |
2128 KB |
Output is correct |
21 |
Correct |
2 ms |
2128 KB |
Output is correct |
22 |
Correct |
2 ms |
2128 KB |
Output is correct |
23 |
Correct |
1 ms |
1872 KB |
Output is correct |
24 |
Correct |
3 ms |
1872 KB |
Output is correct |
25 |
Correct |
2 ms |
1892 KB |
Output is correct |
26 |
Correct |
2 ms |
2128 KB |
Output is correct |
27 |
Correct |
2 ms |
2128 KB |
Output is correct |
28 |
Correct |
2 ms |
2128 KB |
Output is correct |
29 |
Correct |
2 ms |
2128 KB |
Output is correct |
30 |
Correct |
2 ms |
2128 KB |
Output is correct |
31 |
Correct |
2 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1872 KB |
Output is correct |
33 |
Correct |
2 ms |
1872 KB |
Output is correct |
34 |
Correct |
2 ms |
1872 KB |
Output is correct |
35 |
Correct |
1 ms |
1872 KB |
Output is correct |
36 |
Correct |
34 ms |
10956 KB |
Output is correct |
37 |
Correct |
48 ms |
15928 KB |
Output is correct |
38 |
Correct |
47 ms |
15908 KB |
Output is correct |
39 |
Correct |
64 ms |
19476 KB |
Output is correct |
40 |
Correct |
58 ms |
19540 KB |
Output is correct |
41 |
Correct |
61 ms |
19472 KB |
Output is correct |
42 |
Correct |
62 ms |
19520 KB |
Output is correct |
43 |
Correct |
17 ms |
6940 KB |
Output is correct |
44 |
Correct |
21 ms |
6836 KB |
Output is correct |
45 |
Correct |
17 ms |
6940 KB |
Output is correct |
46 |
Correct |
17 ms |
6828 KB |
Output is correct |
47 |
Correct |
47 ms |
15900 KB |
Output is correct |
48 |
Correct |
56 ms |
19476 KB |
Output is correct |
49 |
Correct |
59 ms |
19476 KB |
Output is correct |
50 |
Correct |
17 ms |
6808 KB |
Output is correct |
51 |
Correct |
16 ms |
6880 KB |
Output is correct |
52 |
Correct |
45 ms |
15908 KB |
Output is correct |
53 |
Correct |
66 ms |
19600 KB |
Output is correct |
54 |
Correct |
58 ms |
19480 KB |
Output is correct |
55 |
Correct |
16 ms |
6836 KB |
Output is correct |
56 |
Correct |
16 ms |
6856 KB |
Output is correct |
57 |
Correct |
48 ms |
15308 KB |
Output is correct |
58 |
Correct |
54 ms |
15880 KB |
Output is correct |
59 |
Correct |
49 ms |
15852 KB |
Output is correct |
60 |
Correct |
57 ms |
19520 KB |
Output is correct |
61 |
Correct |
62 ms |
19492 KB |
Output is correct |
62 |
Correct |
69 ms |
19448 KB |
Output is correct |
63 |
Correct |
58 ms |
19608 KB |
Output is correct |
64 |
Correct |
20 ms |
6812 KB |
Output is correct |
65 |
Correct |
25 ms |
6808 KB |
Output is correct |
66 |
Correct |
17 ms |
6936 KB |
Output is correct |
67 |
Correct |
23 ms |
6936 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
737 ms |
15876 KB |
Output is correct |
2 |
Correct |
1145 ms |
15896 KB |
Output is correct |
3 |
Correct |
1185 ms |
15812 KB |
Output is correct |
4 |
Correct |
998 ms |
19524 KB |
Output is correct |
5 |
Correct |
1084 ms |
19472 KB |
Output is correct |
6 |
Correct |
1082 ms |
19480 KB |
Output is correct |
7 |
Correct |
1101 ms |
19476 KB |
Output is correct |
8 |
Correct |
1029 ms |
6920 KB |
Output is correct |
9 |
Correct |
994 ms |
6816 KB |
Output is correct |
10 |
Correct |
1071 ms |
6936 KB |
Output is correct |
11 |
Correct |
901 ms |
6856 KB |
Output is correct |
12 |
Correct |
902 ms |
6864 KB |
Output is correct |
13 |
Correct |
1049 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
1744 KB |
Output is correct |
15 |
Correct |
3 ms |
1872 KB |
Output is correct |
16 |
Correct |
2 ms |
1872 KB |
Output is correct |
17 |
Correct |
51 ms |
15896 KB |
Output is correct |
18 |
Correct |
61 ms |
19476 KB |
Output is correct |
19 |
Correct |
68 ms |
19484 KB |
Output is correct |
20 |
Correct |
17 ms |
6844 KB |
Output is correct |
21 |
Correct |
17 ms |
6900 KB |
Output is correct |
22 |
Correct |
45 ms |
15852 KB |
Output is correct |
23 |
Correct |
57 ms |
19564 KB |
Output is correct |
24 |
Correct |
60 ms |
19492 KB |
Output is correct |
25 |
Correct |
16 ms |
6812 KB |
Output is correct |
26 |
Correct |
17 ms |
6856 KB |
Output is correct |
27 |
Correct |
2 ms |
2128 KB |
Output is correct |
28 |
Correct |
2 ms |
2128 KB |
Output is correct |
29 |
Correct |
2 ms |
2128 KB |
Output is correct |
30 |
Correct |
1 ms |
1872 KB |
Output is correct |
31 |
Correct |
2 ms |
1872 KB |
Output is correct |
32 |
Correct |
2 ms |
2128 KB |
Output is correct |
33 |
Correct |
2 ms |
2128 KB |
Output is correct |
34 |
Correct |
2 ms |
2128 KB |
Output is correct |
35 |
Correct |
1 ms |
1872 KB |
Output is correct |
36 |
Correct |
2 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
338 ms |
5212 KB |
Output is correct |
2 |
Correct |
952 ms |
15908 KB |
Output is correct |
3 |
Correct |
1141 ms |
15860 KB |
Output is correct |
4 |
Correct |
1012 ms |
19556 KB |
Output is correct |
5 |
Correct |
810 ms |
19476 KB |
Output is correct |
6 |
Correct |
1032 ms |
19476 KB |
Output is correct |
7 |
Correct |
1126 ms |
19496 KB |
Output is correct |
8 |
Correct |
945 ms |
6820 KB |
Output is correct |
9 |
Correct |
962 ms |
6804 KB |
Output is correct |
10 |
Correct |
920 ms |
6856 KB |
Output is correct |
11 |
Correct |
903 ms |
6912 KB |
Output is correct |
12 |
Correct |
59 ms |
15896 KB |
Output is correct |
13 |
Correct |
64 ms |
19488 KB |
Output is correct |
14 |
Correct |
63 ms |
19452 KB |
Output is correct |
15 |
Correct |
15 ms |
6944 KB |
Output is correct |
16 |
Correct |
16 ms |
6932 KB |
Output is correct |
17 |
Correct |
44 ms |
15220 KB |
Output is correct |
18 |
Correct |
46 ms |
15896 KB |
Output is correct |
19 |
Correct |
57 ms |
15896 KB |
Output is correct |
20 |
Correct |
60 ms |
19480 KB |
Output is correct |
21 |
Correct |
63 ms |
19472 KB |
Output is correct |
22 |
Correct |
58 ms |
19520 KB |
Output is correct |
23 |
Correct |
59 ms |
19560 KB |
Output is correct |
24 |
Correct |
16 ms |
6808 KB |
Output is correct |
25 |
Correct |
17 ms |
6864 KB |
Output is correct |
26 |
Correct |
16 ms |
6924 KB |
Output is correct |
27 |
Correct |
16 ms |
6828 KB |
Output is correct |
28 |
Correct |
2 ms |
2128 KB |
Output is correct |
29 |
Correct |
2 ms |
2128 KB |
Output is correct |
30 |
Correct |
2 ms |
2128 KB |
Output is correct |
31 |
Correct |
2 ms |
1872 KB |
Output is correct |
32 |
Correct |
2 ms |
1872 KB |
Output is correct |
33 |
Correct |
1 ms |
1872 KB |
Output is correct |
34 |
Correct |
2 ms |
2128 KB |
Output is correct |
35 |
Correct |
2 ms |
2128 KB |
Output is correct |
36 |
Correct |
2 ms |
2128 KB |
Output is correct |
37 |
Correct |
2 ms |
2128 KB |
Output is correct |
38 |
Correct |
2 ms |
2128 KB |
Output is correct |
39 |
Correct |
2 ms |
2128 KB |
Output is correct |
40 |
Correct |
1 ms |
1872 KB |
Output is correct |
41 |
Correct |
2 ms |
1872 KB |
Output is correct |
42 |
Correct |
3 ms |
1872 KB |
Output is correct |
43 |
Correct |
2 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1872 KB |
Output is correct |
2 |
Correct |
2 ms |
2128 KB |
Output is correct |
3 |
Correct |
3 ms |
2128 KB |
Output is correct |
4 |
Correct |
2 ms |
2128 KB |
Output is correct |
5 |
Correct |
2 ms |
2128 KB |
Output is correct |
6 |
Correct |
2 ms |
2168 KB |
Output is correct |
7 |
Correct |
2 ms |
2128 KB |
Output is correct |
8 |
Correct |
2 ms |
1872 KB |
Output is correct |
9 |
Correct |
2 ms |
1872 KB |
Output is correct |
10 |
Correct |
2 ms |
1872 KB |
Output is correct |
11 |
Correct |
2 ms |
1872 KB |
Output is correct |
12 |
Correct |
1 ms |
1744 KB |
Output is correct |
13 |
Correct |
2 ms |
1872 KB |
Output is correct |
14 |
Correct |
2 ms |
1872 KB |
Output is correct |
15 |
Correct |
2 ms |
2128 KB |
Output is correct |
16 |
Correct |
2 ms |
2128 KB |
Output is correct |
17 |
Correct |
2 ms |
2128 KB |
Output is correct |
18 |
Correct |
1 ms |
1872 KB |
Output is correct |
19 |
Correct |
2 ms |
1872 KB |
Output is correct |
20 |
Correct |
3 ms |
2128 KB |
Output is correct |
21 |
Correct |
2 ms |
2128 KB |
Output is correct |
22 |
Correct |
2 ms |
2128 KB |
Output is correct |
23 |
Correct |
1 ms |
1872 KB |
Output is correct |
24 |
Correct |
3 ms |
1872 KB |
Output is correct |
25 |
Correct |
2 ms |
1892 KB |
Output is correct |
26 |
Correct |
2 ms |
2128 KB |
Output is correct |
27 |
Correct |
2 ms |
2128 KB |
Output is correct |
28 |
Correct |
2 ms |
2128 KB |
Output is correct |
29 |
Correct |
2 ms |
2128 KB |
Output is correct |
30 |
Correct |
2 ms |
2128 KB |
Output is correct |
31 |
Correct |
2 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1872 KB |
Output is correct |
33 |
Correct |
2 ms |
1872 KB |
Output is correct |
34 |
Correct |
2 ms |
1872 KB |
Output is correct |
35 |
Correct |
1 ms |
1872 KB |
Output is correct |
36 |
Correct |
34 ms |
10956 KB |
Output is correct |
37 |
Correct |
48 ms |
15928 KB |
Output is correct |
38 |
Correct |
47 ms |
15908 KB |
Output is correct |
39 |
Correct |
64 ms |
19476 KB |
Output is correct |
40 |
Correct |
58 ms |
19540 KB |
Output is correct |
41 |
Correct |
61 ms |
19472 KB |
Output is correct |
42 |
Correct |
62 ms |
19520 KB |
Output is correct |
43 |
Correct |
17 ms |
6940 KB |
Output is correct |
44 |
Correct |
21 ms |
6836 KB |
Output is correct |
45 |
Correct |
17 ms |
6940 KB |
Output is correct |
46 |
Correct |
17 ms |
6828 KB |
Output is correct |
47 |
Correct |
47 ms |
15900 KB |
Output is correct |
48 |
Correct |
56 ms |
19476 KB |
Output is correct |
49 |
Correct |
59 ms |
19476 KB |
Output is correct |
50 |
Correct |
17 ms |
6808 KB |
Output is correct |
51 |
Correct |
16 ms |
6880 KB |
Output is correct |
52 |
Correct |
45 ms |
15908 KB |
Output is correct |
53 |
Correct |
66 ms |
19600 KB |
Output is correct |
54 |
Correct |
58 ms |
19480 KB |
Output is correct |
55 |
Correct |
16 ms |
6836 KB |
Output is correct |
56 |
Correct |
16 ms |
6856 KB |
Output is correct |
57 |
Correct |
48 ms |
15308 KB |
Output is correct |
58 |
Correct |
54 ms |
15880 KB |
Output is correct |
59 |
Correct |
49 ms |
15852 KB |
Output is correct |
60 |
Correct |
57 ms |
19520 KB |
Output is correct |
61 |
Correct |
62 ms |
19492 KB |
Output is correct |
62 |
Correct |
69 ms |
19448 KB |
Output is correct |
63 |
Correct |
58 ms |
19608 KB |
Output is correct |
64 |
Correct |
20 ms |
6812 KB |
Output is correct |
65 |
Correct |
25 ms |
6808 KB |
Output is correct |
66 |
Correct |
17 ms |
6936 KB |
Output is correct |
67 |
Correct |
23 ms |
6936 KB |
Output is correct |
68 |
Correct |
737 ms |
15876 KB |
Output is correct |
69 |
Correct |
1145 ms |
15896 KB |
Output is correct |
70 |
Correct |
1185 ms |
15812 KB |
Output is correct |
71 |
Correct |
998 ms |
19524 KB |
Output is correct |
72 |
Correct |
1084 ms |
19472 KB |
Output is correct |
73 |
Correct |
1082 ms |
19480 KB |
Output is correct |
74 |
Correct |
1101 ms |
19476 KB |
Output is correct |
75 |
Correct |
1029 ms |
6920 KB |
Output is correct |
76 |
Correct |
994 ms |
6816 KB |
Output is correct |
77 |
Correct |
1071 ms |
6936 KB |
Output is correct |
78 |
Correct |
901 ms |
6856 KB |
Output is correct |
79 |
Correct |
902 ms |
6864 KB |
Output is correct |
80 |
Correct |
1049 ms |
6804 KB |
Output is correct |
81 |
Correct |
1 ms |
1744 KB |
Output is correct |
82 |
Correct |
3 ms |
1872 KB |
Output is correct |
83 |
Correct |
2 ms |
1872 KB |
Output is correct |
84 |
Correct |
51 ms |
15896 KB |
Output is correct |
85 |
Correct |
61 ms |
19476 KB |
Output is correct |
86 |
Correct |
68 ms |
19484 KB |
Output is correct |
87 |
Correct |
17 ms |
6844 KB |
Output is correct |
88 |
Correct |
17 ms |
6900 KB |
Output is correct |
89 |
Correct |
45 ms |
15852 KB |
Output is correct |
90 |
Correct |
57 ms |
19564 KB |
Output is correct |
91 |
Correct |
60 ms |
19492 KB |
Output is correct |
92 |
Correct |
16 ms |
6812 KB |
Output is correct |
93 |
Correct |
17 ms |
6856 KB |
Output is correct |
94 |
Correct |
2 ms |
2128 KB |
Output is correct |
95 |
Correct |
2 ms |
2128 KB |
Output is correct |
96 |
Correct |
2 ms |
2128 KB |
Output is correct |
97 |
Correct |
1 ms |
1872 KB |
Output is correct |
98 |
Correct |
2 ms |
1872 KB |
Output is correct |
99 |
Correct |
2 ms |
2128 KB |
Output is correct |
100 |
Correct |
2 ms |
2128 KB |
Output is correct |
101 |
Correct |
2 ms |
2128 KB |
Output is correct |
102 |
Correct |
1 ms |
1872 KB |
Output is correct |
103 |
Correct |
2 ms |
1872 KB |
Output is correct |
104 |
Correct |
850 ms |
14244 KB |
Output is correct |
105 |
Correct |
1103 ms |
15928 KB |
Output is correct |
106 |
Correct |
1045 ms |
15816 KB |
Output is correct |
107 |
Correct |
998 ms |
19500 KB |
Output is correct |
108 |
Correct |
1217 ms |
19492 KB |
Output is correct |
109 |
Correct |
1189 ms |
19452 KB |
Output is correct |
110 |
Correct |
961 ms |
19508 KB |
Output is correct |
111 |
Correct |
827 ms |
6856 KB |
Output is correct |
112 |
Correct |
934 ms |
6808 KB |
Output is correct |
113 |
Correct |
1016 ms |
6828 KB |
Output is correct |
114 |
Correct |
808 ms |
6856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
435 ms |
4816 KB |
Output is correct |
2 |
Correct |
954 ms |
6828 KB |
Output is correct |
3 |
Correct |
1018 ms |
6944 KB |
Output is correct |
4 |
Correct |
1038 ms |
6812 KB |
Output is correct |
5 |
Correct |
931 ms |
6812 KB |
Output is correct |
6 |
Correct |
986 ms |
6828 KB |
Output is correct |
7 |
Correct |
992 ms |
6828 KB |
Output is correct |
8 |
Correct |
2 ms |
1744 KB |
Output is correct |
9 |
Correct |
2 ms |
1872 KB |
Output is correct |
10 |
Correct |
2 ms |
1872 KB |
Output is correct |
11 |
Correct |
2 ms |
1872 KB |
Output is correct |
12 |
Correct |
2 ms |
2128 KB |
Output is correct |
13 |
Correct |
3 ms |
2128 KB |
Output is correct |
14 |
Correct |
2 ms |
2128 KB |
Output is correct |
15 |
Correct |
2 ms |
2128 KB |
Output is correct |
16 |
Correct |
2 ms |
2168 KB |
Output is correct |
17 |
Correct |
2 ms |
2128 KB |
Output is correct |
18 |
Correct |
2 ms |
1872 KB |
Output is correct |
19 |
Correct |
2 ms |
1872 KB |
Output is correct |
20 |
Correct |
2 ms |
1872 KB |
Output is correct |
21 |
Correct |
2 ms |
1872 KB |
Output is correct |
22 |
Correct |
1 ms |
1744 KB |
Output is correct |
23 |
Correct |
2 ms |
1872 KB |
Output is correct |
24 |
Correct |
2 ms |
1872 KB |
Output is correct |
25 |
Correct |
2 ms |
2128 KB |
Output is correct |
26 |
Correct |
2 ms |
2128 KB |
Output is correct |
27 |
Correct |
2 ms |
2128 KB |
Output is correct |
28 |
Correct |
1 ms |
1872 KB |
Output is correct |
29 |
Correct |
2 ms |
1872 KB |
Output is correct |
30 |
Correct |
3 ms |
2128 KB |
Output is correct |
31 |
Correct |
2 ms |
2128 KB |
Output is correct |
32 |
Correct |
2 ms |
2128 KB |
Output is correct |
33 |
Correct |
1 ms |
1872 KB |
Output is correct |
34 |
Correct |
3 ms |
1872 KB |
Output is correct |
35 |
Correct |
2 ms |
1892 KB |
Output is correct |
36 |
Correct |
2 ms |
2128 KB |
Output is correct |
37 |
Correct |
2 ms |
2128 KB |
Output is correct |
38 |
Correct |
2 ms |
2128 KB |
Output is correct |
39 |
Correct |
2 ms |
2128 KB |
Output is correct |
40 |
Correct |
2 ms |
2128 KB |
Output is correct |
41 |
Correct |
2 ms |
2128 KB |
Output is correct |
42 |
Correct |
1 ms |
1872 KB |
Output is correct |
43 |
Correct |
2 ms |
1872 KB |
Output is correct |
44 |
Correct |
2 ms |
1872 KB |
Output is correct |
45 |
Correct |
1 ms |
1872 KB |
Output is correct |
46 |
Correct |
34 ms |
10956 KB |
Output is correct |
47 |
Correct |
48 ms |
15928 KB |
Output is correct |
48 |
Correct |
47 ms |
15908 KB |
Output is correct |
49 |
Correct |
64 ms |
19476 KB |
Output is correct |
50 |
Correct |
58 ms |
19540 KB |
Output is correct |
51 |
Correct |
61 ms |
19472 KB |
Output is correct |
52 |
Correct |
62 ms |
19520 KB |
Output is correct |
53 |
Correct |
17 ms |
6940 KB |
Output is correct |
54 |
Correct |
21 ms |
6836 KB |
Output is correct |
55 |
Correct |
17 ms |
6940 KB |
Output is correct |
56 |
Correct |
17 ms |
6828 KB |
Output is correct |
57 |
Correct |
47 ms |
15900 KB |
Output is correct |
58 |
Correct |
56 ms |
19476 KB |
Output is correct |
59 |
Correct |
59 ms |
19476 KB |
Output is correct |
60 |
Correct |
17 ms |
6808 KB |
Output is correct |
61 |
Correct |
16 ms |
6880 KB |
Output is correct |
62 |
Correct |
45 ms |
15908 KB |
Output is correct |
63 |
Correct |
66 ms |
19600 KB |
Output is correct |
64 |
Correct |
58 ms |
19480 KB |
Output is correct |
65 |
Correct |
16 ms |
6836 KB |
Output is correct |
66 |
Correct |
16 ms |
6856 KB |
Output is correct |
67 |
Correct |
48 ms |
15308 KB |
Output is correct |
68 |
Correct |
54 ms |
15880 KB |
Output is correct |
69 |
Correct |
49 ms |
15852 KB |
Output is correct |
70 |
Correct |
57 ms |
19520 KB |
Output is correct |
71 |
Correct |
62 ms |
19492 KB |
Output is correct |
72 |
Correct |
69 ms |
19448 KB |
Output is correct |
73 |
Correct |
58 ms |
19608 KB |
Output is correct |
74 |
Correct |
20 ms |
6812 KB |
Output is correct |
75 |
Correct |
25 ms |
6808 KB |
Output is correct |
76 |
Correct |
17 ms |
6936 KB |
Output is correct |
77 |
Correct |
23 ms |
6936 KB |
Output is correct |
78 |
Correct |
737 ms |
15876 KB |
Output is correct |
79 |
Correct |
1145 ms |
15896 KB |
Output is correct |
80 |
Correct |
1185 ms |
15812 KB |
Output is correct |
81 |
Correct |
998 ms |
19524 KB |
Output is correct |
82 |
Correct |
1084 ms |
19472 KB |
Output is correct |
83 |
Correct |
1082 ms |
19480 KB |
Output is correct |
84 |
Correct |
1101 ms |
19476 KB |
Output is correct |
85 |
Correct |
1029 ms |
6920 KB |
Output is correct |
86 |
Correct |
994 ms |
6816 KB |
Output is correct |
87 |
Correct |
1071 ms |
6936 KB |
Output is correct |
88 |
Correct |
901 ms |
6856 KB |
Output is correct |
89 |
Correct |
902 ms |
6864 KB |
Output is correct |
90 |
Correct |
1049 ms |
6804 KB |
Output is correct |
91 |
Correct |
1 ms |
1744 KB |
Output is correct |
92 |
Correct |
3 ms |
1872 KB |
Output is correct |
93 |
Correct |
2 ms |
1872 KB |
Output is correct |
94 |
Correct |
51 ms |
15896 KB |
Output is correct |
95 |
Correct |
61 ms |
19476 KB |
Output is correct |
96 |
Correct |
68 ms |
19484 KB |
Output is correct |
97 |
Correct |
17 ms |
6844 KB |
Output is correct |
98 |
Correct |
17 ms |
6900 KB |
Output is correct |
99 |
Correct |
45 ms |
15852 KB |
Output is correct |
100 |
Correct |
57 ms |
19564 KB |
Output is correct |
101 |
Correct |
60 ms |
19492 KB |
Output is correct |
102 |
Correct |
16 ms |
6812 KB |
Output is correct |
103 |
Correct |
17 ms |
6856 KB |
Output is correct |
104 |
Correct |
2 ms |
2128 KB |
Output is correct |
105 |
Correct |
2 ms |
2128 KB |
Output is correct |
106 |
Correct |
2 ms |
2128 KB |
Output is correct |
107 |
Correct |
1 ms |
1872 KB |
Output is correct |
108 |
Correct |
2 ms |
1872 KB |
Output is correct |
109 |
Correct |
2 ms |
2128 KB |
Output is correct |
110 |
Correct |
2 ms |
2128 KB |
Output is correct |
111 |
Correct |
2 ms |
2128 KB |
Output is correct |
112 |
Correct |
1 ms |
1872 KB |
Output is correct |
113 |
Correct |
2 ms |
1872 KB |
Output is correct |
114 |
Correct |
338 ms |
5212 KB |
Output is correct |
115 |
Correct |
952 ms |
15908 KB |
Output is correct |
116 |
Correct |
1141 ms |
15860 KB |
Output is correct |
117 |
Correct |
1012 ms |
19556 KB |
Output is correct |
118 |
Correct |
810 ms |
19476 KB |
Output is correct |
119 |
Correct |
1032 ms |
19476 KB |
Output is correct |
120 |
Correct |
1126 ms |
19496 KB |
Output is correct |
121 |
Correct |
945 ms |
6820 KB |
Output is correct |
122 |
Correct |
962 ms |
6804 KB |
Output is correct |
123 |
Correct |
920 ms |
6856 KB |
Output is correct |
124 |
Correct |
903 ms |
6912 KB |
Output is correct |
125 |
Correct |
59 ms |
15896 KB |
Output is correct |
126 |
Correct |
64 ms |
19488 KB |
Output is correct |
127 |
Correct |
63 ms |
19452 KB |
Output is correct |
128 |
Correct |
15 ms |
6944 KB |
Output is correct |
129 |
Correct |
16 ms |
6932 KB |
Output is correct |
130 |
Correct |
44 ms |
15220 KB |
Output is correct |
131 |
Correct |
46 ms |
15896 KB |
Output is correct |
132 |
Correct |
57 ms |
15896 KB |
Output is correct |
133 |
Correct |
60 ms |
19480 KB |
Output is correct |
134 |
Correct |
63 ms |
19472 KB |
Output is correct |
135 |
Correct |
58 ms |
19520 KB |
Output is correct |
136 |
Correct |
59 ms |
19560 KB |
Output is correct |
137 |
Correct |
16 ms |
6808 KB |
Output is correct |
138 |
Correct |
17 ms |
6864 KB |
Output is correct |
139 |
Correct |
16 ms |
6924 KB |
Output is correct |
140 |
Correct |
16 ms |
6828 KB |
Output is correct |
141 |
Correct |
2 ms |
2128 KB |
Output is correct |
142 |
Correct |
2 ms |
2128 KB |
Output is correct |
143 |
Correct |
2 ms |
2128 KB |
Output is correct |
144 |
Correct |
2 ms |
1872 KB |
Output is correct |
145 |
Correct |
2 ms |
1872 KB |
Output is correct |
146 |
Correct |
1 ms |
1872 KB |
Output is correct |
147 |
Correct |
2 ms |
2128 KB |
Output is correct |
148 |
Correct |
2 ms |
2128 KB |
Output is correct |
149 |
Correct |
2 ms |
2128 KB |
Output is correct |
150 |
Correct |
2 ms |
2128 KB |
Output is correct |
151 |
Correct |
2 ms |
2128 KB |
Output is correct |
152 |
Correct |
2 ms |
2128 KB |
Output is correct |
153 |
Correct |
1 ms |
1872 KB |
Output is correct |
154 |
Correct |
2 ms |
1872 KB |
Output is correct |
155 |
Correct |
3 ms |
1872 KB |
Output is correct |
156 |
Correct |
2 ms |
1872 KB |
Output is correct |
157 |
Correct |
850 ms |
14244 KB |
Output is correct |
158 |
Correct |
1103 ms |
15928 KB |
Output is correct |
159 |
Correct |
1045 ms |
15816 KB |
Output is correct |
160 |
Correct |
998 ms |
19500 KB |
Output is correct |
161 |
Correct |
1217 ms |
19492 KB |
Output is correct |
162 |
Correct |
1189 ms |
19452 KB |
Output is correct |
163 |
Correct |
961 ms |
19508 KB |
Output is correct |
164 |
Correct |
827 ms |
6856 KB |
Output is correct |
165 |
Correct |
934 ms |
6808 KB |
Output is correct |
166 |
Correct |
1016 ms |
6828 KB |
Output is correct |
167 |
Correct |
808 ms |
6856 KB |
Output is correct |
168 |
Correct |
1 ms |
1744 KB |
Output is correct |
169 |
Correct |
759 ms |
6736 KB |
Output is correct |
170 |
Correct |
1274 ms |
15896 KB |
Output is correct |
171 |
Correct |
1224 ms |
15816 KB |
Output is correct |
172 |
Correct |
1221 ms |
19472 KB |
Output is correct |
173 |
Correct |
1183 ms |
19520 KB |
Output is correct |
174 |
Correct |
1192 ms |
19488 KB |
Output is correct |
175 |
Correct |
1045 ms |
19476 KB |
Output is correct |
176 |
Correct |
964 ms |
6856 KB |
Output is correct |
177 |
Correct |
965 ms |
6856 KB |
Output is correct |
178 |
Correct |
1027 ms |
6932 KB |
Output is correct |
179 |
Correct |
987 ms |
6864 KB |
Output is correct |