Submission #705612

# Submission time Handle Problem Language Result Execution time Memory
705612 2023-03-04T19:28:58 Z danikoynov Radio Towers (IOI22_towers) C++17
58 / 100
4000 ms 16268 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;

int n, h[maxn], pref[maxn], peak_pos;
int cnt = 0;


int par[maxn], rnk[maxn];

int find_leader(int v)
{
    return (v == par[v]) ? v : par[v] = find_leader(par[v]);
}

void unite(int v, int u)
{
    v = find_leader(v);
    u = find_leader(u);
    if (v == u)
        return;

    if (rnk[v] < rnk[u])
        swap(v, u);
    rnk[v] += rnk[u];
    par[u] = v;
}

int dp[maxn], bef[maxn], aft[maxn];

int tree[4 * maxn];

void build_tree(int root, int left, int right)
{
    if (left == right)
    {
        tree[root] = h[left];
        return;
    }

    int mid = (left + right) / 2;
    build_tree(root * 2, left, mid);
    build_tree(root * 2 + 1, mid + 1, right);

    tree[root] = max(tree[root * 2], tree[root * 2 + 1]);
}
void update(int root, int left, int right, int pos, int val)
{
    if (left == right)
    {
        tree[root] = val;
        return;
    }

    int mid = (left + right) / 2;
    if (pos <= mid)
        update(root * 2, left, mid, pos, val);
    else
        update(root * 2 + 1, mid + 1, right, pos, val);

    tree[root] = max(tree[root * 2], tree[root * 2 + 1]);
}

int query(int root, int left, int right, int qleft, int qright)
{
    if (left > qright || right < qleft)
        return 0;

    if (left >= qleft && right <= qright)
        return tree[root];

    int mid = (left + right) / 2;
    return max(query(root * 2, left, mid, qleft, qright),
               query(root * 2 + 1, mid + 1, right, qleft, qright));
}

vector < int > val;
void init(int N, std::vector<int> H)
{
    n = N;
    for (int i = 0; i < n; i ++)
        h[i + 1] = H[i];

        for (int i = 1; i <= n; i ++)
                    if (h[i] > h[i - 1] && h[i] > h[i + 1])
                    cnt ++;
    for (int i = 2; i < n; i ++)
    {
        pref[i] = pref[i - 1];
        if (h[i] > h[i - 1] && h[i] > h[i + 1])
        {
            pref[i] ++, peak_pos = i;

        }
    }

    build_tree(1, 1, n);
    vector < int > st;
    st.push_back(0);
    for (int i = 1; i <= n; i ++)
    {


        while(!st.empty() && h[st.back()] >= h[i])
            st.pop_back();
             bef[i] = st.back();
        st.push_back(i);
    }

    st.clear();
    st.push_back(n + 1);
    for (int i = n; i > 0; i --)
    {


        while(!st.empty() && h[st.back()] >= h[i])
            st.pop_back();
            aft[i] = st.back();
        st.push_back(i);
    }

    for (int i = 1; i <= n; i ++)
    {

    ///cout << bef[i] << " " << aft[i] << endl;
    int h1 = 0, h2 = 0;
    if (bef[i] != i - 1)
        h1 = query(1, 1, n, bef[i] + 1, i - 1);
    if (bef[i] == 0)
        h1 = 2e9 + 10;
    if (aft[i] != i + 1)
        h2 = query(1, 1, n, i + 1, aft[i] - 1);
    if (aft[i] == n + 1)
        h2 = 2e9 + 10;
        val.push_back(min(h1, h2) - h[i]);
        ///cout << query(1, 1, n, bef[i] + 1)
    }

    sort(val.begin(), val.end());
    //for (int v : val)
    //    cout << v << " ";
   // cout << endl;
}


