답안 #562142

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
562142 2022-05-14T06:28:44 Z piOOE 도로 폐쇄 (APIO21_roads) C++17
100 / 100
278 ms 56496 KB
#include "roads.h"

//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

#define all(x) begin(x), end(x)

typedef long long ll;

struct fenwick {
    vector<ll> t;
    int n;

    fenwick() = default;

    fenwick(int x) {
        n = x + 1;
        t.assign(n, 0);
    }

    void init(int x) {
        n = x + 1;
        t.assign(n, 0);
    }

    void add(int i, int x) {
        i += 1;
        for (; i < n; i += i & -i)
            t[i] += x;
    }

    ll get(int i) {
        ll ans = 0;
        i += 1;
        i = min(n - 1, i);
        for (; i > 0; i -= i & -i)
            ans += t[i];
        return ans;
    }


    int kth(int k) {
        if (k == 0) return -1;
        int i = 0;
        for (int j = 18; j > -1; --j) {
            if (i + (1 << j) < n && t[i + (1 << j)] < k) {
                i += (1 << j);
                k -= t[i];
            }
        }
        return i;
    }
};

vector<ll> stupid(int n, vector<int> A, vector<int> B, vector<int> W) {
    vector<ll> ans(n);
    vector<vector<pair<int, int>>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        g[A[i]].emplace_back(B[i], W[i]);
        g[B[i]].emplace_back(A[i], W[i]);
    }
    for (int k = 0; k < n; ++k) {
        vector<vector<ll>> dp(n + 1, vector<ll>(2));
        function<void(int, int)> dfs = [&](int v, int p) {
            vector<pair<int, int>> adj;
            for (auto [to, w]: g[v]) {
                if (to != p) {
                    dfs(to, v);
                    adj.emplace_back(to, w);
                }
            }
            if (k > (int) size(adj)) {
                vector<ll> nw;
                ll ans = 0;
                for (auto [to, w]: adj) {
                    ans += dp[to][0] + w;
                    nw.push_back(dp[to][1] - dp[to][0] - w);
                }
                sort(all(nw));
                for (int i = 0; i < (int) size(nw); ++i) {
                    if (nw[i] < 0)
                        ans += nw[i];
                }
                dp[v][1] = dp[v][0] = ans;
            } else {
                vector<ll> nw;
                ll ans = 0;
                for (auto [to, w]: adj) {
                    ans += dp[to][0] + w;
                    nw.push_back(dp[to][1] - dp[to][0] - w);
                }
                sort(all(nw));
                ll added = 0;
                for (int i = 0; i < k - 1; ++i) {
                    if (nw[i] < 0)
                        added += nw[i];
                }
                dp[v][1] = ans + added;
                added = 0;
                for (int i = 0; i < k; ++i) {
                    added += nw[i];
                }
                dp[v][0] = min(dp[v][1], ans + added);
            }
        };
        dfs(0, -1);
        ans[k] = dp[0][0];
    }
    return ans;
}


const int N = 100001;
int A[N], B[N], W[N], n, par[N], sz[N], wp[N], depth[N];
vector<pair<int, int>> g[N], gr[N];
fenwick f1[N], f2[N];
bool used[N];

ll dp[2][N], sm[N];

