Submission #624859

# Submission time Handle Problem Language Result Execution time Memory
624859 2022-08-08T21:48:44 Z boris_mihov Jail (JOI22_jail) C++14
100 / 100
1004 ms 85636 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

typedef long long llong;
const int MAXN = 120000 + 10;
const int INF  = 2e9;

int n, q;
int vis[10 * MAXN];
int sz[MAXN], head[MAXN];
int from[MAXN], to[MAXN];
int depth[MAXN], inS[MAXN], inE[MAXN];
int parent[MAXN], heavy[MAXN];
int start[MAXN], end[MAXN];
int in[MAXN], out[MAXN], timer;
std::vector <int> g[MAXN];
std::vector <int> v[10 * MAXN];
std::vector <int> chainS, chainE;

inline bool inSubtree(int x, int y)
{
    return in[y] <= in[x] && in[x] <= out[y];
}

void dfs(int node, int p)
{
    in[node] = ++timer;
    parent[node] = p;
    depth[node] = depth[p] + 1;
    sz[node] = 1;

    for (const int &i : g[node])
    {
        if (i == p) continue;
        dfs(i, node);
        sz[node] += sz[i];
        if (sz[i] > sz[heavy[node]])
        {
            heavy[node] = i;
        }
    }

    out[node] = ++timer;
}

void decompose(int node, int h)
{
    // std::cout << "decompose: " << node << ' ' << h << " = " << start[node] << ' ' << end[node] << '\n';
    head[node] = h;
    if (start[node] != 0) chainS.push_back(start[node]);
    if (end[node] != 0) chainE.push_back(end[node]);
    inS[node] = chainS.size() - 1;
    inE[node] = chainE.size() - 1;
    if (heavy[node] != 0) decompose(heavy[node], h);

    for (const int &i : g[node])
    {
        if (i == parent[node] || i == heavy[node]) continue;
        decompose(i, i);
    }
}

int treeS[4 * MAXN];
int treeE[4 * MAXN];
int cnt;

void buildS(int l, int r, int node)
{
    if (l == r)
    {
        treeS[node] = chainS[l];
        return;
    }

    treeS[node] = ++cnt;
    int mid = (l + r) / 2;
    buildS(l, mid, 2*node);
    buildS(mid + 1, r, 2*node + 1);
    v[treeS[2*node]].push_back(treeS[node]);
    v[treeS[2*node + 1]].push_back(treeS[node]);
    // std::cout << "build treeS: " << treeS[2*node] << " -> " << treeS[node] << '\n';
    // std::cout << "build treeS: " << treeS[2*node + 1] << " -> " << treeS[node] << '\n';
}

void buildE(int l, int r, int node)
{
    if (l == r)
    {
        treeE[node] = chainE[l];
        return;
    }

    treeE[node] = ++cnt;
    int mid = (l + r) / 2;
    buildE(l, mid, 2*node);
    buildE(mid + 1, r, 2*node + 1);
    v[treeE[node]].push_back(treeE[2*node]);
    v[treeE[node]].push_back(treeE[2*node + 1]);
    // std::cout << "build treeE: " << treeE[node] << " -> " << treeE[2*node] << '\n';
    // std::cout << "build treeE: " << treeE[node] << " -> " << treeE[2*node + 1] << '\n';
}

void addEdgesS(int l, int r, int node, int queryL, int queryR, int fromNode)
{
    if (queryL <= l && r <= queryR)
    {
        // std::cout << "add edge: " << treeS[node] << " -> " << fromNode << '\n';
        v[treeS[node]].push_back(fromNode);
        return;
    }

    int mid = (l + r) / 2;
    if (queryL <= mid) addEdgesS(l, mid, 2*node, queryL, queryR, fromNode);
    if (mid + 1 <= queryR) addEdgesS(mid + 1, r, 2*node + 1, queryL, queryR, fromNode);
}

