Submission #415335

# Submission time Handle Problem Language Result Execution time Memory
415335 2021-05-31T22:10:15 Z ja_kingy Road Closures (APIO21_roads) C++14
100 / 100
385 ms 40076 KB
#include "roads.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pii;
const int mxN = 1e5;
ll sm, par[mxN], is_root[mxN], dp[mxN][2], done[mxN], par_cost[mxN];
list<int> order;
vector<pii> adj[mxN];
vector<ll> ans;

struct dp_val {
    ll v, dp0, dp1;
    bool operator < (dp_val b) const {
        ll da = dp1 - dp0, db = b.dp1 - b.dp0;
        if (da != db) return da > db;
        return v < b.v;
    }
};

set<dp_val> bestk[mxN], extra[mxN];

void dfs(int u, int p, int pc) {
    par[u] = p;
    par_cost[u] = pc;
    for (pii v: adj[u]) if (v.first != p) {
        dfs(v.first, u, v.second);
    }
    order.push_back(u);
}

void check_k(int u, int k) {
    if (bestk[u].size() < k && extra[u].size()) {
        auto fst = extra[u].begin();
        dp[u][0] -= fst->dp0;
        dp[u][0] += max(fst->dp1, fst->dp0);
        bestk[u].insert(*fst);
        extra[u].erase(fst);
    } 
    if (bestk[u].size() > k) {
        auto lst = bestk[u].end();
        lst--;
        dp[u][0] -= max(lst->dp1, lst->dp0);
        dp[u][0] += lst->dp0;
        extra[u].insert(*lst);
        bestk[u].erase(lst);
    }
    if (bestk[u].size() && extra[u].size()) {
        auto fst = extra[u].begin();
        auto lst = bestk[u].end();
        lst--;
        if (*fst < *lst) {
            dp[u][0] -= fst->dp0;
            dp[u][0] += max(fst->dp1, fst->dp0);
            bestk[u].insert(*fst);
            extra[u].erase(fst);
            dp[u][0] -= max(lst->dp1, lst->dp0);
            dp[u][0] += lst->dp0;
            extra[u].insert(*lst);
            bestk[u].erase(lst);
        }
    }
    if (bestk[u].size()) {
        auto lst = bestk[u].end();
        lst--;
        dp[u][1] = dp[u][0] - max(lst->dp1 - lst->dp0, 0ll) + par_cost[u];
    } else if (k) {
        dp[u][1] = par_cost[u];
    }
}

void erase_val(int u, int k, dp_val val) {
    auto v = bestk[u].find(val);
    if (v != bestk[u].end()) {
        dp[u][0] -= max(v->dp1, v->dp0);
        bestk[u].erase(v);
    } else {
        dp[u][0] -= val.dp0;
        extra[u].erase(val);
    }
    check_k(u, k);
}

void upd(int u, int k, dp_val val) {
    bestk[u].insert(val);
    dp[u][0] += max(val.dp1, val.dp0); 
    check_k(u, k);
}

vector<ll> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W) {
    ans.resize(N);
    for (int i = 0; i < N-1; ++i) {
        adj[U[i]].push_back({V[i],W[i]});
        sm += W[i];
        adj[V[i]].push_back({U[i],W[i]});
    }
    dfs(0, -1, 0);
    is_root[0] = 1;
    for (int k = 0; k < N-1; ++k) {
        for (auto it = order.begin(); it != order.end();) {
            int u = *it;
            check_k(u, k);
            if (adj[u].size() == k) {
                done[u] = 1;
                for (pii v: adj[u]) {
                    if (done[v.first]) {
                        sm -= v.second;
                    } else {
                        upd(v.first, k, {u, 0, v.second});
                        if (par[v.first] == u) {
                            is_root[v.first] = 1;
                            ans[k] -= dp[v.first][0];
                        }
                    }
                }
                it = order.erase(it);
            } else if (is_root[u]) {
                ans[k] -= dp[u][0];
                it++;
            } else {
                upd(par[u], k, {u, dp[u][0], dp[u][1]});
                it++;
            }
        }
        for (auto it = order.rbegin(); it != order.rend(); it++) { 
            int u = *it;
            if (!is_root[u]) erase_val(par[u], k, {u, dp[u][0], dp[u][1]});
        }
        ans[k] += sm;
    }
    return ans;
}