vector<ll> smart(int nn, vector<int> uu, vector<int> vv, vector<int> ww) {
    n = nn;
    for (int i = 0; i < n; ++i) {
        gr[i].clear(), g[i].clear();
        sm[i] = 0;
    }
    for (int i = 0; i < n - 1; ++i) {
        A[i] = uu[i], B[i] = vv[i], W[i] = ww[i];
        gr[A[i]].emplace_back(-W[i], B[i]);
        gr[B[i]].emplace_back(-W[i], A[i]);
    }
    for (int i = 0; i < n; ++i) {
        sort(all(gr[i]));
        sz[i] = (int) size(gr[i]);
        f1[i].init(sz[i]);
        f2[i].init(sz[i]);
    }
    vector<int> ord(n);
    iota(all(ord), 0);
    sort(all(ord), [](int i, int j) {
        return sz[i] > sz[j];
    });
    function<void(int, int, int)> prec = [&prec](int v, int p, int wep) {
        par[v] = p;
        wp[v] = wep;
        for (auto [w, to]: gr[v]) {
            if (to != p) {
                depth[to] = depth[v] + 1;
                prec(to, v, -w);
            }
        }
    };
    vector<ll> ans(n);
    prec(0, -1, 0);
    for (int k = 0; k < n; ++k) {
        vector<int> now;
        for (int i: ord) {
            if (sz[i] < k) break;
            if (sz[i] == k) {
                for (auto [w, to]: gr[i]) {
                    if (sz[to] <= sz[i]) continue;
                    int id = lower_bound(all(gr[to]), make_pair(w, i)) - begin(gr[to]);
                    assert(id < sz[to] && gr[to][id] == make_pair(w, i));
                    f1[to].add(id, 1);
                    f2[to].add(id, -w);
                    sm[to] += -w;
                }
                continue;
            }
            now.push_back(i);
            used[i] = true;
        }
        for (int x: now) {
            if (par[x] != -1 && used[par[x]]) {
                g[par[x]].emplace_back(x, wp[x]);
            }
        }
        const ll infL = 3e18;
        for (int x: now) used[x] = false;
        function<void(int, int)> dfs = [&](int v, int p) {
            used[v] = true;
            vector<pair<int, int>> adj;
            for (auto [to, w]: g[v]) {
                if (to != p) {
                    dfs(to, v);
                    adj.emplace_back(to, w);
                }
            }
            vector<ll> nw;
            ll sum = 0;
            for (auto [to, w]: adj) {
                nw.push_back(dp[1][to] - dp[0][to] - w);
                sum += dp[0][to] + w;
            }
            sort(all(nw));
            dp[1][v] = dp[0][v] = infL;
            for (int take = 0; take <= min(k, (int) size(nw)); ++take) {
                if (take) {
                    sum += nw[take - 1];
                }
                if (take < k) {
                    int id = f1[v].kth(k - take - 1);
                    ll added = sm[v] - f2[v].get(id);
                    dp[1][v] = min(dp[1][v], sum + added);
                }
                int id = f1[v].kth(k - take);
                ll added = sm[v] - f2[v].get(id);
                dp[0][v] = min(dp[0][v], sum + added);
            }
            dp[0][v] = min(dp[0][v], dp[1][v]);
        };
        sort(all(now), [](int i, int j) {
            return depth[i] < depth[j];
        });
        for (int v: now) {
            if (!used[v]) {
                dfs(v, -1);
                assert(dp[0][v] != infL);
                ans[k] += dp[0][v];
            }
        }
        for (int v: now) {
            used[v] = false;
            g[v].clear();
        }
    }
    return ans;
}