void addEdgesE(int l, int r, int node, int queryL, int queryR, int fromNode)
{
    if (queryL <= l && r <= queryR)
    {
        // std::cout << "add edge: " << fromNode << " -> " << treeE[node] << '\n';
        v[fromNode].push_back(treeE[node]);
        return;
    }

    int mid = (l + r) / 2;
    if (queryL <= mid) addEdgesE(l, mid, 2*node, queryL, queryR, fromNode);
    if (mid + 1 <= queryR) addEdgesE(mid + 1, r, 2*node + 1, queryL, queryR, fromNode);
}

void hldAddS(int x, int y, int node)
{
    // std::cout << "  hld S query: " << x << ' ' << y << '\n';
    while (head[x] != head[y])
    {
        if (depth[head[x]] <= depth[head[y]]) std::swap(x, y);
        int addFrom = inS[head[x]];
        int addTo = inS[x];
        if (start[head[x]] == 0) ++addFrom;
        // std::cout << "hld add S: " << node << " = " << head[x] << ' ' << x << ' ' << inS[x] << ' ' << addFrom << ' ' << addTo << '\n';
        if (addFrom >= 0 && addFrom <= addTo) addEdgesS(0, chainS.size()-1, 1, addFrom, addTo, node);
        x = parent[head[x]];
    }

    if (depth[x] > depth[y]) std::swap(x, y);
    int addFrom = inS[x];
    int addTo = inS[y];
    if (start[x] == 0) ++addFrom;
    // std::cout << "hld add S: " << node << " = " << inS[x] << ' ' << inS[y] << ' ' << start[x] << ' ' << start[y] << ' ' << addFrom << ' ' << addTo << '\n';
    if (addFrom >= 0 && addFrom <= addTo) addEdgesS(0, chainS.size()-1, 1, addFrom, addTo, node);
}

void hldAddE(int x, int y, int node)
{
    // std::cout << "  hld E query: " << x << ' ' << y << '\n';
    while (head[x] != head[y])
    {
        if (depth[head[x]] <= depth[head[y]]) std::swap(x, y);
        int addFrom = inE[head[x]];
        int addTo = inE[x];
        if (end[head[x]] == 0) ++addFrom;
        // std::cout << "hld add E: " << node << " = " << addFrom << ' ' << addTo << '\n';
        if (addFrom >= 0 && addFrom <= addTo) addEdgesE(0, chainE.size()-1, 1, addFrom, addTo, node);
        x = parent[head[x]];
    }

    if (depth[x] > depth[y]) std::swap(x, y);
    int addFrom = inE[x];
    int addTo = inE[y];
    if (end[x] == 0) ++addFrom;
    // std::cout << "hld add E: " << node << " = " << addFrom << ' ' << addTo << '\n';
    if (addFrom >= 0 && addFrom <= addTo) addEdgesE(0, chainE.size()-1, 1, addFrom, addTo, node);
}

bool findCycle(int node)
{
    vis[node] = 1;
    for (const int &i : v[node])
    {
        if (vis[i] == 2) continue;
        if (vis[i] == 1) return true;
        if (findCycle(i)) return true;
    }

    vis[node] = 2;
    return false;
}