Compilation message

roads.cpp: In function 'void check_k(int, int)':
roads.cpp:34:25: warning: comparison of integer expressions of different signedness: 'std::set<dp_val>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     if (bestk[u].size() < k && extra[u].size()) {
      |         ~~~~~~~~~~~~~~~~^~~
roads.cpp:41:25: warning: comparison of integer expressions of different signedness: 'std::set<dp_val>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |     if (bestk[u].size() > k) {
      |         ~~~~~~~~~~~~~~~~^~~
roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:104:31: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  104 |             if (adj[u].size() == k) {
      |                 ~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 11980 KB Output is correct
2 Correct 13 ms 12492 KB Output is correct
3 Correct 13 ms 12472 KB Output is correct
4 Correct 13 ms 12548 KB Output is correct
5 Correct 8 ms 11980 KB Output is correct
6 Correct 9 ms 12108 KB Output is correct
7 Correct 11 ms 12108 KB Output is correct
8 Correct 10 ms 12332 KB Output is correct
9 Correct 12 ms 12492 KB Output is correct
10 Correct 9 ms 12104 KB Output is correct
11 Correct 8 ms 11980 KB Output is correct
12 Correct 168 ms 25304 KB Output is correct
13 Correct 316 ms 34256 KB Output is correct
14 Correct 237 ms 32628 KB Output is correct
15 Correct 258 ms 34764 KB Output is correct
16 Correct 301 ms 35228 KB Output is correct
17 Correct 282 ms 35260 KB Output is correct
18 Correct 9 ms 11980 KB Output is correct
19 Correct 262 ms 31952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 99 ms 35168 KB Output is correct
3 Correct 140 ms 38180 KB Output is correct
4 Correct 136 ms 39992 KB Output is correct
5 Correct 157 ms 40076 KB Output is correct
6 Correct 11 ms 12460 KB Output is correct
7 Correct 11 ms 12496 KB Output is correct
8 Correct 11 ms 12492 KB Output is correct
9 Correct 8 ms 12108 KB Output is correct
10 Correct 8 ms 12108 KB Output is correct
11 Correct 8 ms 12108 KB Output is correct
12 Correct 69 ms 28352 KB Output is correct
13 Correct 115 ms 39164 KB Output is correct
14 Correct 7 ms 12048 KB Output is correct
15 Correct 98 ms 36420 KB Output is correct
16 Correct 111 ms 39180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12008 KB Output is correct
2 Correct 7 ms 11964 KB Output is correct
3 Correct 9 ms 11980 KB Output is correct
4 Correct 8 ms 11980 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 9 ms 12032 KB Output is correct
7 Correct 11 ms 12048 KB Output is correct
8 Correct 9 ms 12084 KB Output is correct
9 Correct 11 ms 12148 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 8 ms 12036 KB Output is correct
12 Correct 9 ms 12108 KB Output is correct
13 Correct 8 ms 11980 KB Output is correct
14 Correct 8 ms 12064 KB Output is correct
15 Correct 8 ms 12108 KB Output is correct
16 Correct 9 ms 12064 KB Output is correct
17 Correct 8 ms 11996 KB Output is correct
18 Correct 8 ms 11980 KB Output is correct
19 Correct 8 ms 12072 KB Output is correct
20 Correct 8 ms 12108 KB Output is correct
21 Correct 11 ms 12036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12008 KB Output is correct
2 Correct 7 ms 11964 KB Output is correct
3 Correct 9 ms 11980 KB Output is correct
4 Correct 8 ms 11980 KB Output is correct
5 Correct 8 ms 12108 KB Output is correct
6 Correct 9 ms 12032 KB Output is correct
7 Correct 11 ms 12048 KB Output is correct
8 Correct 9 ms 12084 KB Output is correct
9 Correct 11 ms 12148 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 8 ms 12036 KB Output is correct
12 Correct 9 ms 12108 KB Output is correct
13 Correct 8 ms 11980 KB Output is correct
14 Correct 8 ms 12064 KB Output is correct
15 Correct 8 ms 12108 KB Output is correct
16 Correct 9 ms 12064 KB Output is correct
17 Correct 8 ms 11996 KB Output is correct
18 Correct 8 ms 11980 KB Output is correct
19 Correct 8 ms 12072 KB Output is correct
20 Correct 8 ms 12108 KB Output is correct
21 Correct 11 ms 12036 KB Output is correct
22 Correct 8 ms 11980 KB Output is correct
23 Correct 10 ms 12332 KB Output is correct
24 Correct 12 ms 12492 KB Output is correct
25 Correct 12 ms 12476 KB Output is correct
26 Correct 10 ms 12492 KB Output is correct
27 Correct 13 ms 12516 KB Output is correct
28 Correct 14 ms 12492 KB Output is correct
29 Correct 10 ms 12492 KB Output is correct
30 Correct 13 ms 12492 KB Output is correct
31 Correct 11 ms 12492 KB Output is correct
32 Correct 12 ms 12492 KB Output is correct
33 Correct 10 ms 12492 KB Output is correct
34 Correct 10 ms 12600 KB Output is correct
35 Correct 11 ms 12492 KB Output is correct
36 Correct 13 ms 12492 KB Output is correct
37 Correct 11 ms 12468 KB Output is correct
38 Correct 12 ms 12492 KB Output is correct
39 Correct 9 ms 12028 KB Output is correct
40 Correct 9 ms 11988 KB Output is correct
41 Correct 8 ms 12100 KB Output is correct
42 Correct 9 ms 12064 KB Output is correct
43 Correct 9 ms 11980 KB Output is correct
44 Correct 7 ms 12108 KB Output is correct
45 Correct 8 ms 12076 KB Output is correct
46 Correct 9 ms 12108 KB Output is correct
47 Correct 8 ms 12108 KB Output is correct
48 Correct 8 ms 12108 KB Output is correct
49 Correct 8 ms 12112 KB Output is correct
50 Correct 7 ms 11980 KB Output is correct
51 Correct 9 ms 11980 KB Output is correct
52 Correct 7 ms 11980 KB Output is correct
53 Correct 11 ms 12364 KB Output is correct
54 Correct 10 ms 12464 KB Output is correct
55 Correct 13 ms 12620 KB Output is correct
56 Correct 11 ms 12364 KB Output is correct
57 Correct 15 ms 12448 KB Output is correct
58 Correct 9 ms 11980 KB Output is correct
59 Correct 9 ms 12108 KB Output is correct
60 Correct 9 ms 12084 KB Output is correct
61 Correct 7 ms 11980 KB Output is correct
62 Correct 8 ms 12108 KB Output is correct
63 Correct 8 ms 11988 KB Output is correct
64 Correct 10 ms 12472 KB Output is correct
65 Correct 12 ms 12492 KB Output is correct
66 Correct 11 ms 12468 KB Output is correct
67 Correct 11 ms 12492 KB Output is correct
68 Correct 11 ms 12476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 35760 KB Output is correct
2 Correct 326 ms 35268 KB Output is correct
3 Correct 327 ms 35844 KB Output is correct
4 Correct 278 ms 36504 KB Output is correct
5 Correct 286 ms 35484 KB Output is correct
6 Correct 314 ms 34624 KB Output is correct
7 Correct 306 ms 36676 KB Output is correct
8 Correct 233 ms 32836 KB Output is correct
9 Correct 317 ms 35272 KB Output is correct
10 Correct 338 ms 36028 KB Output is correct
11 Correct 322 ms 35908 KB Output is correct
12 Correct 296 ms 34568 KB Output is correct
13 Correct 8 ms 11980 KB Output is correct
14 Correct 136 ms 36420 KB Output is correct
15 Correct 110 ms 39112 KB Output is correct
16 Correct 10 ms 12492 KB Output is correct
17 Correct 14 ms 12572 KB Output is correct
18 Correct 14 ms 12484 KB Output is correct
19 Correct 14 ms 12396 KB Output is correct
20 Correct 12 ms 12456 KB Output is correct
21 Correct 291 ms 32052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 35760 KB Output is correct
2 Correct 326 ms 35268 KB Output is correct
3 Correct 327 ms 35844 KB Output is correct
4 Correct 278 ms 36504 KB Output is correct
5 Correct 286 ms 35484 KB Output is correct
6 Correct 314 ms 34624 KB Output is correct
7 Correct 306 ms 36676 KB Output is correct
8 Correct 233 ms 32836 KB Output is correct
9 Correct 317 ms 35272 KB Output is correct
10 Correct 338 ms 36028 KB Output is correct
11 Correct 322 ms 35908 KB Output is correct
12 Correct 296 ms 34568 KB Output is correct
13 Correct 8 ms 11980 KB Output is correct
14 Correct 136 ms 36420 KB Output is correct
15 Correct 110 ms 39112 KB Output is correct
16 Correct 10 ms 12492 KB Output is correct
17 Correct 14 ms 12572 KB Output is correct
18 Correct 14 ms 12484 KB Output is correct
19 Correct 14 ms 12396 KB Output is correct
20 Correct 12 ms 12456 KB Output is correct
21 Correct 291 ms 32052 KB Output is correct
22 Correct 8 ms 11980 KB Output is correct
23 Correct 9 ms 11980 KB Output is correct
24 Correct 7 ms 11980 KB Output is correct
25 Correct 240 ms 33120 KB Output is correct
26 Correct 218 ms 31120 KB Output is correct
27 Correct 343 ms 36616 KB Output is correct
28 Correct 335 ms 35908 KB Output is correct
29 Correct 269 ms 33704 KB Output is correct
30 Correct 284 ms 33744 KB Output is correct
31 Correct 329 ms 34164 KB Output is correct
32 Correct 308 ms 34612 KB Output is correct
33 Correct 295 ms 33432 KB Output is correct
34 Correct 378 ms 36756 KB Output is correct
35 Correct 341 ms 37008 KB Output is correct
36 Correct 287 ms 35852 KB Output is correct
37 Correct 284 ms 34656 KB Output is correct
38 Correct 75 ms 28228 KB Output is correct
39 Correct 116 ms 39108 KB Output is correct
40 Correct 10 ms 12364 KB Output is correct
41 Correct 13 ms 12492 KB Output is correct
42 Correct 14 ms 12468 KB Output is correct
43 Correct 12 ms 12336 KB Output is correct
44 Correct 12 ms 12492 KB Output is correct
45 Correct 10 ms 12092 KB Output is correct
46 Correct 9 ms 11980 KB Output is correct
47 Correct 10 ms 11988 KB Output is correct
48 Correct 8 ms 11980 KB Output is correct
49 Correct 8 ms 12028 KB Output is correct
50 Correct 149 ms 25348 KB Output is correct
51 Correct 300 ms 34064 KB Output is correct
52 Correct 328 ms 35780 KB Output is correct
53 Correct 268 ms 35348 KB Output is correct
54 Correct 291 ms 35964 KB Output is correct
55 Correct 359 ms 36568 KB Output is correct
56 Correct 298 ms 35540 KB Output is correct
57 Correct 317 ms 34576 KB Output is correct
58 Correct 309 ms 36732 KB Output is correct
59 Correct 285 ms 32888 KB Output is correct
60 Correct 348 ms 35232 KB Output is correct
61 Correct 351 ms 35908 KB Output is correct
62 Correct 302 ms 35864 KB Output is correct
63 Correct 305 ms 34484 KB Output is correct
64 Correct 8 ms 12068 KB Output is correct
65 Correct 105 ms 36500 KB Output is correct
66 Correct 109 ms 39108 KB Output is correct
67 Correct 12 ms 12492 KB Output is correct
68 Correct 13 ms 12492 KB Output is correct
69 Correct 11 ms 12492 KB Output is correct
70 Correct 12 ms 12512 KB Output is correct
71 Correct 13 ms 12472 KB Output is correct
72 Correct 270 ms 32016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 11980 KB Output is correct
2 Correct 13 ms 12492 KB Output is correct
3 Correct 13 ms 12472 KB Output is correct
4 Correct 13 ms 12548 KB Output is correct
5 Correct 8 ms 11980 KB Output is correct
6 Correct 9 ms 12108 KB Output is correct
7 Correct 11 ms 12108 KB Output is correct
8 Correct 10 ms 12332 KB Output is correct
9 Correct 12 ms 12492 KB Output is correct
10 Correct 9 ms 12104 KB Output is correct
11 Correct 8 ms 11980 KB Output is correct
12 Correct 168 ms 25304 KB Output is correct
13 Correct 316 ms 34256 KB Output is correct
14 Correct 237 ms 32628 KB Output is correct
15 Correct 258 ms 34764 KB Output is correct
16 Correct 301 ms 35228 KB Output is correct
17 Correct 282 ms 35260 KB Output is correct
18 Correct 9 ms 11980 KB Output is correct
19 Correct 262 ms 31952 KB Output is correct
20 Correct 7 ms 11980 KB Output is correct
21 Correct 99 ms 35168 KB Output is correct
22 Correct 140 ms 38180 KB Output is correct
23 Correct 136 ms 39992 KB Output is correct
24 Correct 157 ms 40076 KB Output is correct
25 Correct 11 ms 12460 KB Output is correct
26 Correct 11 ms 12496 KB Output is correct
27 Correct 11 ms 12492 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 8 ms 12108 KB Output is correct
30 Correct 8 ms 12108 KB Output is correct
31 Correct 69 ms 28352 KB Output is correct
32 Correct 115 ms 39164 KB Output is correct
33 Correct 7 ms 12048 KB Output is correct
34 Correct 98 ms 36420 KB Output is correct
35 Correct 111 ms 39180 KB Output is correct
36 Correct 7 ms 12008 KB Output is correct
37 Correct 7 ms 11964 KB Output is correct
38 Correct 9 ms 11980 KB Output is correct
39 Correct 8 ms 11980 KB Output is correct
40 Correct 8 ms 12108 KB Output is correct
41 Correct 9 ms 12032 KB Output is correct
42 Correct 11 ms 12048 KB Output is correct
43 Correct 9 ms 12084 KB Output is correct
44 Correct 11 ms 12148 KB Output is correct
45 Correct 7 ms 12108 KB Output is correct
46 Correct 8 ms 12036 KB Output is correct
47 Correct 9 ms 12108 KB Output is correct
48 Correct 8 ms 11980 KB Output is correct
49 Correct 8 ms 12064 KB Output is correct
50 Correct 8 ms 12108 KB Output is correct
51 Correct 9 ms 12064 KB Output is correct
52 Correct 8 ms 11996 KB Output is correct
53 Correct 8 ms 11980 KB Output is correct
54 Correct 8 ms 12072 KB Output is correct
55 Correct 8 ms 12108 KB Output is correct
56 Correct 11 ms 12036 KB Output is correct
57 Correct 8 ms 11980 KB Output is correct
58 Correct 10 ms 12332 KB Output is correct
59 Correct 12 ms 12492 KB Output is correct
60 Correct 12 ms 12476 KB Output is correct
61 Correct 10 ms 12492 KB Output is correct
62 Correct 13 ms 12516 KB Output is correct
63 Correct 14 ms 12492 KB Output is correct
64 Correct 10 ms 12492 KB Output is correct
65 Correct 13 ms 12492 KB Output is correct
66 Correct 11 ms 12492 KB Output is correct
67 Correct 12 ms 12492 KB Output is correct
68 Correct 10 ms 12492 KB Output is correct
69 Correct 10 ms 12600 KB Output is correct
70 Correct 11 ms 12492 KB Output is correct
71 Correct 13 ms 12492 KB Output is correct
72 Correct 11 ms 12468 KB Output is correct
73 Correct 12 ms 12492 KB Output is correct
74 Correct 9 ms 12028 KB Output is correct
75 Correct 9 ms 11988 KB Output is correct
76 Correct 8 ms 12100 KB Output is correct
77 Correct 9 ms 12064 KB Output is correct
78 Correct 9 ms 11980 KB Output is correct
79 Correct 7 ms 12108 KB Output is correct
80 Correct 8 ms 12076 KB Output is correct
81 Correct 9 ms 12108 KB Output is correct
82 Correct 8 ms 12108 KB Output is correct
83 Correct 8 ms 12108 KB Output is correct
84 Correct 8 ms 12112 KB Output is correct
85 Correct 7 ms 11980 KB Output is correct
86 Correct 9 ms 11980 KB Output is correct
87 Correct 7 ms 11980 KB Output is correct
88 Correct 11 ms 12364 KB Output is correct
89 Correct 10 ms 12464 KB Output is correct
90 Correct 13 ms 12620 KB Output is correct
91 Correct 11 ms 12364 KB Output is correct
92 Correct 15 ms 12448 KB Output is correct
93 Correct 9 ms 11980 KB Output is correct
94 Correct 9 ms 12108 KB Output is correct
95 Correct 9 ms 12084 KB Output is correct
96 Correct 7 ms 11980 KB Output is correct
97 Correct 8 ms 12108 KB Output is correct
98 Correct 8 ms 11988 KB Output is correct
99 Correct 10 ms 12472 KB Output is correct
100 Correct 12 ms 12492 KB Output is correct
101 Correct 11 ms 12468 KB Output is correct
102 Correct 11 ms 12492 KB Output is correct
103 Correct 11 ms 12476 KB Output is correct
104 Correct 316 ms 35760 KB Output is correct
105 Correct 326 ms 35268 KB Output is correct
106 Correct 327 ms 35844 KB Output is correct
107 Correct 278 ms 36504 KB Output is correct
108 Correct 286 ms 35484 KB Output is correct
109 Correct 314 ms 34624 KB Output is correct
110 Correct 306 ms 36676 KB Output is correct
111 Correct 233 ms 32836 KB Output is correct
112 Correct 317 ms 35272 KB Output is correct
113 Correct 338 ms 36028 KB Output is correct
114 Correct 322 ms 35908 KB Output is correct
115 Correct 296 ms 34568 KB Output is correct
116 Correct 8 ms 11980 KB Output is correct
117 Correct 136 ms 36420 KB Output is correct
118 Correct 110 ms 39112 KB Output is correct
119 Correct 10 ms 12492 KB Output is correct
120 Correct 14 ms 12572 KB Output is correct
121 Correct 14 ms 12484 KB Output is correct
122 Correct 14 ms 12396 KB Output is correct
123 Correct 12 ms 12456 KB Output is correct
124 Correct 291 ms 32052 KB Output is correct
125 Correct 8 ms 11980 KB Output is correct
126 Correct 9 ms 11980 KB Output is correct
127 Correct 7 ms 11980 KB Output is correct
128 Correct 240 ms 33120 KB Output is correct
129 Correct 218 ms 31120 KB Output is correct
130 Correct 343 ms 36616 KB Output is correct
131 Correct 335 ms 35908 KB Output is correct
132 Correct 269 ms 33704 KB Output is correct
133 Correct 284 ms 33744 KB Output is correct
134 Correct 329 ms 34164 KB Output is correct
135 Correct 308 ms 34612 KB Output is correct
136 Correct 295 ms 33432 KB Output is correct
137 Correct 378 ms 36756 KB Output is correct
138 Correct 341 ms 37008 KB Output is correct
139 Correct 287 ms 35852 KB Output is correct
140 Correct 284 ms 34656 KB Output is correct
141 Correct 75 ms 28228 KB Output is correct
142 Correct 116 ms 39108 KB Output is correct
143 Correct 10 ms 12364 KB Output is correct
144 Correct 13 ms 12492 KB Output is correct
145 Correct 14 ms 12468 KB Output is correct
146 Correct 12 ms 12336 KB Output is correct
147 Correct 12 ms 12492 KB Output is correct
148 Correct 10 ms 12092 KB Output is correct
149 Correct 9 ms 11980 KB Output is correct
150 Correct 10 ms 11988 KB Output is correct
151 Correct 8 ms 11980 KB Output is correct
152 Correct 8 ms 12028 KB Output is correct
153 Correct 149 ms 25348 KB Output is correct
154 Correct 300 ms 34064 KB Output is correct
155 Correct 328 ms 35780 KB Output is correct
156 Correct 268 ms 35348 KB Output is correct
157 Correct 291 ms 35964 KB Output is correct
158 Correct 359 ms 36568 KB Output is correct
159 Correct 298 ms 35540 KB Output is correct
160 Correct 317 ms 34576 KB Output is correct
161 Correct 309 ms 36732 KB Output is correct
162 Correct 285 ms 32888 KB Output is correct
163 Correct 348 ms 35232 KB Output is correct
164 Correct 351 ms 35908 KB Output is correct
165 Correct 302 ms 35864 KB Output is correct
166 Correct 305 ms 34484 KB Output is correct
167 Correct 8 ms 12068 KB Output is correct
168 Correct 105 ms 36500 KB Output is correct
169 Correct 109 ms 39108 KB Output is correct
170 Correct 12 ms 12492 KB Output is correct
171 Correct 13 ms 12492 KB Output is correct
172 Correct 11 ms 12492 KB Output is correct
173 Correct 12 ms 12512 KB Output is correct
174 Correct 13 ms 12472 KB Output is correct
175 Correct 270 ms 32016 KB Output is correct
176 Correct 7 ms 11980 KB Output is correct
177 Correct 275 ms 36996 KB Output is correct
178 Correct 263 ms 31420 KB Output is correct
179 Correct 343 ms 35848 KB Output is correct
180 Correct 296 ms 34820 KB Output is correct
181 Correct 322 ms 36384 KB Output is correct
182 Correct 385 ms 35780 KB Output is correct
183 Correct 375 ms 36788 KB Output is correct
184 Correct 300 ms 34504 KB Output is correct
185 Correct 294 ms 34468 KB Output is correct
186 Correct 309 ms 33536 KB Output is correct
187 Correct 304 ms 35312 KB Output is correct
188 Correct 253 ms 35388 KB Output is correct
189 Correct 248 ms 35500 KB Output is correct
190 Correct 293 ms 37652 KB Output is correct
191 Correct 264 ms 35908 KB Output is correct
192 Correct 276 ms 35320 KB Output is correct
193 Correct 291 ms 35352 KB Output is correct
194 Correct 338 ms 36796 KB Output is correct
195 Correct 99 ms 35260 KB Output is correct
196 Correct 114 ms 38188 KB Output is correct
197 Correct 120 ms 39944 KB Output is correct
198 Correct 119 ms 40004 KB Output is correct
199 Correct 9 ms 12364 KB Output is correct
200 Correct 10 ms 12472 KB Output is correct
201 Correct 10 ms 12424 KB Output is correct
202 Correct 14 ms 12536 KB Output is correct
203 Correct 14 ms 12492 KB Output is correct
204 Correct 13 ms 12468 KB Output is correct
205 Correct 18 ms 12492 KB Output is correct
206 Correct 11 ms 12464 KB Output is correct
207 Correct 13 ms 12492 KB Output is correct
208 Correct 14 ms 12464 KB Output is correct
209 Correct 10 ms 12492 KB Output is correct
210 Correct 12 ms 12492 KB Output is correct
211 Correct 12 ms 12492 KB Output is correct
212 Correct 15 ms 12524 KB Output is correct
213 Correct 13 ms 12472 KB Output is correct
214 Correct 12 ms 12548 KB Output is correct
215 Correct 10 ms 12068 KB Output is correct
216 Correct 9 ms 11980 KB Output is correct
217 Correct 9 ms 12068 KB Output is correct
218 Correct 7 ms 12108 KB Output is correct
219 Correct 9 ms 12108 KB Output is correct
220 Correct 11 ms 11980 KB Output is correct
221 Correct 10 ms 12108 KB Output is correct
222 Correct 8 ms 12108 KB Output is correct
223 Correct 8 ms 12108 KB Output is correct
224 Correct 9 ms 12108 KB Output is correct
225 Correct 10 ms 12116 KB Output is correct
226 Correct 10 ms 12100 KB Output is correct
227 Correct 10 ms 12108 KB Output is correct
228 Correct 8 ms 11980 KB Output is correct
229 Correct 276 ms 33140 KB Output is correct
230 Correct 271 ms 31032 KB Output is correct
231 Correct 282 ms 36628 KB Output is correct
232 Correct 327 ms 35908 KB Output is correct
233 Correct 289 ms 33812 KB Output is correct
234 Correct 365 ms 33732 KB Output is correct
235 Correct 305 ms 34288 KB Output is correct
236 Correct 283 ms 34632 KB Output is correct
237 Correct 276 ms 33344 KB Output is correct
238 Correct 315 ms 36756 KB Output is correct
239 Correct 349 ms 37144 KB Output is correct
240 Correct 343 ms 35908 KB Output is correct
241 Correct 313 ms 34684 KB Output is correct
242 Correct 72 ms 28360 KB Output is correct
243 Correct 115 ms 39196 KB Output is correct
244 Correct 10 ms 12360 KB Output is correct
245 Correct 13 ms 12492 KB Output is correct
246 Correct 12 ms 12492 KB Output is correct
247 Correct 10 ms 12364 KB Output is correct
248 Correct 13 ms 12512 KB Output is correct
249 Correct 13 ms 11996 KB Output is correct
250 Correct 12 ms 12108 KB Output is correct
251 Correct 8 ms 12108 KB Output is correct
252 Correct 10 ms 11980 KB Output is correct
253 Correct 8 ms 12108 KB Output is correct
254 Correct 154 ms 25428 KB Output is correct
255 Correct 342 ms 34188 KB Output is correct
256 Correct 273 ms 32628 KB Output is correct
257 Correct 273 ms 34804 KB Output is correct
258 Correct 290 ms 35184 KB Output is correct
259 Correct 310 ms 35316 KB Output is correct
260 Correct 291 ms 35832 KB Output is correct
261 Correct 258 ms 35292 KB Output is correct
262 Correct 317 ms 35992 KB Output is correct
263 Correct 285 ms 36624 KB Output is correct
264 Correct 321 ms 35524 KB Output is correct
265 Correct 304 ms 34572 KB Output is correct
266 Correct 311 ms 36628 KB Output is correct
267 Correct 271 ms 32724 KB Output is correct
268 Correct 272 ms 35124 KB Output is correct
269 Correct 363 ms 35936 KB Output is correct
270 Correct 296 ms 35868 KB Output is correct
271 Correct 306 ms 34620 KB Output is correct
272 Correct 10 ms 11980 KB Output is correct
273 Correct 104 ms 36420 KB Output is correct
274 Correct 111 ms 39096 KB Output is correct
275 Correct 11 ms 12492 KB Output is correct
276 Correct 13 ms 12492 KB Output is correct
277 Correct 12 ms 12540 KB Output is correct
278 Correct 13 ms 12492 KB Output is correct
279 Correct 13 ms 12468 KB Output is correct
280 Correct 277 ms 32156 KB Output is correct