vector<ll> minimum_closure_costs(int nn, vector<int> uu, vector<int> vv, vector<int> ww) {
    n = nn;
    auto smar = smart(nn, uu, vv, ww);
//    auto stup = stupid(nn, uu, vv, ww);
//    if (stup != smar) {
//        cout << n << endl;
//        for (int i = 0; i < n - 1; ++i) {
//            cout << uu[i] << " " << vv[i] << " " << ww[i] << endl;
//        }
//        cout << endl;
//        cout << "stupid: ";
//        for (int x: stup) cout << x << " ";
//        cout << endl;
//        cout << "smart: ";
//        for (int x: smar) cout << x << " ";
//        cout << endl;
//        return {};
//        exit(0);
//    }
    return smar;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 11220 KB Output is correct
2 Correct 10 ms 11780 KB Output is correct
3 Correct 8 ms 11732 KB Output is correct
4 Correct 11 ms 11812 KB Output is correct
5 Correct 7 ms 11220 KB Output is correct
6 Correct 6 ms 11348 KB Output is correct
7 Correct 7 ms 11364 KB Output is correct
8 Correct 8 ms 11732 KB Output is correct
9 Correct 8 ms 11732 KB Output is correct
10 Correct 9 ms 11264 KB Output is correct
11 Correct 6 ms 11348 KB Output is correct
12 Correct 93 ms 26424 KB Output is correct
13 Correct 150 ms 36664 KB Output is correct
14 Correct 180 ms 33948 KB Output is correct
15 Correct 170 ms 36264 KB Output is correct
16 Correct 162 ms 36672 KB Output is correct
17 Correct 145 ms 36572 KB Output is correct
18 Correct 6 ms 11220 KB Output is correct
19 Correct 122 ms 34376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 11220 KB Output is correct
2 Correct 110 ms 48920 KB Output is correct
3 Correct 126 ms 53612 KB Output is correct
4 Correct 145 ms 56496 KB Output is correct
5 Correct 129 ms 56380 KB Output is correct
6 Correct 9 ms 12100 KB Output is correct
7 Correct 12 ms 12196 KB Output is correct
8 Correct 8 ms 12120 KB Output is correct
9 Correct 7 ms 11328 KB Output is correct
10 Correct 6 ms 11348 KB Output is correct
11 Correct 7 ms 11348 KB Output is correct
12 Correct 90 ms 38368 KB Output is correct
13 Correct 125 ms 56380 KB Output is correct
14 Correct 8 ms 11244 KB Output is correct
15 Correct 122 ms 52092 KB Output is correct
16 Correct 133 ms 56436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 11220 KB Output is correct
2 Correct 6 ms 11220 KB Output is correct
3 Correct 6 ms 11220 KB Output is correct
4 Correct 7 ms 11236 KB Output is correct
5 Correct 7 ms 11348 KB Output is correct
6 Correct 9 ms 11352 KB Output is correct
7 Correct 8 ms 11348 KB Output is correct
8 Correct 8 ms 11364 KB Output is correct
9 Correct 7 ms 11348 KB Output is correct
10 Correct 7 ms 11348 KB Output is correct
11 Correct 9 ms 11404 KB Output is correct
12 Correct 6 ms 11296 KB Output is correct
13 Correct 6 ms 11320 KB Output is correct
14 Correct 7 ms 11348 KB Output is correct
15 Correct 7 ms 11336 KB Output is correct
16 Correct 7 ms 11348 KB Output is correct
17 Correct 9 ms 11348 KB Output is correct
18 Correct 7 ms 11348 KB Output is correct
19 Correct 7 ms 11348 KB Output is correct
20 Correct 6 ms 11348 KB Output is correct
21 Correct 8 ms 11220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 11220 KB Output is correct
2 Correct 6 ms 11220 KB Output is correct
3 Correct 6 ms 11220 KB Output is correct
4 Correct 7 ms 11236 KB Output is correct
5 Correct 7 ms 11348 KB Output is correct
6 Correct 9 ms 11352 KB Output is correct
7 Correct 8 ms 11348 KB Output is correct
8 Correct 8 ms 11364 KB Output is correct
9 Correct 7 ms 11348 KB Output is correct
10 Correct 7 ms 11348 KB Output is correct
11 Correct 9 ms 11404 KB Output is correct
12 Correct 6 ms 11296 KB Output is correct
13 Correct 6 ms 11320 KB Output is correct
14 Correct 7 ms 11348 KB Output is correct
15 Correct 7 ms 11336 KB Output is correct
16 Correct 7 ms 11348 KB Output is correct
17 Correct 9 ms 11348 KB Output is correct
18 Correct 7 ms 11348 KB Output is correct
19 Correct 7 ms 11348 KB Output is correct
20 Correct 6 ms 11348 KB Output is correct
21 Correct 8 ms 11220 KB Output is correct
22 Correct 8 ms 11264 KB Output is correct
23 Correct 8 ms 11620 KB Output is correct
24 Correct 11 ms 11732 KB Output is correct
25 Correct 8 ms 11732 KB Output is correct
26 Correct 11 ms 11732 KB Output is correct
27 Correct 9 ms 11732 KB Output is correct
28 Correct 9 ms 11820 KB Output is correct
29 Correct 10 ms 11644 KB Output is correct
30 Correct 8 ms 11732 KB Output is correct
31 Correct 10 ms 11732 KB Output is correct
32 Correct 9 ms 11732 KB Output is correct
33 Correct 8 ms 12108 KB Output is correct
34 Correct 9 ms 12116 KB Output is correct
35 Correct 10 ms 12116 KB Output is correct
36 Correct 11 ms 11732 KB Output is correct
37 Correct 11 ms 11732 KB Output is correct
38 Correct 9 ms 11844 KB Output is correct
39 Correct 7 ms 11220 KB Output is correct
40 Correct 6 ms 11220 KB Output is correct
41 Correct 7 ms 11348 KB Output is correct
42 Correct 8 ms 11340 KB Output is correct
43 Correct 7 ms 11304 KB Output is correct
44 Correct 7 ms 11356 KB Output is correct
45 Correct 6 ms 11348 KB Output is correct
46 Correct 8 ms 11244 KB Output is correct
47 Correct 8 ms 11348 KB Output is correct
48 Correct 7 ms 11348 KB Output is correct
49 Correct 8 ms 11408 KB Output is correct
50 Correct 7 ms 11348 KB Output is correct
51 Correct 7 ms 11368 KB Output is correct
52 Correct 6 ms 11348 KB Output is correct
53 Correct 8 ms 11704 KB Output is correct
54 Correct 10 ms 11732 KB Output is correct
55 Correct 9 ms 11732 KB Output is correct
56 Correct 8 ms 11752 KB Output is correct
57 Correct 11 ms 11776 KB Output is correct
58 Correct 9 ms 11220 KB Output is correct
59 Correct 8 ms 11348 KB Output is correct
60 Correct 8 ms 11348 KB Output is correct
61 Correct 7 ms 11352 KB Output is correct
62 Correct 6 ms 11368 KB Output is correct
63 Correct 6 ms 11220 KB Output is correct
64 Correct 9 ms 11732 KB Output is correct
65 Correct 10 ms 11732 KB Output is correct
66 Correct 9 ms 11736 KB Output is correct
67 Correct 8 ms 11732 KB Output is correct
68 Correct 9 ms 11732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 278 ms 34044 KB Output is correct
2 Correct 221 ms 33596 KB Output is correct
3 Correct 165 ms 35236 KB Output is correct
4 Correct 274 ms 34584 KB Output is correct
5 Correct 151 ms 35184 KB Output is correct
6 Correct 162 ms 34184 KB Output is correct
7 Correct 225 ms 34728 KB Output is correct
8 Correct 139 ms 35160 KB Output is correct
9 Correct 222 ms 41540 KB Output is correct
10 Correct 218 ms 33992 KB Output is correct
11 Correct 176 ms 34924 KB Output is correct
12 Correct 149 ms 35424 KB Output is correct
13 Correct 6 ms 11220 KB Output is correct
14 Correct 121 ms 51968 KB Output is correct
15 Correct 120 ms 56472 KB Output is correct
16 Correct 12 ms 11804 KB Output is correct
17 Correct 8 ms 11804 KB Output is correct
18 Correct 7 ms 11732 KB Output is correct
19 Correct 10 ms 11732 KB Output is correct
20 Correct 10 ms 11732 KB Output is correct
21 Correct 149 ms 34352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 278 ms 34044 KB Output is correct
2 Correct 221 ms 33596 KB Output is correct
3 Correct 165 ms 35236 KB Output is correct
4 Correct 274 ms 34584 KB Output is correct
5 Correct 151 ms 35184 KB Output is correct
6 Correct 162 ms 34184 KB Output is correct
7 Correct 225 ms 34728 KB Output is correct
8 Correct 139 ms 35160 KB Output is correct
9 Correct 222 ms 41540 KB Output is correct
10 Correct 218 ms 33992 KB Output is correct
11 Correct 176 ms 34924 KB Output is correct
12 Correct 149 ms 35424 KB Output is correct
13 Correct 6 ms 11220 KB Output is correct
14 Correct 121 ms 51968 KB Output is correct
15 Correct 120 ms 56472 KB Output is correct
16 Correct 12 ms 11804 KB Output is correct
17 Correct 8 ms 11804 KB Output is correct
18 Correct 7 ms 11732 KB Output is correct
19 Correct 10 ms 11732 KB Output is correct
20 Correct 10 ms 11732 KB Output is correct
21 Correct 149 ms 34352 KB Output is correct
22 Correct 6 ms 11220 KB Output is correct
23 Correct 6 ms 11220 KB Output is correct
24 Correct 6 ms 11200 KB Output is correct
25 Correct 202 ms 31444 KB Output is correct
26 Correct 178 ms 29536 KB Output is correct
27 Correct 257 ms 34704 KB Output is correct
28 Correct 169 ms 35216 KB Output is correct
29 Correct 164 ms 33348 KB Output is correct
30 Correct 141 ms 33400 KB Output is correct
31 Correct 149 ms 34324 KB Output is correct
32 Correct 212 ms 32600 KB Output is correct
33 Correct 152 ms 35572 KB Output is correct
34 Correct 206 ms 34724 KB Output is correct
35 Correct 231 ms 42688 KB Output is correct
36 Correct 180 ms 34832 KB Output is correct
37 Correct 171 ms 35424 KB Output is correct
38 Correct 86 ms 38360 KB Output is correct
39 Correct 132 ms 56380 KB Output is correct
40 Correct 8 ms 11688 KB Output is correct
41 Correct 11 ms 11820 KB Output is correct
42 Correct 11 ms 11732 KB Output is correct
43 Correct 9 ms 11708 KB Output is correct
44 Correct 10 ms 11732 KB Output is correct
45 Correct 8 ms 11312 KB Output is correct
46 Correct 8 ms 11340 KB Output is correct
47 Correct 6 ms 11348 KB Output is correct
48 Correct 8 ms 11348 KB Output is correct
49 Correct 7 ms 11348 KB Output is correct
50 Correct 85 ms 26440 KB Output is correct
51 Correct 155 ms 36684 KB Output is correct
52 Correct 256 ms 33996 KB Output is correct
53 Correct 261 ms 33560 KB Output is correct
54 Correct 173 ms 35220 KB Output is correct
55 Correct 233 ms 34592 KB Output is correct
56 Correct 169 ms 35228 KB Output is correct
57 Correct 152 ms 34200 KB Output is correct
58 Correct 210 ms 34620 KB Output is correct
59 Correct 159 ms 35024 KB Output is correct
60 Correct 200 ms 41576 KB Output is correct
61 Correct 229 ms 34052 KB Output is correct
62 Correct 221 ms 34872 KB Output is correct
63 Correct 163 ms 35460 KB Output is correct
64 Correct 7 ms 11220 KB Output is correct
65 Correct 122 ms 52072 KB Output is correct
66 Correct 136 ms 56380 KB Output is correct
67 Correct 9 ms 11800 KB Output is correct
68 Correct 11 ms 11732 KB Output is correct
69 Correct 15 ms 11724 KB Output is correct
70 Correct 8 ms 11732 KB Output is correct
71 Correct 11 ms 11732 KB Output is correct
72 Correct 130 ms 34380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 11220 KB Output is correct
2 Correct 10 ms 11780 KB Output is correct
3 Correct 8 ms 11732 KB Output is correct
4 Correct 11 ms 11812 KB Output is correct
5 Correct 7 ms 11220 KB Output is correct
6 Correct 6 ms 11348 KB Output is correct
7 Correct 7 ms 11364 KB Output is correct
8 Correct 8 ms 11732 KB Output is correct
9 Correct 8 ms 11732 KB Output is correct
10 Correct 9 ms 11264 KB Output is correct
11 Correct 6 ms 11348 KB Output is correct
12 Correct 93 ms 26424 KB Output is correct
13 Correct 150 ms 36664 KB Output is correct
14 Correct 180 ms 33948 KB Output is correct
15 Correct 170 ms 36264 KB Output is correct
16 Correct 162 ms 36672 KB Output is correct
17 Correct 145 ms 36572 KB Output is correct
18 Correct 6 ms 11220 KB Output is correct
19 Correct 122 ms 34376 KB Output is correct
20 Correct 7 ms 11220 KB Output is correct
21 Correct 110 ms 48920 KB Output is correct
22 Correct 126 ms 53612 KB Output is correct
23 Correct 145 ms 56496 KB Output is correct
24 Correct 129 ms 56380 KB Output is correct
25 Correct 9 ms 12100 KB Output is correct
26 Correct 12 ms 12196 KB Output is correct
27 Correct 8 ms 12120 KB Output is correct
28 Correct 7 ms 11328 KB Output is correct
29 Correct 6 ms 11348 KB Output is correct
30 Correct 7 ms 11348 KB Output is correct
31 Correct 90 ms 38368 KB Output is correct
32 Correct 125 ms 56380 KB Output is correct
33 Correct 8 ms 11244 KB Output is correct
34 Correct 122 ms 52092 KB Output is correct
35 Correct 133 ms 56436 KB Output is correct
36 Correct 5 ms 11220 KB Output is correct
37 Correct 6 ms 11220 KB Output is correct
38 Correct 6 ms 11220 KB Output is correct
39 Correct 7 ms 11236 KB Output is correct
40 Correct 7 ms 11348 KB Output is correct
41 Correct 9 ms 11352 KB Output is correct
42 Correct 8 ms 11348 KB Output is correct
43 Correct 8 ms 11364 KB Output is correct
44 Correct 7 ms 11348 KB Output is correct
45 Correct 7 ms 11348 KB Output is correct
46 Correct 9 ms 11404 KB Output is correct
47 Correct 6 ms 11296 KB Output is correct
48 Correct 6 ms 11320 KB Output is correct
49 Correct 7 ms 11348 KB Output is correct
50 Correct 7 ms 11336 KB Output is correct
51 Correct 7 ms 11348 KB Output is correct
52 Correct 9 ms 11348 KB Output is correct
53 Correct 7 ms 11348 KB Output is correct
54 Correct 7 ms 11348 KB Output is correct
55 Correct 6 ms 11348 KB Output is correct
56 Correct 8 ms 11220 KB Output is correct
57 Correct 8 ms 11264 KB Output is correct
58 Correct 8 ms 11620 KB Output is correct
59 Correct 11 ms 11732 KB Output is correct
60 Correct 8 ms 11732 KB Output is correct
61 Correct 11 ms 11732 KB Output is correct
62 Correct 9 ms 11732 KB Output is correct
63 Correct 9 ms 11820 KB Output is correct
64 Correct 10 ms 11644 KB Output is correct
65 Correct 8 ms 11732 KB Output is correct
66 Correct 10 ms 11732 KB Output is correct
67 Correct 9 ms 11732 KB Output is correct
68 Correct 8 ms 12108 KB Output is correct
69 Correct 9 ms 12116 KB Output is correct
70 Correct 10 ms 12116 KB Output is correct
71 Correct 11 ms 11732 KB Output is correct
72 Correct 11 ms 11732 KB Output is correct
73 Correct 9 ms 11844 KB Output is correct
74 Correct 7 ms 11220 KB Output is correct
75 Correct 6 ms 11220 KB Output is correct
76 Correct 7 ms 11348 KB Output is correct
77 Correct 8 ms 11340 KB Output is correct
78 Correct 7 ms 11304 KB Output is correct
79 Correct 7 ms 11356 KB Output is correct
80 Correct 6 ms 11348 KB Output is correct
81 Correct 8 ms 11244 KB Output is correct
82 Correct 8 ms 11348 KB Output is correct
83 Correct 7 ms 11348 KB Output is correct
84 Correct 8 ms 11408 KB Output is correct
85 Correct 7 ms 11348 KB Output is correct
86 Correct 7 ms 11368 KB Output is correct
87 Correct 6 ms 11348 KB Output is correct
88 Correct 8 ms 11704 KB Output is correct
89 Correct 10 ms 11732 KB Output is correct
90 Correct 9 ms 11732 KB Output is correct
91 Correct 8 ms 11752 KB Output is correct
92 Correct 11 ms 11776 KB Output is correct
93 Correct 9 ms 11220 KB Output is correct
94 Correct 8 ms 11348 KB Output is correct
95 Correct 8 ms 11348 KB Output is correct
96 Correct 7 ms 11352 KB Output is correct
97 Correct 6 ms 11368 KB Output is correct
98 Correct 6 ms 11220 KB Output is correct
99 Correct 9 ms 11732 KB Output is correct
100 Correct 10 ms 11732 KB Output is correct
101 Correct 9 ms 11736 KB Output is correct
102 Correct 8 ms 11732 KB Output is correct
103 Correct 9 ms 11732 KB Output is correct
104 Correct 278 ms 34044 KB Output is correct
105 Correct 221 ms 33596 KB Output is correct
106 Correct 165 ms 35236 KB Output is correct
107 Correct 274 ms 34584 KB Output is correct
108 Correct 151 ms 35184 KB Output is correct
109 Correct 162 ms 34184 KB Output is correct
110 Correct 225 ms 34728 KB Output is correct
111 Correct 139 ms 35160 KB Output is correct
112 Correct 222 ms 41540 KB Output is correct
113 Correct 218 ms 33992 KB Output is correct
114 Correct 176 ms 34924 KB Output is correct
115 Correct 149 ms 35424 KB Output is correct
116 Correct 6 ms 11220 KB Output is correct
117 Correct 121 ms 51968 KB Output is correct
118 Correct 120 ms 56472 KB Output is correct
119 Correct 12 ms 11804 KB Output is correct
120 Correct 8 ms 11804 KB Output is correct
121 Correct 7 ms 11732 KB Output is correct
122 Correct 10 ms 11732 KB Output is correct
123 Correct 10 ms 11732 KB Output is correct
124 Correct 149 ms 34352 KB Output is correct
125 Correct 6 ms 11220 KB Output is correct
126 Correct 6 ms 11220 KB Output is correct
127 Correct 6 ms 11200 KB Output is correct
128 Correct 202 ms 31444 KB Output is correct
129 Correct 178 ms 29536 KB Output is correct
130 Correct 257 ms 34704 KB Output is correct
131 Correct 169 ms 35216 KB Output is correct
132 Correct 164 ms 33348 KB Output is correct
133 Correct 141 ms 33400 KB Output is correct
134 Correct 149 ms 34324 KB Output is correct
135 Correct 212 ms 32600 KB Output is correct
136 Correct 152 ms 35572 KB Output is correct
137 Correct 206 ms 34724 KB Output is correct
138 Correct 231 ms 42688 KB Output is correct
139 Correct 180 ms 34832 KB Output is correct
140 Correct 171 ms 35424 KB Output is correct
141 Correct 86 ms 38360 KB Output is correct
142 Correct 132 ms 56380 KB Output is correct
143 Correct 8 ms 11688 KB Output is correct
144 Correct 11 ms 11820 KB Output is correct
145 Correct 11 ms 11732 KB Output is correct
146 Correct 9 ms 11708 KB Output is correct
147 Correct 10 ms 11732 KB Output is correct
148 Correct 8 ms 11312 KB Output is correct
149 Correct 8 ms 11340 KB Output is correct
150 Correct 6 ms 11348 KB Output is correct
151 Correct 8 ms 11348 KB Output is correct
152 Correct 7 ms 11348 KB Output is correct
153 Correct 85 ms 26440 KB Output is correct
154 Correct 155 ms 36684 KB Output is correct
155 Correct 256 ms 33996 KB Output is correct
156 Correct 261 ms 33560 KB Output is correct
157 Correct 173 ms 35220 KB Output is correct
158 Correct 233 ms 34592 KB Output is correct
159 Correct 169 ms 35228 KB Output is correct
160 Correct 152 ms 34200 KB Output is correct
161 Correct 210 ms 34620 KB Output is correct
162 Correct 159 ms 35024 KB Output is correct
163 Correct 200 ms 41576 KB Output is correct
164 Correct 229 ms 34052 KB Output is correct
165 Correct 221 ms 34872 KB Output is correct
166 Correct 163 ms 35460 KB Output is correct
167 Correct 7 ms 11220 KB Output is correct
168 Correct 122 ms 52072 KB Output is correct
169 Correct 136 ms 56380 KB Output is correct
170 Correct 9 ms 11800 KB Output is correct
171 Correct 11 ms 11732 KB Output is correct
172 Correct 15 ms 11724 KB Output is correct
173 Correct 8 ms 11732 KB Output is correct
174 Correct 11 ms 11732 KB Output is correct
175 Correct 130 ms 34380 KB Output is correct
176 Correct 8 ms 11220 KB Output is correct
177 Correct 256 ms 34476 KB Output is correct
178 Correct 190 ms 29484 KB Output is correct
179 Correct 199 ms 35236 KB Output is correct
180 Correct 162 ms 33844 KB Output is correct
181 Correct 156 ms 35244 KB Output is correct
182 Correct 158 ms 35740 KB Output is correct
183 Correct 239 ms 34724 KB Output is correct
184 Correct 176 ms 33424 KB Output is correct
185 Correct 190 ms 33448 KB Output is correct
186 Correct 167 ms 32804 KB Output is correct
187 Correct 164 ms 36628 KB Output is correct
188 Correct 235 ms 33660 KB Output is correct
189 Correct 243 ms 32848 KB Output is correct
190 Correct 182 ms 34900 KB Output is correct
191 Correct 183 ms 34928 KB Output is correct
192 Correct 176 ms 35496 KB Output is correct
193 Correct 180 ms 35596 KB Output is correct
194 Correct 180 ms 34852 KB Output is correct
195 Correct 116 ms 48964 KB Output is correct
196 Correct 135 ms 53676 KB Output is correct
197 Correct 133 ms 56496 KB Output is correct
198 Correct 146 ms 56496 KB Output is correct
199 Correct 8 ms 11504 KB Output is correct
200 Correct 12 ms 11732 KB Output is correct
201 Correct 8 ms 11732 KB Output is correct
202 Correct 10 ms 11732 KB Output is correct
203 Correct 10 ms 11804 KB Output is correct
204 Correct 10 ms 11784 KB Output is correct
205 Correct 9 ms 11744 KB Output is correct
206 Correct 10 ms 11740 KB Output is correct
207 Correct 11 ms 11732 KB Output is correct
208 Correct 9 ms 11732 KB Output is correct
209 Correct 8 ms 11988 KB Output is correct
210 Correct 10 ms 12116 KB Output is correct
211 Correct 8 ms 12116 KB Output is correct
212 Correct 10 ms 11732 KB Output is correct
213 Correct 8 ms 11732 KB Output is correct
214 Correct 8 ms 11732 KB Output is correct
215 Correct 6 ms 11220 KB Output is correct
216 Correct 9 ms 11288 KB Output is correct
217 Correct 9 ms 11348 KB Output is correct
218 Correct 9 ms 11348 KB Output is correct
219 Correct 8 ms 11276 KB Output is correct
220 Correct 7 ms 11348 KB Output is correct
221 Correct 7 ms 11348 KB Output is correct
222 Correct 8 ms 11272 KB Output is correct
223 Correct 6 ms 11348 KB Output is correct
224 Correct 7 ms 11348 KB Output is correct
225 Correct 6 ms 11348 KB Output is correct
226 Correct 8 ms 11348 KB Output is correct
227 Correct 8 ms 11348 KB Output is correct
228 Correct 9 ms 11348 KB Output is correct
229 Correct 215 ms 31452 KB Output is correct
230 Correct 151 ms 29548 KB Output is correct
231 Correct 266 ms 34836 KB Output is correct
232 Correct 169 ms 35220 KB Output is correct
233 Correct 135 ms 33336 KB Output is correct
234 Correct 153 ms 33396 KB Output is correct
235 Correct 137 ms 34336 KB Output is correct
236 Correct 193 ms 32688 KB Output is correct
237 Correct 132 ms 35564 KB Output is correct
238 Correct 171 ms 34688 KB Output is correct
239 Correct 216 ms 42776 KB Output is correct
240 Correct 176 ms 34952 KB Output is correct
241 Correct 147 ms 35412 KB Output is correct
242 Correct 76 ms 38388 KB Output is correct
243 Correct 135 ms 56492 KB Output is correct
244 Correct 8 ms 11604 KB Output is correct
245 Correct 8 ms 11732 KB Output is correct
246 Correct 8 ms 11732 KB Output is correct
247 Correct 8 ms 11756 KB Output is correct
248 Correct 8 ms 11868 KB Output is correct
249 Correct 6 ms 11348 KB Output is correct
250 Correct 7 ms 11348 KB Output is correct
251 Correct 6 ms 11348 KB Output is correct
252 Correct 7 ms 11348 KB Output is correct
253 Correct 7 ms 11348 KB Output is correct
254 Correct 81 ms 26392 KB Output is correct
255 Correct 149 ms 36636 KB Output is correct
256 Correct 126 ms 33932 KB Output is correct
257 Correct 146 ms 36336 KB Output is correct
258 Correct 158 ms 36556 KB Output is correct
259 Correct 123 ms 36672 KB Output is correct
260 Correct 197 ms 33924 KB Output is correct
261 Correct 225 ms 33588 KB Output is correct
262 Correct 149 ms 35240 KB Output is correct
263 Correct 231 ms 34620 KB Output is correct
264 Correct 134 ms 35232 KB Output is correct
265 Correct 127 ms 34212 KB Output is correct
266 Correct 187 ms 34696 KB Output is correct
267 Correct 121 ms 35008 KB Output is correct
268 Correct 183 ms 41484 KB Output is correct
269 Correct 189 ms 33936 KB Output is correct
270 Correct 187 ms 34924 KB Output is correct
271 Correct 134 ms 35376 KB Output is correct
272 Correct 7 ms 11288 KB Output is correct
273 Correct 141 ms 51992 KB Output is correct
274 Correct 116 ms 56452 KB Output is correct
275 Correct 9 ms 11732 KB Output is correct
276 Correct 8 ms 11732 KB Output is correct
277 Correct 8 ms 11792 KB Output is correct
278 Correct 8 ms 11732 KB Output is correct
279 Correct 8 ms 11732 KB Output is correct
280 Correct 133 ms 34336 KB Output is correct