void solve()
{
    dfs(1, 0);
    decompose(1, 1); cnt = q;
    buildS(0, chainS.size()-1, 1);
    buildE(0, chainE.size()-1, 1);

    // std::cout << "chainS\n";
    // for (const int &i : chainS)
    // {
    //     std::cout << i << ' ';
    // }
    // std::cout << '\n';

    // std::cout << "chainE\n";
    // for (const int &i : chainE)
    // {
    //     std::cout << i << ' ';
    // }
    // std::cout << '\n';

    for (int i = 1 ; i <= q ; ++i)
    {
        if (from[i] == to[i]) continue;
        if (!inSubtree(to[i], from[i])) 
        {
            hldAddS(parent[from[i]], to[i], i);
        }
        else
        {
            for (const int &neigh : g[from[i]])
            {
                if (neigh == parent[from[i]]) continue;
                if (inSubtree(to[i], neigh))
                {
                    hldAddS(neigh, to[i], i);
                    break;
                }
            }
        }

        if (!inSubtree(from[i], to[i])) 
        {
            hldAddE(from[i], parent[to[i]], i);
        }
        else
        {
            for (const int &neigh : g[to[i]])
            {
                if (neigh == parent[to[i]]) continue;
                if (inSubtree(from[i], neigh))
                {
                    hldAddE(from[i], neigh, i);
                    break;
                }
            }
        }
    }

    // std::cout << "graph: " << cnt << '\n';
    // for (int i = 1 ; i <= cnt ; ++i)
    // {
    //     for (const int &j : v[i])
    //     {
    //         std::cout << i << ' ' << j << '\n';
    //     }
    // }

    for (int i = 1 ; i <= cnt ; ++i)
    {
        if (vis[i] == 2) continue;
        if (findCycle(i))
        {
            std::cout << "No\n";
            return;
        }
    }

    std::cout << "Yes\n";
}