vector < int > act[maxn];
int max_towers(int L, int R, int D)
{

    L ++;
    R ++;
    if (L == 1 && R == n)
    {
        int ans = val.size();
        int lf = 0, rf = (int)(val.size()) - 1;
        while(lf <= rf)
        {
            int mf = (lf + rf) / 2;
            if (val[mf] < D)
                lf = mf + 1;
            else
                rf = mf - 1;
        }
        return ans - lf;
    }

    if (cnt == 1)
    {
        if (peak_pos <= L || peak_pos >= R)
            return 1;
        if (h[L] <= h[peak_pos] - D && h[R] <= h[peak_pos] - D)
            return 2;
        return 1;
    }
    if (D == 1)
    {
        int peaks = max(0, pref[R - 1] - pref[L]);
        return peaks + 1;
    }
    for (int i = 0; i < n; i ++)
        act[i].clear();
    for (int i = 0; i < 4 * n; i ++)
        tree[i] = 0;
    h[0] = h[n + 1] = 2e9;
    vector < int > st;
    st.push_back(0);
    for (int i = 1; i <= n; i ++)
    {
        int lf = 0, rf = st.size() - 1;
        while(lf <= rf)
        {
            int mf = (lf + rf) / 2;
            if (h[st[mf]] - D >= h[i])
                lf = mf + 1;
            else
                rf = mf - 1;
        }
        bef[i] = st[rf];

        while(!st.empty() && h[st.back()] <= h[i])
            st.pop_back();
        st.push_back(i);
    }

    st.clear();
    st.push_back(n + 1);
    for (int i = n; i > 0; i --)
    {
        int lf = 0, rf = st.size() - 1;
        while(lf <= rf)
        {
            int mf = (lf + rf) / 2;
            if (h[st[mf]] - D >= h[i])
                lf = mf + 1;
            else
                rf = mf - 1;
        }

        aft[i] = st[rf];

        while(!st.empty() && h[st.back()] <= h[i])
            st.pop_back();
        st.push_back(i);
    }

    int ans = 0;
    for (int i = L; i <= R; i ++)
    {
        for (int pos : act[i])
        {
            update(1, 0, n - 1, pos, dp[pos]);
        }
        act[i].clear();

        dp[i] = 1;
        int left = L, right = bef[i];
        if (left <= right)
        {
            int x = query(1, 0, n - 1, left, right) + 1;
            dp[i] = x;
        }

        act[aft[i]].push_back(i);

        ans = max(ans, dp[i]);
    }

    return ans;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:83:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   83 |     for (int i = 0; i < n; i ++)
      |     ^~~
towers.cpp:86:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   86 |         for (int i = 1; i <= n; i ++)
      |         ^~~
towers.cpp:118:9: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
  118 |         while(!st.empty() && h[st.back()] >= h[i])
      |         ^~~~~
towers.cpp:120:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
  120 |             aft[i] = st.back();
      |             ^~~
towers.cpp:135:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  135 |     if (aft[i] == n + 1)
      |     ^~
towers.cpp:137:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  137 |         val.push_back(min(h1, h2) - h[i]);
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 268 ms 5072 KB Output is correct
2 Correct 666 ms 7096 KB Output is correct
3 Correct 851 ms 7132 KB Output is correct
4 Correct 755 ms 7112 KB Output is correct
5 Correct 798 ms 7172 KB Output is correct
6 Correct 819 ms 7116 KB Output is correct
7 Correct 666 ms 7120 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 2 ms 2640 KB Output is correct
10 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 2 ms 2768 KB Output is correct
3 Correct 2 ms 2768 KB Output is correct
4 Correct 2 ms 2768 KB Output is correct
5 Correct 3 ms 2768 KB Output is correct
6 Correct 3 ms 2768 KB Output is correct
7 Correct 2 ms 2768 KB Output is correct
8 Correct 2 ms 2640 KB Output is correct
9 Correct 2 ms 2640 KB Output is correct
10 Correct 2 ms 2768 KB Output is correct
11 Correct 2 ms 2768 KB Output is correct
12 Correct 2 ms 2640 KB Output is correct
13 Correct 2 ms 2640 KB Output is correct
14 Correct 2 ms 2640 KB Output is correct
15 Correct 3 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 3 ms 2640 KB Output is correct
18 Correct 3 ms 2784 KB Output is correct
19 Correct 2 ms 2640 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2660 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 2 ms 2640 KB Output is correct
26 Correct 2 ms 2640 KB Output is correct
27 Correct 2 ms 2640 KB Output is correct
28 Correct 2 ms 2640 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 3 ms 2640 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 3 ms 2640 KB Output is correct
34 Correct 2 ms 2640 KB Output is correct
35 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 2 ms 2768 KB Output is correct
3 Correct 2 ms 2768 KB Output is correct
4 Correct 2 ms 2768 KB Output is correct
5 Correct 3 ms 2768 KB Output is correct
6 Correct 3 ms 2768 KB Output is correct
7 Correct 2 ms 2768 KB Output is correct
8 Correct 2 ms 2640 KB Output is correct
9 Correct 2 ms 2640 KB Output is correct
10 Correct 2 ms 2768 KB Output is correct
11 Correct 2 ms 2768 KB Output is correct
12 Correct 2 ms 2640 KB Output is correct
13 Correct 2 ms 2640 KB Output is correct
14 Correct 2 ms 2640 KB Output is correct
15 Correct 3 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 3 ms 2640 KB Output is correct
18 Correct 3 ms 2784 KB Output is correct
19 Correct 2 ms 2640 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2660 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 2 ms 2640 KB Output is correct
26 Correct 2 ms 2640 KB Output is correct
27 Correct 2 ms 2640 KB Output is correct
28 Correct 2 ms 2640 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 3 ms 2640 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 3 ms 2640 KB Output is correct
34 Correct 2 ms 2640 KB Output is correct
35 Correct 2 ms 2640 KB Output is correct
36 Correct 32 ms 5460 KB Output is correct
37 Correct 46 ms 6856 KB Output is correct
38 Correct 47 ms 6700 KB Output is correct
39 Correct 54 ms 6864 KB Output is correct
40 Correct 43 ms 6748 KB Output is correct
41 Correct 53 ms 7756 KB Output is correct
42 Correct 40 ms 6660 KB Output is correct
43 Correct 35 ms 7128 KB Output is correct
44 Correct 25 ms 7112 KB Output is correct
45 Correct 37 ms 7368 KB Output is correct
46 Correct 38 ms 7000 KB Output is correct
47 Correct 37 ms 6768 KB Output is correct
48 Correct 39 ms 6604 KB Output is correct
49 Correct 35 ms 6620 KB Output is correct
50 Correct 27 ms 7104 KB Output is correct
51 Correct 37 ms 7128 KB Output is correct
52 Correct 36 ms 6624 KB Output is correct
53 Correct 42 ms 6596 KB Output is correct
54 Correct 43 ms 6596 KB Output is correct
55 Correct 36 ms 7108 KB Output is correct
56 Correct 41 ms 6880 KB Output is correct
57 Correct 35 ms 6608 KB Output is correct
58 Correct 35 ms 6596 KB Output is correct
59 Correct 41 ms 6644 KB Output is correct
60 Correct 42 ms 6612 KB Output is correct
61 Correct 43 ms 6612 KB Output is correct
62 Correct 34 ms 6656 KB Output is correct
63 Correct 34 ms 6596 KB Output is correct
64 Correct 26 ms 7104 KB Output is correct
65 Correct 29 ms 7112 KB Output is correct
66 Correct 35 ms 6824 KB Output is correct
67 Correct 33 ms 7104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 706 ms 6628 KB Output is correct
2 Correct 777 ms 6656 KB Output is correct
3 Correct 954 ms 6612 KB Output is correct
4 Correct 878 ms 6596 KB Output is correct
5 Correct 765 ms 6644 KB Output is correct
6 Correct 690 ms 6612 KB Output is correct
7 Correct 920 ms 6604 KB Output is correct
8 Correct 615 ms 7112 KB Output is correct
9 Correct 697 ms 7124 KB Output is correct
10 Correct 788 ms 6976 KB Output is correct
11 Correct 721 ms 7120 KB Output is correct
12 Correct 788 ms 7112 KB Output is correct
13 Correct 849 ms 7176 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 2 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 37 ms 6588 KB Output is correct
18 Correct 35 ms 6608 KB Output is correct
19 Correct 45 ms 6620 KB Output is correct
20 Correct 26 ms 7136 KB Output is correct
21 Correct 28 ms 7116 KB Output is correct
22 Correct 46 ms 6588 KB Output is correct
23 Correct 37 ms 6616 KB Output is correct
24 Correct 35 ms 6608 KB Output is correct
25 Correct 27 ms 7188 KB Output is correct
26 Correct 33 ms 6756 KB Output is correct
27 Correct 2 ms 2640 KB Output is correct
28 Correct 2 ms 2640 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 2 ms 2640 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 2 ms 2640 KB Output is correct
34 Correct 3 ms 2640 KB Output is correct
35 Correct 2 ms 2640 KB Output is correct
36 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 206 ms 3676 KB Output is correct
2 Correct 929 ms 6620 KB Output is correct
3 Correct 832 ms 6616 KB Output is correct
4 Correct 706 ms 6620 KB Output is correct
5 Correct 794 ms 6620 KB Output is correct
6 Correct 903 ms 6612 KB Output is correct
7 Correct 865 ms 6600 KB Output is correct
8 Correct 678 ms 7104 KB Output is correct
9 Correct 758 ms 7120 KB Output is correct
10 Correct 690 ms 7000 KB Output is correct
11 Correct 769 ms 7116 KB Output is correct
12 Correct 40 ms 6736 KB Output is correct
13 Correct 34 ms 6612 KB Output is correct
14 Correct 34 ms 6596 KB Output is correct
15 Correct 26 ms 7136 KB Output is correct
16 Correct 36 ms 6752 KB Output is correct
17 Correct 44 ms 6612 KB Output is correct
18 Correct 37 ms 6596 KB Output is correct
19 Correct 44 ms 6564 KB Output is correct
20 Correct 34 ms 6628 KB Output is correct
21 Correct 48 ms 6632 KB Output is correct
22 Correct 46 ms 6608 KB Output is correct
23 Correct 34 ms 6608 KB Output is correct
24 Correct 26 ms 7112 KB Output is correct
25 Correct 25 ms 7128 KB Output is correct
26 Correct 33 ms 6856 KB Output is correct
27 Correct 31 ms 7104 KB Output is correct
28 Correct 2 ms 2640 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 2 ms 2640 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 2 ms 2640 KB Output is correct
34 Correct 2 ms 2640 KB Output is correct
35 Correct 3 ms 2640 KB Output is correct
36 Correct 2 ms 2640 KB Output is correct
37 Correct 2 ms 2640 KB Output is correct
38 Correct 2 ms 2640 KB Output is correct
39 Correct 2 ms 2640 KB Output is correct
40 Correct 2 ms 2640 KB Output is correct
41 Correct 2 ms 2640 KB Output is correct
42 Correct 2 ms 2640 KB Output is correct
43 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 2 ms 2768 KB Output is correct
3 Correct 2 ms 2768 KB Output is correct
4 Correct 2 ms 2768 KB Output is correct
5 Correct 3 ms 2768 KB Output is correct
6 Correct 3 ms 2768 KB Output is correct
7 Correct 2 ms 2768 KB Output is correct
8 Correct 2 ms 2640 KB Output is correct
9 Correct 2 ms 2640 KB Output is correct
10 Correct 2 ms 2768 KB Output is correct
11 Correct 2 ms 2768 KB Output is correct
12 Correct 2 ms 2640 KB Output is correct
13 Correct 2 ms 2640 KB Output is correct
14 Correct 2 ms 2640 KB Output is correct
15 Correct 3 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 3 ms 2640 KB Output is correct
18 Correct 3 ms 2784 KB Output is correct
19 Correct 2 ms 2640 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2660 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 2 ms 2640 KB Output is correct
26 Correct 2 ms 2640 KB Output is correct
27 Correct 2 ms 2640 KB Output is correct
28 Correct 2 ms 2640 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 3 ms 2640 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 3 ms 2640 KB Output is correct
34 Correct 2 ms 2640 KB Output is correct
35 Correct 2 ms 2640 KB Output is correct
36 Correct 32 ms 5460 KB Output is correct
37 Correct 46 ms 6856 KB Output is correct
38 Correct 47 ms 6700 KB Output is correct
39 Correct 54 ms 6864 KB Output is correct
40 Correct 43 ms 6748 KB Output is correct
41 Correct 53 ms 7756 KB Output is correct
42 Correct 40 ms 6660 KB Output is correct
43 Correct 35 ms 7128 KB Output is correct
44 Correct 25 ms 7112 KB Output is correct
45 Correct 37 ms 7368 KB Output is correct
46 Correct 38 ms 7000 KB Output is correct
47 Correct 37 ms 6768 KB Output is correct
48 Correct 39 ms 6604 KB Output is correct
49 Correct 35 ms 6620 KB Output is correct
50 Correct 27 ms 7104 KB Output is correct
51 Correct 37 ms 7128 KB Output is correct
52 Correct 36 ms 6624 KB Output is correct
53 Correct 42 ms 6596 KB Output is correct
54 Correct 43 ms 6596 KB Output is correct
55 Correct 36 ms 7108 KB Output is correct
56 Correct 41 ms 6880 KB Output is correct
57 Correct 35 ms 6608 KB Output is correct
58 Correct 35 ms 6596 KB Output is correct
59 Correct 41 ms 6644 KB Output is correct
60 Correct 42 ms 6612 KB Output is correct
61 Correct 43 ms 6612 KB Output is correct
62 Correct 34 ms 6656 KB Output is correct
63 Correct 34 ms 6596 KB Output is correct
64 Correct 26 ms 7104 KB Output is correct
65 Correct 29 ms 7112 KB Output is correct
66 Correct 35 ms 6824 KB Output is correct
67 Correct 33 ms 7104 KB Output is correct
68 Correct 706 ms 6628 KB Output is correct
69 Correct 777 ms 6656 KB Output is correct
70 Correct 954 ms 6612 KB Output is correct
71 Correct 878 ms 6596 KB Output is correct
72 Correct 765 ms 6644 KB Output is correct
73 Correct 690 ms 6612 KB Output is correct
74 Correct 920 ms 6604 KB Output is correct
75 Correct 615 ms 7112 KB Output is correct
76 Correct 697 ms 7124 KB Output is correct
77 Correct 788 ms 6976 KB Output is correct
78 Correct 721 ms 7120 KB Output is correct
79 Correct 788 ms 7112 KB Output is correct
80 Correct 849 ms 7176 KB Output is correct
81 Correct 1 ms 2640 KB Output is correct
82 Correct 2 ms 2640 KB Output is correct
83 Correct 2 ms 2640 KB Output is correct
84 Correct 37 ms 6588 KB Output is correct
85 Correct 35 ms 6608 KB Output is correct
86 Correct 45 ms 6620 KB Output is correct
87 Correct 26 ms 7136 KB Output is correct
88 Correct 28 ms 7116 KB Output is correct
89 Correct 46 ms 6588 KB Output is correct
90 Correct 37 ms 6616 KB Output is correct
91 Correct 35 ms 6608 KB Output is correct
92 Correct 27 ms 7188 KB Output is correct
93 Correct 33 ms 6756 KB Output is correct
94 Correct 2 ms 2640 KB Output is correct
95 Correct 2 ms 2640 KB Output is correct
96 Correct 2 ms 2640 KB Output is correct
97 Correct 2 ms 2640 KB Output is correct
98 Correct 2 ms 2640 KB Output is correct
99 Correct 2 ms 2640 KB Output is correct
100 Correct 2 ms 2640 KB Output is correct
101 Correct 3 ms 2640 KB Output is correct
102 Correct 2 ms 2640 KB Output is correct
103 Correct 2 ms 2640 KB Output is correct
104 Execution timed out 4035 ms 16268 KB Time limit exceeded
105 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 5072 KB Output is correct
2 Correct 666 ms 7096 KB Output is correct
3 Correct 851 ms 7132 KB Output is correct
4 Correct 755 ms 7112 KB Output is correct
5 Correct 798 ms 7172 KB Output is correct
6 Correct 819 ms 7116 KB Output is correct
7 Correct 666 ms 7120 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 2 ms 2640 KB Output is correct
10 Correct 2 ms 2640 KB Output is correct
11 Correct 2 ms 2640 KB Output is correct
12 Correct 2 ms 2768 KB Output is correct
13 Correct 2 ms 2768 KB Output is correct
14 Correct 2 ms 2768 KB Output is correct
15 Correct 3 ms 2768 KB Output is correct
16 Correct 3 ms 2768 KB Output is correct
17 Correct 2 ms 2768 KB Output is correct
18 Correct 2 ms 2640 KB Output is correct
19 Correct 2 ms 2640 KB Output is correct
20 Correct 2 ms 2768 KB Output is correct
21 Correct 2 ms 2768 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 2 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 3 ms 2640 KB Output is correct
26 Correct 2 ms 2640 KB Output is correct
27 Correct 3 ms 2640 KB Output is correct
28 Correct 3 ms 2784 KB Output is correct
29 Correct 2 ms 2640 KB Output is correct
30 Correct 2 ms 2640 KB Output is correct
31 Correct 2 ms 2660 KB Output is correct
32 Correct 2 ms 2640 KB Output is correct
33 Correct 3 ms 2640 KB Output is correct
34 Correct 2 ms 2640 KB Output is correct
35 Correct 2 ms 2640 KB Output is correct
36 Correct 2 ms 2640 KB Output is correct
37 Correct 2 ms 2640 KB Output is correct
38 Correct 2 ms 2640 KB Output is correct
39 Correct 2 ms 2640 KB Output is correct
40 Correct 2 ms 2640 KB Output is correct
41 Correct 3 ms 2640 KB Output is correct
42 Correct 2 ms 2640 KB Output is correct
43 Correct 3 ms 2640 KB Output is correct
44 Correct 2 ms 2640 KB Output is correct
45 Correct 2 ms 2640 KB Output is correct
46 Correct 32 ms 5460 KB Output is correct
47 Correct 46 ms 6856 KB Output is correct
48 Correct 47 ms 6700 KB Output is correct
49 Correct 54 ms 6864 KB Output is correct
50 Correct 43 ms 6748 KB Output is correct
51 Correct 53 ms 7756 KB Output is correct
52 Correct 40 ms 6660 KB Output is correct
53 Correct 35 ms 7128 KB Output is correct
54 Correct 25 ms 7112 KB Output is correct
55 Correct 37 ms 7368 KB Output is correct
56 Correct 38 ms 7000 KB Output is correct
57 Correct 37 ms 6768 KB Output is correct
58 Correct 39 ms 6604 KB Output is correct
59 Correct 35 ms 6620 KB Output is correct
60 Correct 27 ms 7104 KB Output is correct
61 Correct 37 ms 7128 KB Output is correct
62 Correct 36 ms 6624 KB Output is correct
63 Correct 42 ms 6596 KB Output is correct
64 Correct 43 ms 6596 KB Output is correct
65 Correct 36 ms 7108 KB Output is correct
66 Correct 41 ms 6880 KB Output is correct
67 Correct 35 ms 6608 KB Output is correct
68 Correct 35 ms 6596 KB Output is correct
69 Correct 41 ms 6644 KB Output is correct
70 Correct 42 ms 6612 KB Output is correct
71 Correct 43 ms 6612 KB Output is correct
72 Correct 34 ms 6656 KB Output is correct
73 Correct 34 ms 6596 KB Output is correct
74 Correct 26 ms 7104 KB Output is correct
75 Correct 29 ms 7112 KB Output is correct
76 Correct 35 ms 6824 KB Output is correct
77 Correct 33 ms 7104 KB Output is correct
78 Correct 706 ms 6628 KB Output is correct
79 Correct 777 ms 6656 KB Output is correct
80 Correct 954 ms 6612 KB Output is correct
81 Correct 878 ms 6596 KB Output is correct
82 Correct 765 ms 6644 KB Output is correct
83 Correct 690 ms 6612 KB Output is correct
84 Correct 920 ms 6604 KB Output is correct
85 Correct 615 ms 7112 KB Output is correct
86 Correct 697 ms 7124 KB Output is correct
87 Correct 788 ms 6976 KB Output is correct
88 Correct 721 ms 7120 KB Output is correct
89 Correct 788 ms 7112 KB Output is correct
90 Correct 849 ms 7176 KB Output is correct
91 Correct 1 ms 2640 KB Output is correct
92 Correct 2 ms 2640 KB Output is correct
93 Correct 2 ms 2640 KB Output is correct
94 Correct 37 ms 6588 KB Output is correct
95 Correct 35 ms 6608 KB Output is correct
96 Correct 45 ms 6620 KB Output is correct
97 Correct 26 ms 7136 KB Output is correct
98 Correct 28 ms 7116 KB Output is correct
99 Correct 46 ms 6588 KB Output is correct
100 Correct 37 ms 6616 KB Output is correct
101 Correct 35 ms 6608 KB Output is correct
102 Correct 27 ms 7188 KB Output is correct
103 Correct 33 ms 6756 KB Output is correct
104 Correct 2 ms 2640 KB Output is correct
105 Correct 2 ms 2640 KB Output is correct
106 Correct 2 ms 2640 KB Output is correct
107 Correct 2 ms 2640 KB Output is correct
108 Correct 2 ms 2640 KB Output is correct
109 Correct 2 ms 2640 KB Output is correct
110 Correct 2 ms 2640 KB Output is correct
111 Correct 3 ms 2640 KB Output is correct
112 Correct 2 ms 2640 KB Output is correct
113 Correct 2 ms 2640 KB Output is correct
114 Correct 206 ms 3676 KB Output is correct
115 Correct 929 ms 6620 KB Output is correct
116 Correct 832 ms 6616 KB Output is correct
117 Correct 706 ms 6620 KB Output is correct
118 Correct 794 ms 6620 KB Output is correct
119 Correct 903 ms 6612 KB Output is correct
120 Correct 865 ms 6600 KB Output is correct
121 Correct 678 ms 7104 KB Output is correct
122 Correct 758 ms 7120 KB Output is correct
123 Correct 690 ms 7000 KB Output is correct
124 Correct 769 ms 7116 KB Output is correct
125 Correct 40 ms 6736 KB Output is correct
126 Correct 34 ms 6612 KB Output is correct
127 Correct 34 ms 6596 KB Output is correct
128 Correct 26 ms 7136 KB Output is correct
129 Correct 36 ms 6752 KB Output is correct
130 Correct 44 ms 6612 KB Output is correct
131 Correct 37 ms 6596 KB Output is correct
132 Correct 44 ms 6564 KB Output is correct
133 Correct 34 ms 6628 KB Output is correct
134 Correct 48 ms 6632 KB Output is correct
135 Correct 46 ms 6608 KB Output is correct
136 Correct 34 ms 6608 KB Output is correct
137 Correct 26 ms 7112 KB Output is correct
138 Correct 25 ms 7128 KB Output is correct
139 Correct 33 ms 6856 KB Output is correct
140 Correct 31 ms 7104 KB Output is correct
141 Correct 2 ms 2640 KB Output is correct
142 Correct 2 ms 2640 KB Output is correct
143 Correct 2 ms 2640 KB Output is correct
144 Correct 2 ms 2640 KB Output is correct
145 Correct 2 ms 2640 KB Output is correct
146 Correct 2 ms 2640 KB Output is correct
147 Correct 2 ms 2640 KB Output is correct
148 Correct 3 ms 2640 KB Output is correct
149 Correct 2 ms 2640 KB Output is correct
150 Correct 2 ms 2640 KB Output is correct
151 Correct 2 ms 2640 KB Output is correct
152 Correct 2 ms 2640 KB Output is correct
153 Correct 2 ms 2640 KB Output is correct
154 Correct 2 ms 2640 KB Output is correct
155 Correct 2 ms 2640 KB Output is correct
156 Correct 2 ms 2640 KB Output is correct
157 Execution timed out 4035 ms 16268 KB Time limit exceeded
158 Halted 0 ms 0 KB -