Submission #964036

# Submission time Handle Problem Language Result Execution time Memory
964036 2024-04-16T08:31:34 Z happybelly Closing Time (IOI23_closing) C++17
100 / 100
386 ms 69036 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 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 59364 KB Output is correct
2 Correct 246 ms 68228 KB Output is correct
3 Correct 134 ms 5780 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 0 ms 348 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 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 0 ms 348 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 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 440 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 604 KB Output is correct
23 Correct 1 ms 436 KB Output is correct
24 Correct 1 ms 600 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 0 ms 348 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 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 440 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 604 KB Output is correct
23 Correct 1 ms 436 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 2 ms 344 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 1376 KB Output is correct
30 Correct 3 ms 1372 KB Output is correct
31 Correct 3 ms 1472 KB Output is correct
32 Correct 3 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 356 KB Output is correct
12 Correct 0 ms 352 KB Output is correct
13 Correct 0 ms 360 KB Output is correct
14 Correct 0 ms 356 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 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 356 KB Output is correct
20 Correct 0 ms 352 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 0 ms 356 KB Output is correct
24 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 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 1 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 356 KB Output is correct
24 Correct 0 ms 352 KB Output is correct
25 Correct 0 ms 360 KB Output is correct
26 Correct 0 ms 356 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 604 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 356 KB Output is correct
32 Correct 0 ms 352 KB Output is correct
33 Correct 0 ms 356 KB Output is correct
34 Correct 1 ms 360 KB Output is correct
35 Correct 0 ms 356 KB Output is correct
36 Correct 1 ms 352 KB Output is correct
37 Correct 0 ms 352 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 492 KB Output is correct
40 Correct 1 ms 440 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 1 ms 600 KB Output is correct
45 Correct 1 ms 352 KB Output is correct
46 Correct 0 ms 360 KB Output is correct
47 Correct 1 ms 360 KB Output is correct
48 Correct 0 ms 352 KB Output is correct
49 Correct 1 ms 500 KB Output is correct
50 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 436 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 356 KB Output is correct
31 Correct 0 ms 352 KB Output is correct
32 Correct 0 ms 360 KB Output is correct
33 Correct 0 ms 356 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 604 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 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 0 ms 356 KB Output is correct
41 Correct 1 ms 360 KB Output is correct
42 Correct 0 ms 356 KB Output is correct
43 Correct 1 ms 352 KB Output is correct
44 Correct 0 ms 352 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 492 KB Output is correct
47 Correct 1 ms 440 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 600 KB Output is correct
52 Correct 1 ms 352 KB Output is correct
53 Correct 0 ms 360 KB Output is correct
54 Correct 1 ms 360 KB Output is correct
55 Correct 0 ms 352 KB Output is correct
56 Correct 1 ms 500 KB Output is correct
57 Correct 1 ms 352 KB Output is correct
58 Correct 1 ms 356 KB Output is correct
59 Correct 1 ms 344 KB Output is correct
60 Correct 1 ms 500 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 344 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 604 KB Output is correct
69 Correct 1 ms 604 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 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 436 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 2 ms 344 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 1376 KB Output is correct
31 Correct 3 ms 1372 KB Output is correct
32 Correct 3 ms 1472 KB Output is correct
33 Correct 3 ms 1500 KB Output is correct
34 Correct 1 ms 344 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 1 ms 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 0 ms 360 KB Output is correct
41 Correct 0 ms 356 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 604 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 356 KB Output is correct
47 Correct 0 ms 352 KB Output is correct
48 Correct 0 ms 356 KB Output is correct
49 Correct 1 ms 360 KB Output is correct
50 Correct 0 ms 356 KB Output is correct
51 Correct 1 ms 352 KB Output is correct
52 Correct 0 ms 352 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 492 KB Output is correct
55 Correct 1 ms 440 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 1 ms 344 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 600 KB Output is correct
60 Correct 1 ms 352 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 360 KB Output is correct
63 Correct 0 ms 352 KB Output is correct
64 Correct 1 ms 500 KB Output is correct
65 Correct 1 ms 352 KB Output is correct
66 Correct 1 ms 356 KB Output is correct
67 Correct 1 ms 344 KB Output is correct
68 Correct 1 ms 500 KB Output is correct
69 Correct 1 ms 348 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 344 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 604 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 348 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 348 KB Output is correct
84 Correct 4 ms 348 KB Output is correct
85 Correct 3 ms 604 KB Output is correct
86 Correct 3 ms 348 KB Output is correct
87 Correct 3 ms 348 KB Output is correct
88 Correct 3 ms 348 KB Output is correct
89 Correct 4 ms 1244 KB Output is correct
90 Correct 3 ms 1116 KB Output is correct
91 Correct 4 ms 1244 KB Output is correct
92 Correct 4 ms 1240 KB Output is correct
93 Correct 4 ms 1248 KB Output is correct
94 Correct 4 ms 1372 KB Output is correct
95 Correct 4 ms 1444 KB Output is correct
96 Correct 3 ms 1372 KB Output is correct
97 Correct 4 ms 1372 KB Output is correct
98 Correct 4 ms 1240 KB Output is correct
99 Correct 5 ms 1240 KB Output is correct
100 Correct 4 ms 860 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 436 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 2 ms 344 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 1376 KB Output is correct
31 Correct 3 ms 1372 KB Output is correct
32 Correct 3 ms 1472 KB Output is correct
33 Correct 3 ms 1500 KB Output is correct
34 Correct 1 ms 344 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 1 ms 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 0 ms 360 KB Output is correct
41 Correct 0 ms 356 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 604 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 356 KB Output is correct
47 Correct 0 ms 352 KB Output is correct
48 Correct 0 ms 356 KB Output is correct
49 Correct 1 ms 360 KB Output is correct
50 Correct 0 ms 356 KB Output is correct
51 Correct 1 ms 352 KB Output is correct
52 Correct 0 ms 352 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 492 KB Output is correct
55 Correct 1 ms 440 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 1 ms 344 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 600 KB Output is correct
60 Correct 1 ms 352 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 360 KB Output is correct
63 Correct 0 ms 352 KB Output is correct
64 Correct 1 ms 500 KB Output is correct
65 Correct 1 ms 352 KB Output is correct
66 Correct 1 ms 356 KB Output is correct
67 Correct 1 ms 344 KB Output is correct
68 Correct 1 ms 500 KB Output is correct
69 Correct 1 ms 348 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 344 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 604 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 348 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 348 KB Output is correct
84 Correct 4 ms 348 KB Output is correct
85 Correct 3 ms 604 KB Output is correct
86 Correct 3 ms 348 KB Output is correct
87 Correct 3 ms 348 KB Output is correct
88 Correct 3 ms 348 KB Output is correct
89 Correct 4 ms 1244 KB Output is correct
90 Correct 3 ms 1116 KB Output is correct
91 Correct 4 ms 1244 KB Output is correct
92 Correct 4 ms 1240 KB Output is correct
93 Correct 4 ms 1248 KB Output is correct
94 Correct 4 ms 1372 KB Output is correct
95 Correct 4 ms 1444 KB Output is correct
96 Correct 3 ms 1372 KB Output is correct
97 Correct 4 ms 1372 KB Output is correct
98 Correct 4 ms 1240 KB Output is correct
99 Correct 5 ms 1240 KB Output is correct
100 Correct 4 ms 860 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
102 Correct 159 ms 5512 KB Output is correct
103 Correct 170 ms 5712 KB Output is correct
104 Correct 291 ms 65616 KB Output is correct
105 Correct 240 ms 8164 KB Output is correct
106 Correct 218 ms 7520 KB Output is correct
107 Correct 181 ms 52700 KB Output is correct
108 Correct 180 ms 54880 KB Output is correct
109 Correct 171 ms 66692 KB Output is correct
110 Correct 362 ms 57904 KB Output is correct
111 Correct 266 ms 63628 KB Output is correct
112 Correct 368 ms 56464 KB Output is correct
113 Correct 350 ms 55228 KB Output is correct
114 Correct 308 ms 57072 KB Output is correct
115 Correct 163 ms 69036 KB Output is correct
116 Correct 386 ms 60316 KB Output is correct
117 Correct 320 ms 60708 KB Output is correct
118 Correct 361 ms 58420 KB Output is correct
119 Correct 222 ms 12920 KB Output is correct
120 Correct 146 ms 5416 KB Output is correct