Submission #964515

# Submission time Handle Problem Language Result Execution time Memory
964515 2024-04-17T04:57:27 Z happybelly Closing Time (IOI23_closing) C++17
100 / 100
356 ms 69712 KB
// O(N log N)
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;

struct Fenwick
{
    vector<long long> tree;
    int sz;

    Fenwick(int _sz = 0)
    {
        sz = _sz;
        tree.clear();
        tree.resize(sz + 5, 0);
    }

    void add(int idx, long long val)
    {
        for (int i = idx; i <= sz; i += i & -i)
        {
            tree[i] += val;
        }
    }

    long long query(int idx)
    {
        long long ret = 0;
        for (int i = idx; i > 0; i -= i & -i)
        {
            ret += tree[i];
        }
        return ret;
    }

    int getHighestWithSumAtMost(long long k)
    {
        int idx = 0;
        long long total = 0;

        int lg = 0;
        while ((1 << lg) <= sz)
            lg++;

        for (int i = lg - 1; i >= 0; i--)
        {
            if (idx + (1 << i) <= sz && total + tree[idx + (1 << i)] <= k)
            {
                idx += (1 << i);
                total += tree[idx];
            }
        }

        return idx;
    }
};

vector<vector<pair<int, int>>> adj_list;
vector<long long> p_val, q_val;
vector<bool> in_path_xy;

int N;
long long K;

void DfsDistance(int now, int prv, long long current_dist, vector<long long> &dist_vec, vector<int> &parent)
{
    dist_vec[now] = current_dist;
    parent[now] = prv;

    for (pair<int, int> edge : adj_list[now])
    {
        int nxt = edge.first;
        if (nxt == prv)
            continue;
        long long new_dist = edge.second + current_dist;
        DfsDistance(nxt, now, new_dist, dist_vec, parent);
    }
}

int CalculateWithCommon()
{
    vector<tuple<long long, long long, int>> sorted_diffs;
    for (int i = 0; i < N; i++)
    {
        sorted_diffs.push_back(make_tuple(q_val[i] - p_val[i], p_val[i], i));
    }
    sort(sorted_diffs.begin(), sorted_diffs.end());

    vector<pair<long long, int>> sorted_vals;
    for (int i = 0; i < static_cast<int>(sorted_diffs.size()); i++)
    {
        int node = get<2>(sorted_diffs[i]);

        sorted_vals.push_back({2 * p_val[node], node});
        sorted_vals.push_back({q_val[node], -2 * node - 2});
        sorted_vals.push_back({q_val[node], -2 * node - 1});
    }
    sorted_vals.push_back({-1, -1});
    sort(sorted_vals.begin(), sorted_vals.end());

    Fenwick dist_tree(3 * N), q_counter(3 * N), p_counter(3 * N);

    auto GetIdx = [&](long long v, int id) -> int
    {
        pair<long long, int> temp = {v, id};
        auto lb = lower_bound(sorted_vals.begin(), sorted_vals.end(), temp);
        return lb - sorted_vals.begin();
    };

    auto GetOptimumLeftover = [&](long long left) -> int
    {
        int highest_idx = dist_tree.getHighestWithSumAtMost(left);
        long long current_total = dist_tree.query(highest_idx);
        int current_score = q_counter.query(highest_idx) + p_counter.query(highest_idx);

        if (q_counter.query(highest_idx) % 2 == 0)
        { // even q, everything is ok
            return current_score;
        }

        // odd q counter
        int highest_q_idx = 1 + q_counter.getHighestWithSumAtMost(q_counter.query(highest_idx) - 1);
        long long highest_q_val = sorted_vals[highest_q_idx].first;

        // case 1: replace highest q with next lowest p
        if (p_counter.query(highest_idx) != p_counter.query(3 * N))
        {
            int next_p_idx = 1 + p_counter.getHighestWithSumAtMost(p_counter.query(highest_idx));
            long long next_p_val = sorted_vals[next_p_idx].first;

            if (current_total - highest_q_val + next_p_val <= left)
            {
                return current_score;
            }
        }

        // case 2: replace highest p with highest q
        if (p_counter.query(highest_idx) > 0)
        {
            int highest_p_idx = 1 + p_counter.getHighestWithSumAtMost(p_counter.query(highest_idx) - 1);
            long long highest_p_val = sorted_vals[highest_p_idx].first;

            if (current_total - highest_p_val + highest_q_val <= left)
            {
                return current_score;
            }
        }

        // case 3: throw away one of the q
        return current_score - 1;
    };

    long long total_in_path = 0;
    int score_in_path = 0;
    int ret = 0;

    for (int i = 0; i < N; i++)
    {
        if (in_path_xy[i])
        {
            total_in_path += p_val[i];
            score_in_path++;
            continue;
        }

        // initially, everything is in p
        int idx = GetIdx(2 * p_val[i], i);
        dist_tree.add(idx, 2 * p_val[i]);
        p_counter.add(idx, 1);
    }

    for (int border = 0; border < N; border++)
    {
        int node = get<2>(sorted_diffs[border]);

        // convert to q
        if (in_path_xy[node])
        {
            total_in_path += (q_val[node] - p_val[node]);
            score_in_path++;
        }
        else
        {
            int idx_p = GetIdx(2 * p_val[node], node);
            dist_tree.add(idx_p, -2 * p_val[node]);
            p_counter.add(idx_p, -1);

            int idx_q = GetIdx(q_val[node], -2 * node - 2);
            dist_tree.add(idx_q, q_val[node]);
            q_counter.add(idx_q, 1);
            dist_tree.add(idx_q + 1, q_val[node]);
            q_counter.add(idx_q + 1, 1);
        }

        if (total_in_path <= K)
        {
            int opt_leftover = GetOptimumLeftover(2 * (K - total_in_path));
            ret = max(ret, score_in_path + opt_leftover);
        }
    }

    return ret;
}

