답안 #633550

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633550 2022-08-22T17:38:18 Z JeanBombeur 송신탑 (IOI22_towers) C++17
100 / 100
1366 ms 31384 KB
#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;

vector <node_persistent> Tree;

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) {
    b = Tree.size();
    Tree.push_back(Tree[a]);
    return Tree.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;
    Tree.resize(2 * SIZE, {-1, -1, 0});
    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 380 ms 9504 KB Output is correct
2 Correct 1197 ms 11432 KB Output is correct
3 Correct 1212 ms 11424 KB Output is correct
4 Correct 1220 ms 11424 KB Output is correct
5 Correct 1366 ms 11440 KB Output is correct
6 Correct 1031 ms 11416 KB Output is correct
7 Correct 1112 ms 11444 KB Output is correct
8 Correct 3 ms 6352 KB Output is correct
9 Correct 4 ms 6480 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6480 KB Output is correct
2 Correct 4 ms 6480 KB Output is correct
3 Correct 4 ms 6480 KB Output is correct
4 Correct 4 ms 6480 KB Output is correct
5 Correct 4 ms 6576 KB Output is correct
6 Correct 4 ms 6480 KB Output is correct
7 Correct 4 ms 6480 KB Output is correct
8 Correct 3 ms 6480 KB Output is correct
9 Correct 4 ms 6480 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
11 Correct 3 ms 6480 KB Output is correct
12 Correct 4 ms 6480 KB Output is correct
13 Correct 3 ms 6480 KB Output is correct
14 Correct 4 ms 6568 KB Output is correct
15 Correct 6 ms 6480 KB Output is correct
16 Correct 4 ms 6480 KB Output is correct
17 Correct 5 ms 6480 KB Output is correct
18 Correct 3 ms 6480 KB Output is correct
19 Correct 3 ms 6480 KB Output is correct
20 Correct 4 ms 6480 KB Output is correct
21 Correct 4 ms 6480 KB Output is correct
22 Correct 4 ms 6480 KB Output is correct
23 Correct 4 ms 6480 KB Output is correct
24 Correct 3 ms 6480 KB Output is correct
25 Correct 3 ms 6480 KB Output is correct
26 Correct 4 ms 6480 KB Output is correct
27 Correct 4 ms 6480 KB Output is correct
28 Correct 4 ms 6540 KB Output is correct
29 Correct 4 ms 6480 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 4 ms 6524 KB Output is correct
32 Correct 3 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 3 ms 6520 KB Output is correct
35 Correct 5 ms 6480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6480 KB Output is correct
2 Correct 4 ms 6480 KB Output is correct
3 Correct 4 ms 6480 KB Output is correct
4 Correct 4 ms 6480 KB Output is correct
5 Correct 4 ms 6576 KB Output is correct
6 Correct 4 ms 6480 KB Output is correct
7 Correct 4 ms 6480 KB Output is correct
8 Correct 3 ms 6480 KB Output is correct
9 Correct 4 ms 6480 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
11 Correct 3 ms 6480 KB Output is correct
12 Correct 4 ms 6480 KB Output is correct
13 Correct 3 ms 6480 KB Output is correct
14 Correct 4 ms 6568 KB Output is correct
15 Correct 6 ms 6480 KB Output is correct
16 Correct 4 ms 6480 KB Output is correct
17 Correct 5 ms 6480 KB Output is correct
18 Correct 3 ms 6480 KB Output is correct
19 Correct 3 ms 6480 KB Output is correct
20 Correct 4 ms 6480 KB Output is correct
21 Correct 4 ms 6480 KB Output is correct
22 Correct 4 ms 6480 KB Output is correct
23 Correct 4 ms 6480 KB Output is correct
24 Correct 3 ms 6480 KB Output is correct
25 Correct 3 ms 6480 KB Output is correct
26 Correct 4 ms 6480 KB Output is correct
27 Correct 4 ms 6480 KB Output is correct
28 Correct 4 ms 6540 KB Output is correct
29 Correct 4 ms 6480 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 4 ms 6524 KB Output is correct
32 Correct 3 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 3 ms 6520 KB Output is correct
35 Correct 5 ms 6480 KB Output is correct
36 Correct 44 ms 16260 KB Output is correct
37 Correct 56 ms 18172 KB Output is correct
38 Correct 51 ms 18120 KB Output is correct
39 Correct 67 ms 31232 KB Output is correct
40 Correct 75 ms 31256 KB Output is correct
41 Correct 74 ms 31228 KB Output is correct
42 Correct 92 ms 31220 KB Output is correct
43 Correct 20 ms 11540 KB Output is correct
44 Correct 18 ms 11464 KB Output is correct
45 Correct 25 ms 11472 KB Output is correct
46 Correct 19 ms 11556 KB Output is correct
47 Correct 53 ms 18188 KB Output is correct
48 Correct 86 ms 31216 KB Output is correct
49 Correct 74 ms 31200 KB Output is correct
50 Correct 19 ms 11520 KB Output is correct
51 Correct 19 ms 11472 KB Output is correct
52 Correct 52 ms 18188 KB Output is correct
53 Correct 73 ms 31152 KB Output is correct
54 Correct 75 ms 31264 KB Output is correct
55 Correct 19 ms 11456 KB Output is correct
56 Correct 18 ms 11476 KB Output is correct
57 Correct 49 ms 17936 KB Output is correct
58 Correct 50 ms 18180 KB Output is correct
59 Correct 52 ms 18176 KB Output is correct
60 Correct 70 ms 31172 KB Output is correct
61 Correct 68 ms 31168 KB Output is correct
62 Correct 81 ms 31216 KB Output is correct
63 Correct 74 ms 31228 KB Output is correct
64 Correct 18 ms 11452 KB Output is correct
65 Correct 26 ms 11420 KB Output is correct
66 Correct 23 ms 11464 KB Output is correct
67 Correct 18 ms 11520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 784 ms 18160 KB Output is correct
2 Correct 1006 ms 18196 KB Output is correct
3 Correct 979 ms 18184 KB Output is correct
4 Correct 1072 ms 31216 KB Output is correct
5 Correct 1014 ms 31236 KB Output is correct
6 Correct 1006 ms 31264 KB Output is correct
7 Correct 1034 ms 31384 KB Output is correct
8 Correct 957 ms 11420 KB Output is correct
9 Correct 983 ms 11464 KB Output is correct
10 Correct 1167 ms 11432 KB Output is correct
11 Correct 1115 ms 11464 KB Output is correct
12 Correct 1030 ms 11472 KB Output is correct
13 Correct 1108 ms 11420 KB Output is correct
14 Correct 3 ms 6480 KB Output is correct
15 Correct 4 ms 6480 KB Output is correct
16 Correct 3 ms 6480 KB Output is correct
17 Correct 53 ms 18180 KB Output is correct
18 Correct 73 ms 31248 KB Output is correct
19 Correct 74 ms 31236 KB Output is correct
20 Correct 19 ms 11416 KB Output is correct
21 Correct 20 ms 11420 KB Output is correct
22 Correct 52 ms 18116 KB Output is correct
23 Correct 68 ms 31236 KB Output is correct
24 Correct 71 ms 31264 KB Output is correct
25 Correct 20 ms 11464 KB Output is correct
26 Correct 26 ms 11436 KB Output is correct
27 Correct 4 ms 6480 KB Output is correct
28 Correct 4 ms 6480 KB Output is correct
29 Correct 5 ms 6520 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 4 ms 6480 KB Output is correct
32 Correct 4 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 5 ms 6480 KB Output is correct
35 Correct 3 ms 6480 KB Output is correct
36 Correct 4 ms 6480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 7744 KB Output is correct
2 Correct 1083 ms 18196 KB Output is correct
3 Correct 1117 ms 18176 KB Output is correct
4 Correct 1137 ms 31152 KB Output is correct
5 Correct 1131 ms 31248 KB Output is correct
6 Correct 1095 ms 31148 KB Output is correct
7 Correct 1094 ms 31212 KB Output is correct
8 Correct 1055 ms 11420 KB Output is correct
9 Correct 905 ms 11420 KB Output is correct
10 Correct 997 ms 11532 KB Output is correct
11 Correct 1014 ms 11464 KB Output is correct
12 Correct 51 ms 18180 KB Output is correct
13 Correct 75 ms 31176 KB Output is correct
14 Correct 77 ms 31176 KB Output is correct
15 Correct 19 ms 11464 KB Output is correct
16 Correct 20 ms 11424 KB Output is correct
17 Correct 48 ms 17988 KB Output is correct
18 Correct 52 ms 18116 KB Output is correct
19 Correct 54 ms 18196 KB Output is correct
20 Correct 66 ms 31256 KB Output is correct
21 Correct 67 ms 31228 KB Output is correct
22 Correct 75 ms 31260 KB Output is correct
23 Correct 74 ms 31260 KB Output is correct
24 Correct 18 ms 11444 KB Output is correct
25 Correct 18 ms 11464 KB Output is correct
26 Correct 18 ms 11536 KB Output is correct
27 Correct 19 ms 11444 KB Output is correct
28 Correct 5 ms 6480 KB Output is correct
29 Correct 5 ms 6480 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 3 ms 6480 KB Output is correct
32 Correct 4 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 3 ms 6480 KB Output is correct
35 Correct 4 ms 6480 KB Output is correct
36 Correct 4 ms 6480 KB Output is correct
37 Correct 4 ms 6480 KB Output is correct
38 Correct 4 ms 6480 KB Output is correct
39 Correct 4 ms 6480 KB Output is correct
40 Correct 3 ms 6480 KB Output is correct
41 Correct 3 ms 6480 KB Output is correct
42 Correct 3 ms 6480 KB Output is correct
43 Correct 3 ms 6516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6480 KB Output is correct
2 Correct 4 ms 6480 KB Output is correct
3 Correct 4 ms 6480 KB Output is correct
4 Correct 4 ms 6480 KB Output is correct
5 Correct 4 ms 6576 KB Output is correct
6 Correct 4 ms 6480 KB Output is correct
7 Correct 4 ms 6480 KB Output is correct
8 Correct 3 ms 6480 KB Output is correct
9 Correct 4 ms 6480 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
11 Correct 3 ms 6480 KB Output is correct
12 Correct 4 ms 6480 KB Output is correct
13 Correct 3 ms 6480 KB Output is correct
14 Correct 4 ms 6568 KB Output is correct
15 Correct 6 ms 6480 KB Output is correct
16 Correct 4 ms 6480 KB Output is correct
17 Correct 5 ms 6480 KB Output is correct
18 Correct 3 ms 6480 KB Output is correct
19 Correct 3 ms 6480 KB Output is correct
20 Correct 4 ms 6480 KB Output is correct
21 Correct 4 ms 6480 KB Output is correct
22 Correct 4 ms 6480 KB Output is correct
23 Correct 4 ms 6480 KB Output is correct
24 Correct 3 ms 6480 KB Output is correct
25 Correct 3 ms 6480 KB Output is correct
26 Correct 4 ms 6480 KB Output is correct
27 Correct 4 ms 6480 KB Output is correct
28 Correct 4 ms 6540 KB Output is correct
29 Correct 4 ms 6480 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 4 ms 6524 KB Output is correct
32 Correct 3 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 3 ms 6520 KB Output is correct
35 Correct 5 ms 6480 KB Output is correct
36 Correct 44 ms 16260 KB Output is correct
37 Correct 56 ms 18172 KB Output is correct
38 Correct 51 ms 18120 KB Output is correct
39 Correct 67 ms 31232 KB Output is correct
40 Correct 75 ms 31256 KB Output is correct
41 Correct 74 ms 31228 KB Output is correct
42 Correct 92 ms 31220 KB Output is correct
43 Correct 20 ms 11540 KB Output is correct
44 Correct 18 ms 11464 KB Output is correct
45 Correct 25 ms 11472 KB Output is correct
46 Correct 19 ms 11556 KB Output is correct
47 Correct 53 ms 18188 KB Output is correct
48 Correct 86 ms 31216 KB Output is correct
49 Correct 74 ms 31200 KB Output is correct
50 Correct 19 ms 11520 KB Output is correct
51 Correct 19 ms 11472 KB Output is correct
52 Correct 52 ms 18188 KB Output is correct
53 Correct 73 ms 31152 KB Output is correct
54 Correct 75 ms 31264 KB Output is correct
55 Correct 19 ms 11456 KB Output is correct
56 Correct 18 ms 11476 KB Output is correct
57 Correct 49 ms 17936 KB Output is correct
58 Correct 50 ms 18180 KB Output is correct
59 Correct 52 ms 18176 KB Output is correct
60 Correct 70 ms 31172 KB Output is correct
61 Correct 68 ms 31168 KB Output is correct
62 Correct 81 ms 31216 KB Output is correct
63 Correct 74 ms 31228 KB Output is correct
64 Correct 18 ms 11452 KB Output is correct
65 Correct 26 ms 11420 KB Output is correct
66 Correct 23 ms 11464 KB Output is correct
67 Correct 18 ms 11520 KB Output is correct
68 Correct 784 ms 18160 KB Output is correct
69 Correct 1006 ms 18196 KB Output is correct
70 Correct 979 ms 18184 KB Output is correct
71 Correct 1072 ms 31216 KB Output is correct
72 Correct 1014 ms 31236 KB Output is correct
73 Correct 1006 ms 31264 KB Output is correct
74 Correct 1034 ms 31384 KB Output is correct
75 Correct 957 ms 11420 KB Output is correct
76 Correct 983 ms 11464 KB Output is correct
77 Correct 1167 ms 11432 KB Output is correct
78 Correct 1115 ms 11464 KB Output is correct
79 Correct 1030 ms 11472 KB Output is correct
80 Correct 1108 ms 11420 KB Output is correct
81 Correct 3 ms 6480 KB Output is correct
82 Correct 4 ms 6480 KB Output is correct
83 Correct 3 ms 6480 KB Output is correct
84 Correct 53 ms 18180 KB Output is correct
85 Correct 73 ms 31248 KB Output is correct
86 Correct 74 ms 31236 KB Output is correct
87 Correct 19 ms 11416 KB Output is correct
88 Correct 20 ms 11420 KB Output is correct
89 Correct 52 ms 18116 KB Output is correct
90 Correct 68 ms 31236 KB Output is correct
91 Correct 71 ms 31264 KB Output is correct
92 Correct 20 ms 11464 KB Output is correct
93 Correct 26 ms 11436 KB Output is correct
94 Correct 4 ms 6480 KB Output is correct
95 Correct 4 ms 6480 KB Output is correct
96 Correct 5 ms 6520 KB Output is correct
97 Correct 4 ms 6480 KB Output is correct
98 Correct 4 ms 6480 KB Output is correct
99 Correct 4 ms 6480 KB Output is correct
100 Correct 4 ms 6480 KB Output is correct
101 Correct 5 ms 6480 KB Output is correct
102 Correct 3 ms 6480 KB Output is correct
103 Correct 4 ms 6480 KB Output is correct
104 Correct 965 ms 17528 KB Output is correct
105 Correct 1193 ms 18120 KB Output is correct
106 Correct 1057 ms 18200 KB Output is correct
107 Correct 1085 ms 31224 KB Output is correct
108 Correct 995 ms 31168 KB Output is correct
109 Correct 1104 ms 31252 KB Output is correct
110 Correct 1049 ms 31228 KB Output is correct
111 Correct 1029 ms 11440 KB Output is correct
112 Correct 1175 ms 11472 KB Output is correct
113 Correct 1283 ms 11464 KB Output is correct
114 Correct 1076 ms 11424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 380 ms 9504 KB Output is correct
2 Correct 1197 ms 11432 KB Output is correct
3 Correct 1212 ms 11424 KB Output is correct
4 Correct 1220 ms 11424 KB Output is correct
5 Correct 1366 ms 11440 KB Output is correct
6 Correct 1031 ms 11416 KB Output is correct
7 Correct 1112 ms 11444 KB Output is correct
8 Correct 3 ms 6352 KB Output is correct
9 Correct 4 ms 6480 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
11 Correct 4 ms 6480 KB Output is correct
12 Correct 4 ms 6480 KB Output is correct
13 Correct 4 ms 6480 KB Output is correct
14 Correct 4 ms 6480 KB Output is correct
15 Correct 4 ms 6576 KB Output is correct
16 Correct 4 ms 6480 KB Output is correct
17 Correct 4 ms 6480 KB Output is correct
18 Correct 3 ms 6480 KB Output is correct
19 Correct 4 ms 6480 KB Output is correct
20 Correct 4 ms 6480 KB Output is correct
21 Correct 3 ms 6480 KB Output is correct
22 Correct 4 ms 6480 KB Output is correct
23 Correct 3 ms 6480 KB Output is correct
24 Correct 4 ms 6568 KB Output is correct
25 Correct 6 ms 6480 KB Output is correct
26 Correct 4 ms 6480 KB Output is correct
27 Correct 5 ms 6480 KB Output is correct
28 Correct 3 ms 6480 KB Output is correct
29 Correct 3 ms 6480 KB Output is correct
30 Correct 4 ms 6480 KB Output is correct
31 Correct 4 ms 6480 KB Output is correct
32 Correct 4 ms 6480 KB Output is correct
33 Correct 4 ms 6480 KB Output is correct
34 Correct 3 ms 6480 KB Output is correct
35 Correct 3 ms 6480 KB Output is correct
36 Correct 4 ms 6480 KB Output is correct
37 Correct 4 ms 6480 KB Output is correct
38 Correct 4 ms 6540 KB Output is correct
39 Correct 4 ms 6480 KB Output is correct
40 Correct 4 ms 6480 KB Output is correct
41 Correct 4 ms 6524 KB Output is correct
42 Correct 3 ms 6480 KB Output is correct
43 Correct 4 ms 6480 KB Output is correct
44 Correct 3 ms 6520 KB Output is correct
45 Correct 5 ms 6480 KB Output is correct
46 Correct 44 ms 16260 KB Output is correct
47 Correct 56 ms 18172 KB Output is correct
48 Correct 51 ms 18120 KB Output is correct
49 Correct 67 ms 31232 KB Output is correct
50 Correct 75 ms 31256 KB Output is correct
51 Correct 74 ms 31228 KB Output is correct
52 Correct 92 ms 31220 KB Output is correct
53 Correct 20 ms 11540 KB Output is correct
54 Correct 18 ms 11464 KB Output is correct
55 Correct 25 ms 11472 KB Output is correct
56 Correct 19 ms 11556 KB Output is correct
57 Correct 53 ms 18188 KB Output is correct
58 Correct 86 ms 31216 KB Output is correct
59 Correct 74 ms 31200 KB Output is correct
60 Correct 19 ms 11520 KB Output is correct
61 Correct 19 ms 11472 KB Output is correct
62 Correct 52 ms 18188 KB Output is correct
63 Correct 73 ms 31152 KB Output is correct
64 Correct 75 ms 31264 KB Output is correct
65 Correct 19 ms 11456 KB Output is correct
66 Correct 18 ms 11476 KB Output is correct
67 Correct 49 ms 17936 KB Output is correct
68 Correct 50 ms 18180 KB Output is correct
69 Correct 52 ms 18176 KB Output is correct
70 Correct 70 ms 31172 KB Output is correct
71 Correct 68 ms 31168 KB Output is correct
72 Correct 81 ms 31216 KB Output is correct
73 Correct 74 ms 31228 KB Output is correct
74 Correct 18 ms 11452 KB Output is correct
75 Correct 26 ms 11420 KB Output is correct
76 Correct 23 ms 11464 KB Output is correct
77 Correct 18 ms 11520 KB Output is correct
78 Correct 784 ms 18160 KB Output is correct
79 Correct 1006 ms 18196 KB Output is correct
80 Correct 979 ms 18184 KB Output is correct
81 Correct 1072 ms 31216 KB Output is correct
82 Correct 1014 ms 31236 KB Output is correct
83 Correct 1006 ms 31264 KB Output is correct
84 Correct 1034 ms 31384 KB Output is correct
85 Correct 957 ms 11420 KB Output is correct
86 Correct 983 ms 11464 KB Output is correct
87 Correct 1167 ms 11432 KB Output is correct
88 Correct 1115 ms 11464 KB Output is correct
89 Correct 1030 ms 11472 KB Output is correct
90 Correct 1108 ms 11420 KB Output is correct
91 Correct 3 ms 6480 KB Output is correct
92 Correct 4 ms 6480 KB Output is correct
93 Correct 3 ms 6480 KB Output is correct
94 Correct 53 ms 18180 KB Output is correct
95 Correct 73 ms 31248 KB Output is correct
96 Correct 74 ms 31236 KB Output is correct
97 Correct 19 ms 11416 KB Output is correct
98 Correct 20 ms 11420 KB Output is correct
99 Correct 52 ms 18116 KB Output is correct
100 Correct 68 ms 31236 KB Output is correct
101 Correct 71 ms 31264 KB Output is correct
102 Correct 20 ms 11464 KB Output is correct
103 Correct 26 ms 11436 KB Output is correct
104 Correct 4 ms 6480 KB Output is correct
105 Correct 4 ms 6480 KB Output is correct
106 Correct 5 ms 6520 KB Output is correct
107 Correct 4 ms 6480 KB Output is correct
108 Correct 4 ms 6480 KB Output is correct
109 Correct 4 ms 6480 KB Output is correct
110 Correct 4 ms 6480 KB Output is correct
111 Correct 5 ms 6480 KB Output is correct
112 Correct 3 ms 6480 KB Output is correct
113 Correct 4 ms 6480 KB Output is correct
114 Correct 291 ms 7744 KB Output is correct
115 Correct 1083 ms 18196 KB Output is correct
116 Correct 1117 ms 18176 KB Output is correct
117 Correct 1137 ms 31152 KB Output is correct
118 Correct 1131 ms 31248 KB Output is correct
119 Correct 1095 ms 31148 KB Output is correct
120 Correct 1094 ms 31212 KB Output is correct
121 Correct 1055 ms 11420 KB Output is correct
122 Correct 905 ms 11420 KB Output is correct
123 Correct 997 ms 11532 KB Output is correct
124 Correct 1014 ms 11464 KB Output is correct
125 Correct 51 ms 18180 KB Output is correct
126 Correct 75 ms 31176 KB Output is correct
127 Correct 77 ms 31176 KB Output is correct
128 Correct 19 ms 11464 KB Output is correct
129 Correct 20 ms 11424 KB Output is correct
130 Correct 48 ms 17988 KB Output is correct
131 Correct 52 ms 18116 KB Output is correct
132 Correct 54 ms 18196 KB Output is correct
133 Correct 66 ms 31256 KB Output is correct
134 Correct 67 ms 31228 KB Output is correct
135 Correct 75 ms 31260 KB Output is correct
136 Correct 74 ms 31260 KB Output is correct
137 Correct 18 ms 11444 KB Output is correct
138 Correct 18 ms 11464 KB Output is correct
139 Correct 18 ms 11536 KB Output is correct
140 Correct 19 ms 11444 KB Output is correct
141 Correct 5 ms 6480 KB Output is correct
142 Correct 5 ms 6480 KB Output is correct
143 Correct 4 ms 6480 KB Output is correct
144 Correct 3 ms 6480 KB Output is correct
145 Correct 4 ms 6480 KB Output is correct
146 Correct 4 ms 6480 KB Output is correct
147 Correct 3 ms 6480 KB Output is correct
148 Correct 4 ms 6480 KB Output is correct
149 Correct 4 ms 6480 KB Output is correct
150 Correct 4 ms 6480 KB Output is correct
151 Correct 4 ms 6480 KB Output is correct
152 Correct 4 ms 6480 KB Output is correct
153 Correct 3 ms 6480 KB Output is correct
154 Correct 3 ms 6480 KB Output is correct
155 Correct 3 ms 6480 KB Output is correct
156 Correct 3 ms 6516 KB Output is correct
157 Correct 965 ms 17528 KB Output is correct
158 Correct 1193 ms 18120 KB Output is correct
159 Correct 1057 ms 18200 KB Output is correct
160 Correct 1085 ms 31224 KB Output is correct
161 Correct 995 ms 31168 KB Output is correct
162 Correct 1104 ms 31252 KB Output is correct
163 Correct 1049 ms 31228 KB Output is correct
164 Correct 1029 ms 11440 KB Output is correct
165 Correct 1175 ms 11472 KB Output is correct
166 Correct 1283 ms 11464 KB Output is correct
167 Correct 1076 ms 11424 KB Output is correct
168 Correct 3 ms 6480 KB Output is correct
169 Correct 651 ms 8312 KB Output is correct
170 Correct 1213 ms 18188 KB Output is correct
171 Correct 1189 ms 18116 KB Output is correct
172 Correct 1279 ms 31248 KB Output is correct
173 Correct 1077 ms 31228 KB Output is correct
174 Correct 1242 ms 31268 KB Output is correct
175 Correct 1301 ms 31292 KB Output is correct
176 Correct 1138 ms 11420 KB Output is correct
177 Correct 1112 ms 11560 KB Output is correct
178 Correct 935 ms 11464 KB Output is correct
179 Correct 1140 ms 11468 KB Output is correct