void read()
{
    int x, y;
    std::cin >> n;
    for (int i = 2 ; i <= n ; ++i)
    {
        std::cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    std::cin >> q;
    for (int i = 1 ; i <= q ; ++i)
    {
        std::cin >> from[i] >> to[i];
        start[from[i]] = i;
        end[to[i]] = i;
    }
}

void reset()
{
    for (int i = 1 ; i <= cnt ; ++i)
    {
        v[i].clear();
        vis[i] = 0;
    }

    timer = 0;
    chainS.clear();
    chainE.clear();
    for (int i = 1 ; i <= n ; ++i)
    {
        in[i] = 0;
        out[i] = 0;
        g[i].clear();
        start[i] = 0;
        end[i] = 0;
        sz[i] = 0;
        head[i] = 0;
        from[i] = 0;
        to[i] = 0;
        depth[i] = 0;
        inS[i] = 0;
        inE[i] = 0;
        parent[i] = 0;
        heavy[i] = 0;
        start[i] = 0;
        end[i] = 0;
        in[i] = 0;
        out[i] = 0;
    }
}

void fastIO()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int tests;
int main()
{
    fastIO();
    std::cin >> tests;

    while (tests--)
    {
        reset();
        read();
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 31316 KB Output is correct
2 Correct 16 ms 31332 KB Output is correct
3 Correct 15 ms 31316 KB Output is correct
4 Correct 23 ms 31704 KB Output is correct
5 Correct 35 ms 32152 KB Output is correct
6 Correct 17 ms 31336 KB Output is correct
7 Correct 17 ms 31408 KB Output is correct
8 Correct 16 ms 31492 KB Output is correct
9 Correct 45 ms 33768 KB Output is correct
10 Correct 51 ms 48364 KB Output is correct
11 Correct 26 ms 31564 KB Output is correct
12 Correct 49 ms 32376 KB Output is correct
13 Correct 103 ms 59188 KB Output is correct
14 Correct 95 ms 58792 KB Output is correct
15 Correct 203 ms 63928 KB Output is correct
16 Correct 469 ms 85428 KB Output is correct
17 Correct 109 ms 62064 KB Output is correct
18 Correct 147 ms 67208 KB Output is correct
19 Correct 116 ms 63580 KB Output is correct
20 Correct 113 ms 63224 KB Output is correct
21 Correct 135 ms 66556 KB Output is correct
22 Correct 79 ms 57500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31336 KB Output is correct
2 Correct 18 ms 31324 KB Output is correct
3 Correct 17 ms 31460 KB Output is correct
4 Correct 17 ms 31396 KB Output is correct
5 Correct 17 ms 31444 KB Output is correct
6 Correct 17 ms 31344 KB Output is correct
7 Correct 17 ms 31452 KB Output is correct
8 Correct 18 ms 31424 KB Output is correct
9 Correct 17 ms 31464 KB Output is correct
10 Correct 18 ms 31444 KB Output is correct
11 Correct 19 ms 31388 KB Output is correct
12 Correct 22 ms 31348 KB Output is correct
13 Correct 18 ms 31356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31336 KB Output is correct
2 Correct 18 ms 31324 KB Output is correct
3 Correct 17 ms 31460 KB Output is correct
4 Correct 17 ms 31396 KB Output is correct
5 Correct 17 ms 31444 KB Output is correct
6 Correct 17 ms 31344 KB Output is correct
7 Correct 17 ms 31452 KB Output is correct
8 Correct 18 ms 31424 KB Output is correct
9 Correct 17 ms 31464 KB Output is correct
10 Correct 18 ms 31444 KB Output is correct
11 Correct 19 ms 31388 KB Output is correct
12 Correct 22 ms 31348 KB Output is correct
13 Correct 18 ms 31356 KB Output is correct
14 Correct 16 ms 31292 KB Output is correct
15 Correct 16 ms 31316 KB Output is correct
16 Correct 17 ms 31352 KB Output is correct
17 Correct 17 ms 31452 KB Output is correct
18 Correct 19 ms 31352 KB Output is correct
19 Correct 16 ms 31316 KB Output is correct
20 Correct 17 ms 31452 KB Output is correct
21 Correct 21 ms 31444 KB Output is correct
22 Correct 20 ms 31444 KB Output is correct
23 Correct 18 ms 31444 KB Output is correct
24 Correct 17 ms 31324 KB Output is correct
25 Correct 17 ms 31352 KB Output is correct
26 Correct 18 ms 31316 KB Output is correct
27 Correct 18 ms 31464 KB Output is correct
28 Correct 16 ms 31316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31336 KB Output is correct
2 Correct 18 ms 31324 KB Output is correct
3 Correct 17 ms 31460 KB Output is correct
4 Correct 17 ms 31396 KB Output is correct
5 Correct 17 ms 31444 KB Output is correct
6 Correct 17 ms 31344 KB Output is correct
7 Correct 17 ms 31452 KB Output is correct
8 Correct 18 ms 31424 KB Output is correct
9 Correct 17 ms 31464 KB Output is correct
10 Correct 18 ms 31444 KB Output is correct
11 Correct 19 ms 31388 KB Output is correct
12 Correct 22 ms 31348 KB Output is correct
13 Correct 18 ms 31356 KB Output is correct
14 Correct 16 ms 31292 KB Output is correct
15 Correct 16 ms 31316 KB Output is correct
16 Correct 17 ms 31352 KB Output is correct
17 Correct 17 ms 31452 KB Output is correct
18 Correct 19 ms 31352 KB Output is correct
19 Correct 16 ms 31316 KB Output is correct
20 Correct 17 ms 31452 KB Output is correct
21 Correct 21 ms 31444 KB Output is correct
22 Correct 20 ms 31444 KB Output is correct
23 Correct 18 ms 31444 KB Output is correct
24 Correct 17 ms 31324 KB Output is correct
25 Correct 17 ms 31352 KB Output is correct
26 Correct 18 ms 31316 KB Output is correct
27 Correct 18 ms 31464 KB Output is correct
28 Correct 16 ms 31316 KB Output is correct
29 Correct 17 ms 31512 KB Output is correct
30 Correct 20 ms 31444 KB Output is correct
31 Correct 17 ms 31488 KB Output is correct
32 Correct 19 ms 31444 KB Output is correct
33 Correct 20 ms 31352 KB Output is correct
34 Correct 18 ms 31444 KB Output is correct
35 Correct 17 ms 31412 KB Output is correct
36 Correct 20 ms 31436 KB Output is correct
37 Correct 19 ms 31404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31336 KB Output is correct
2 Correct 18 ms 31324 KB Output is correct
3 Correct 17 ms 31460 KB Output is correct
4 Correct 17 ms 31396 KB Output is correct
5 Correct 17 ms 31444 KB Output is correct
6 Correct 17 ms 31344 KB Output is correct
7 Correct 17 ms 31452 KB Output is correct
8 Correct 18 ms 31424 KB Output is correct
9 Correct 17 ms 31464 KB Output is correct
10 Correct 18 ms 31444 KB Output is correct
11 Correct 19 ms 31388 KB Output is correct
12 Correct 22 ms 31348 KB Output is correct
13 Correct 18 ms 31356 KB Output is correct
14 Correct 16 ms 31292 KB Output is correct
15 Correct 16 ms 31316 KB Output is correct
16 Correct 17 ms 31352 KB Output is correct
17 Correct 17 ms 31452 KB Output is correct
18 Correct 19 ms 31352 KB Output is correct
19 Correct 16 ms 31316 KB Output is correct
20 Correct 17 ms 31452 KB Output is correct
21 Correct 21 ms 31444 KB Output is correct
22 Correct 20 ms 31444 KB Output is correct
23 Correct 18 ms 31444 KB Output is correct
24 Correct 17 ms 31324 KB Output is correct
25 Correct 17 ms 31352 KB Output is correct
26 Correct 18 ms 31316 KB Output is correct
27 Correct 18 ms 31464 KB Output is correct
28 Correct 16 ms 31316 KB Output is correct
29 Correct 17 ms 31512 KB Output is correct
30 Correct 20 ms 31444 KB Output is correct
31 Correct 17 ms 31488 KB Output is correct
32 Correct 19 ms 31444 KB Output is correct
33 Correct 20 ms 31352 KB Output is correct
34 Correct 18 ms 31444 KB Output is correct
35 Correct 17 ms 31412 KB Output is correct
36 Correct 20 ms 31436 KB Output is correct
37 Correct 19 ms 31404 KB Output is correct
38 Correct 38 ms 33512 KB Output is correct
39 Correct 58 ms 48372 KB Output is correct
40 Correct 45 ms 33384 KB Output is correct
41 Correct 44 ms 33140 KB Output is correct
42 Correct 39 ms 33484 KB Output is correct
43 Correct 46 ms 33196 KB Output is correct
44 Correct 25 ms 31828 KB Output is correct
45 Correct 72 ms 41868 KB Output is correct
46 Correct 68 ms 41708 KB Output is correct
47 Correct 67 ms 45464 KB Output is correct
48 Correct 52 ms 45416 KB Output is correct
49 Correct 60 ms 41852 KB Output is correct
50 Correct 58 ms 41892 KB Output is correct
51 Correct 52 ms 42912 KB Output is correct
52 Correct 60 ms 42976 KB Output is correct
53 Correct 26 ms 32476 KB Output is correct
54 Correct 79 ms 41748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 31316 KB Output is correct
2 Correct 16 ms 31332 KB Output is correct
3 Correct 16 ms 31336 KB Output is correct
4 Correct 17 ms 31324 KB Output is correct
5 Correct 22 ms 31444 KB Output is correct
6 Correct 17 ms 31448 KB Output is correct
7 Correct 18 ms 31376 KB Output is correct
8 Correct 16 ms 31312 KB Output is correct
9 Correct 16 ms 31332 KB Output is correct
10 Correct 17 ms 31332 KB Output is correct
11 Correct 17 ms 31336 KB Output is correct
12 Correct 21 ms 31384 KB Output is correct
13 Correct 41 ms 31980 KB Output is correct
14 Correct 45 ms 32276 KB Output is correct
15 Correct 51 ms 32052 KB Output is correct
16 Correct 81 ms 43416 KB Output is correct
17 Correct 256 ms 54404 KB Output is correct
18 Correct 654 ms 75000 KB Output is correct
19 Correct 96 ms 44924 KB Output is correct
20 Correct 87 ms 44784 KB Output is correct
21 Correct 91 ms 44940 KB Output is correct
22 Correct 210 ms 53704 KB Output is correct
23 Correct 162 ms 53064 KB Output is correct
24 Correct 210 ms 53784 KB Output is correct
25 Correct 164 ms 53996 KB Output is correct
26 Correct 192 ms 53944 KB Output is correct
27 Correct 254 ms 60896 KB Output is correct
28 Correct 235 ms 64932 KB Output is correct
29 Correct 213 ms 61964 KB Output is correct
30 Correct 136 ms 53140 KB Output is correct
31 Correct 135 ms 53524 KB Output is correct
32 Correct 156 ms 52376 KB Output is correct
33 Correct 127 ms 53492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 31316 KB Output is correct
2 Correct 16 ms 31332 KB Output is correct
3 Correct 15 ms 31316 KB Output is correct
4 Correct 23 ms 31704 KB Output is correct
5 Correct 35 ms 32152 KB Output is correct
6 Correct 17 ms 31336 KB Output is correct
7 Correct 17 ms 31408 KB Output is correct
8 Correct 16 ms 31492 KB Output is correct
9 Correct 45 ms 33768 KB Output is correct
10 Correct 51 ms 48364 KB Output is correct
11 Correct 26 ms 31564 KB Output is correct
12 Correct 49 ms 32376 KB Output is correct
13 Correct 103 ms 59188 KB Output is correct
14 Correct 95 ms 58792 KB Output is correct
15 Correct 203 ms 63928 KB Output is correct
16 Correct 469 ms 85428 KB Output is correct
17 Correct 109 ms 62064 KB Output is correct
18 Correct 147 ms 67208 KB Output is correct
19 Correct 116 ms 63580 KB Output is correct
20 Correct 113 ms 63224 KB Output is correct
21 Correct 135 ms 66556 KB Output is correct
22 Correct 79 ms 57500 KB Output is correct
23 Correct 17 ms 31336 KB Output is correct
24 Correct 18 ms 31324 KB Output is correct
25 Correct 17 ms 31460 KB Output is correct
26 Correct 17 ms 31396 KB Output is correct
27 Correct 17 ms 31444 KB Output is correct
28 Correct 17 ms 31344 KB Output is correct
29 Correct 17 ms 31452 KB Output is correct
30 Correct 18 ms 31424 KB Output is correct
31 Correct 17 ms 31464 KB Output is correct
32 Correct 18 ms 31444 KB Output is correct
33 Correct 19 ms 31388 KB Output is correct
34 Correct 22 ms 31348 KB Output is correct
35 Correct 18 ms 31356 KB Output is correct
36 Correct 16 ms 31292 KB Output is correct
37 Correct 16 ms 31316 KB Output is correct
38 Correct 17 ms 31352 KB Output is correct
39 Correct 17 ms 31452 KB Output is correct
40 Correct 19 ms 31352 KB Output is correct
41 Correct 16 ms 31316 KB Output is correct
42 Correct 17 ms 31452 KB Output is correct
43 Correct 21 ms 31444 KB Output is correct
44 Correct 20 ms 31444 KB Output is correct
45 Correct 18 ms 31444 KB Output is correct
46 Correct 17 ms 31324 KB Output is correct
47 Correct 17 ms 31352 KB Output is correct
48 Correct 18 ms 31316 KB Output is correct
49 Correct 18 ms 31464 KB Output is correct
50 Correct 16 ms 31316 KB Output is correct
51 Correct 17 ms 31512 KB Output is correct
52 Correct 20 ms 31444 KB Output is correct
53 Correct 17 ms 31488 KB Output is correct
54 Correct 19 ms 31444 KB Output is correct
55 Correct 20 ms 31352 KB Output is correct
56 Correct 18 ms 31444 KB Output is correct
57 Correct 17 ms 31412 KB Output is correct
58 Correct 20 ms 31436 KB Output is correct
59 Correct 19 ms 31404 KB Output is correct
60 Correct 38 ms 33512 KB Output is correct
61 Correct 58 ms 48372 KB Output is correct
62 Correct 45 ms 33384 KB Output is correct
63 Correct 44 ms 33140 KB Output is correct
64 Correct 39 ms 33484 KB Output is correct
65 Correct 46 ms 33196 KB Output is correct
66 Correct 25 ms 31828 KB Output is correct
67 Correct 72 ms 41868 KB Output is correct
68 Correct 68 ms 41708 KB Output is correct
69 Correct 67 ms 45464 KB Output is correct
70 Correct 52 ms 45416 KB Output is correct
71 Correct 60 ms 41852 KB Output is correct
72 Correct 58 ms 41892 KB Output is correct
73 Correct 52 ms 42912 KB Output is correct
74 Correct 60 ms 42976 KB Output is correct
75 Correct 26 ms 32476 KB Output is correct
76 Correct 79 ms 41748 KB Output is correct
77 Correct 16 ms 31316 KB Output is correct
78 Correct 16 ms 31332 KB Output is correct
79 Correct 16 ms 31336 KB Output is correct
80 Correct 17 ms 31324 KB Output is correct
81 Correct 22 ms 31444 KB Output is correct
82 Correct 17 ms 31448 KB Output is correct
83 Correct 18 ms 31376 KB Output is correct
84 Correct 16 ms 31312 KB Output is correct
85 Correct 16 ms 31332 KB Output is correct
86 Correct 17 ms 31332 KB Output is correct
87 Correct 17 ms 31336 KB Output is correct
88 Correct 21 ms 31384 KB Output is correct
89 Correct 41 ms 31980 KB Output is correct
90 Correct 45 ms 32276 KB Output is correct
91 Correct 51 ms 32052 KB Output is correct
92 Correct 81 ms 43416 KB Output is correct
93 Correct 256 ms 54404 KB Output is correct
94 Correct 654 ms 75000 KB Output is correct
95 Correct 96 ms 44924 KB Output is correct
96 Correct 87 ms 44784 KB Output is correct
97 Correct 91 ms 44940 KB Output is correct
98 Correct 210 ms 53704 KB Output is correct
99 Correct 162 ms 53064 KB Output is correct
100 Correct 210 ms 53784 KB Output is correct
101 Correct 164 ms 53996 KB Output is correct
102 Correct 192 ms 53944 KB Output is correct
103 Correct 254 ms 60896 KB Output is correct
104 Correct 235 ms 64932 KB Output is correct
105 Correct 213 ms 61964 KB Output is correct
106 Correct 136 ms 53140 KB Output is correct
107 Correct 135 ms 53524 KB Output is correct
108 Correct 156 ms 52376 KB Output is correct
109 Correct 127 ms 53492 KB Output is correct
110 Correct 46 ms 32336 KB Output is correct
111 Correct 31 ms 32080 KB Output is correct
112 Correct 238 ms 62712 KB Output is correct
113 Correct 67 ms 48616 KB Output is correct
114 Correct 155 ms 58304 KB Output is correct
115 Correct 47 ms 42016 KB Output is correct
116 Correct 124 ms 51016 KB Output is correct
117 Correct 1004 ms 85636 KB Output is correct
118 Correct 94 ms 41836 KB Output is correct
119 Correct 81 ms 41804 KB Output is correct
120 Correct 25 ms 33124 KB Output is correct
121 Correct 152 ms 52024 KB Output is correct
122 Correct 160 ms 52080 KB Output is correct
123 Correct 80 ms 50444 KB Output is correct
124 Correct 87 ms 52020 KB Output is correct
125 Correct 79 ms 50656 KB Output is correct
126 Correct 490 ms 83320 KB Output is correct
127 Correct 130 ms 59560 KB Output is correct
128 Correct 124 ms 59752 KB Output is correct
129 Correct 140 ms 60292 KB Output is correct
130 Correct 126 ms 59728 KB Output is correct