int CalculateWithoutCommon()
{
    vector<long long> sorted_dist;
    for (int i = 0; i < N; i++)
    {
        sorted_dist.push_back(p_val[i]);
        sorted_dist.push_back(q_val[i]);
    }
    sort(sorted_dist.begin(), sorted_dist.end());

    int score = 0;
    long long total = 0;
    for (long long d : sorted_dist)
    {
        if (total + d <= K)
        {
            score++;
            total += d;
        }
    }

    return score;
}

int max_score(int _N, int X, int Y, long long _K,
              std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    N = _N;
    K = _K;

    adj_list.assign(N, vector<pair<int, int>>());
    q_val.resize(N);
    p_val.resize(N);
    in_path_xy.assign(N, false);

    for (int i = 0; i < static_cast<int>(U.size()); i++)
    {
        adj_list[U[i]].push_back({V[i], W[i]});
        adj_list[V[i]].push_back({U[i], W[i]});
    }

    vector<int> parent_rooted_x(N);
    vector<long long> dist_from_y(N);
    vector<long long> dist_from_x(N);
    DfsDistance(Y, -1, 0, dist_from_y, parent_rooted_x);
    DfsDistance(X, -1, 0, dist_from_x, parent_rooted_x);
    for (int i = Y; i != -1; i = parent_rooted_x[i])
    {
        in_path_xy[i] = true;
    }
    for (int i = 0; i < N; i++)
    {
        p_val[i] = min(dist_from_x[i], dist_from_y[i]);
        q_val[i] = max(dist_from_x[i], dist_from_y[i]);
    }

    int ret = CalculateWithCommon();
    ret = max(ret, CalculateWithoutCommon());

    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 58672 KB Output is correct
2 Correct 235 ms 68544 KB Output is correct
3 Correct 133 ms 5776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 420 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 420 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 2 ms 444 KB Output is correct
26 Correct 4 ms 1368 KB Output is correct
27 Correct 4 ms 1372 KB Output is correct
28 Correct 3 ms 1372 KB Output is correct
29 Correct 3 ms 1372 KB Output is correct
30 Correct 3 ms 1372 KB Output is correct
31 Correct 2 ms 1452 KB Output is correct
32 Correct 3 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 600 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 504 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 504 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 352 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 600 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 504 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 504 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 420 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 352 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 504 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 600 KB Output is correct
69 Correct 1 ms 436 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 504 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 420 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 2 ms 444 KB Output is correct
27 Correct 4 ms 1368 KB Output is correct
28 Correct 4 ms 1372 KB Output is correct
29 Correct 3 ms 1372 KB Output is correct
30 Correct 3 ms 1372 KB Output is correct
31 Correct 3 ms 1372 KB Output is correct
32 Correct 2 ms 1452 KB Output is correct
33 Correct 3 ms 1496 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 352 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 600 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 504 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 344 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 600 KB Output is correct
77 Correct 1 ms 436 KB Output is correct
78 Correct 1 ms 344 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 3 ms 348 KB Output is correct
85 Correct 4 ms 604 KB Output is correct
86 Correct 2 ms 348 KB Output is correct
87 Correct 3 ms 348 KB Output is correct
88 Correct 3 ms 344 KB Output is correct
89 Correct 4 ms 1240 KB Output is correct
90 Correct 3 ms 1116 KB Output is correct
91 Correct 4 ms 1240 KB Output is correct
92 Correct 4 ms 1236 KB Output is correct
93 Correct 3 ms 1240 KB Output is correct
94 Correct 3 ms 1440 KB Output is correct
95 Correct 3 ms 1472 KB Output is correct
96 Correct 3 ms 1368 KB Output is correct
97 Correct 5 ms 1372 KB Output is correct
98 Correct 4 ms 1240 KB Output is correct
99 Correct 4 ms 1240 KB Output is correct
100 Correct 3 ms 860 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 504 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 420 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 2 ms 444 KB Output is correct
27 Correct 4 ms 1368 KB Output is correct
28 Correct 4 ms 1372 KB Output is correct
29 Correct 3 ms 1372 KB Output is correct
30 Correct 3 ms 1372 KB Output is correct
31 Correct 3 ms 1372 KB Output is correct
32 Correct 2 ms 1452 KB Output is correct
33 Correct 3 ms 1496 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 352 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 600 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 504 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 344 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 600 KB Output is correct
77 Correct 1 ms 436 KB Output is correct
78 Correct 1 ms 344 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 3 ms 348 KB Output is correct
85 Correct 4 ms 604 KB Output is correct
86 Correct 2 ms 348 KB Output is correct
87 Correct 3 ms 348 KB Output is correct
88 Correct 3 ms 344 KB Output is correct
89 Correct 4 ms 1240 KB Output is correct
90 Correct 3 ms 1116 KB Output is correct
91 Correct 4 ms 1240 KB Output is correct
92 Correct 4 ms 1236 KB Output is correct
93 Correct 3 ms 1240 KB Output is correct
94 Correct 3 ms 1440 KB Output is correct
95 Correct 3 ms 1472 KB Output is correct
96 Correct 3 ms 1368 KB Output is correct
97 Correct 5 ms 1372 KB Output is correct
98 Correct 4 ms 1240 KB Output is correct
99 Correct 4 ms 1240 KB Output is correct
100 Correct 3 ms 860 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
102 Correct 151 ms 5568 KB Output is correct
103 Correct 163 ms 5660 KB Output is correct
104 Correct 296 ms 66508 KB Output is correct
105 Correct 232 ms 8192 KB Output is correct
106 Correct 215 ms 7480 KB Output is correct
107 Correct 180 ms 52076 KB Output is correct
108 Correct 185 ms 55312 KB Output is correct
109 Correct 150 ms 66704 KB Output is correct
110 Correct 350 ms 57756 KB Output is correct
111 Correct 253 ms 62488 KB Output is correct
112 Correct 356 ms 57332 KB Output is correct
113 Correct 301 ms 55844 KB Output is correct
114 Correct 290 ms 57124 KB Output is correct
115 Correct 163 ms 69712 KB Output is correct
116 Correct 347 ms 59304 KB Output is correct
117 Correct 280 ms 60576 KB Output is correct
118 Correct 321 ms 57636 KB Output is correct
119 Correct 225 ms 12888 KB Output is correct
120 Correct 142 ms 5068 KB Output is correct