#include <bits/stdc++.h>
#include "closing.h"
#define ar array
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
const ll INF = 1e18;
int max_score(int n, int X, int Y, long long K,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
vector<vector<ar<int, 2>>> adj(n+1);
for (int i = 0; i < n-1; i++) {
adj[U[i]].push_back({V[i], W[i]});
adj[V[i]].push_back({U[i], W[i]});
}
vector<vector<ll>> d(2, vector<ll>(n, INF));
vector<int> p(n, -1);
auto dfs = [&](auto&& s, int v, vector<ll>& dist) -> void {
for (auto [u, w] : adj[v]) if (u != p[v]) {
p[u] = v, dist[u] = dist[v] + w;
s(s, u, dist);
}
};
d[0][X] = 0, d[1][Y] = 0;
dfs(dfs, X, d[0]);
fill(all(p), -1);
dfs(dfs, Y, d[1]);
if (d[0][Y] > 2*K) {
vector<ll> D(2*n);
for (int i = 0; i < n; i++) D[i] = d[0][i], D[i+n] = d[1][i];
sort(all(D));
int ans = 0;
for (auto x : D) {
if (K - x >= 0) {
K -= x, ans++;
}
else break;
}
return ans;
}
vector<vector<ar<ll, 4>>> dp(n, vector<ar<ll, 4>>(2*n+1, {INF, INF, INF, INF}));
vector<int> tin(n), tout(n), sub(n);
int timer = 0;
auto dfs3 = [&](auto&& s, int v, int px) -> void {
tin[v] = timer++, sub[v] = 1;
for (auto [u, w] : adj[v]) if (u != px) {
s(s, u, v);
sub[v] += sub[u];
}
tout[v] = timer-1;
};
dfs3(dfs3, X, -1);
auto anc = [&](int x, int y) {
return tin[x] <= tin[y] && tout[y] <= tout[x];
};
auto dfs2 = [&](auto&& s, int v, int px) -> void {
dp[v][0][0] = 0;
dp[v][1][1] = d[0][v];
dp[v][1][2] = d[1][v];
dp[v][2][3] = max(d[0][v], d[1][v]);
int tot = 2;
sort(all(adj[v]), [&](auto x, auto y) { return anc(x[0], Y) != anc(y[0], Y) ? anc(x[0], Y) : x[0] < y[0]; });
for (auto [u, w] : adj[v]) if (u != px) {
s(s, u, v);
assert(tot <= 2*n);
for (int i = tot; i >= 0; i--) {
for (int j = 2*sub[u]; j >= 0; j--) {
assert(i+j<=2*n);
ckmin(dp[v][i+j][0], dp[v][i][0] + dp[u][j][0]);
if (anc(u, Y)) ckmin(dp[v][i+j][0], dp[v][i][0] + dp[u][j][2]);
ckmin(dp[v][i+j][1], dp[v][i][1] + dp[u][j][0]);
ckmin(dp[v][i+j][1], dp[v][i][1] + dp[u][j][1]);
if (anc(u, Y)) {
ckmin(dp[v][i+j][1], dp[v][i][1] + dp[u][j][2]);
ckmin(dp[v][i+j][1], dp[v][i][1] + dp[u][j][3]);
}
if (anc(u, Y)) {
if (i == 1) dp[v][i+j][2] = dp[v][i][2] + dp[u][j][2];
}
else {
ckmin(dp[v][i+j][2], dp[v][i][2] + dp[u][j][0]);
ckmin(dp[v][i+j][2], dp[v][i][2] + dp[u][j][2]);
}
if (anc(u, Y)) {
if (i == 2) dp[v][i+j][3] = dp[v][i][3] + min(dp[u][j][2], dp[u][j][3]);
}
else {
ckmin(dp[v][i+j][3], dp[v][i][3] + dp[u][j][0]);
ckmin(dp[v][i+j][3], dp[v][i][3] + dp[u][j][1]);
ckmin(dp[v][i+j][3], dp[v][i][3] + dp[u][j][2]);
ckmin(dp[v][i+j][3], dp[v][i][3] + dp[u][j][3]);
}
}
}
tot += 2*sub[u];
}
};
dfs2(dfs2, X, -1);
int ans = 0;
for (int j = 1; j <= 2*n; j++) for (int k = 0; k < 4; k++) if (dp[X][j][k] <= K) ckmax(ans, j);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
30516 KB |
Output is correct |
2 |
Correct |
113 ms |
33192 KB |
Output is correct |
3 |
Correct |
76 ms |
5472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
572 KB |
Output is correct |
12 |
Correct |
1 ms |
856 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
352 KB |
Output is correct |
19 |
Correct |
12 ms |
16248 KB |
Output is correct |
20 |
Correct |
10 ms |
13656 KB |
Output is correct |
21 |
Correct |
9 ms |
14764 KB |
Output is correct |
22 |
Correct |
11 ms |
16144 KB |
Output is correct |
23 |
Correct |
10 ms |
16112 KB |
Output is correct |
24 |
Correct |
12 ms |
16224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
572 KB |
Output is correct |
12 |
Correct |
1 ms |
856 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
352 KB |
Output is correct |
19 |
Correct |
12 ms |
16248 KB |
Output is correct |
20 |
Correct |
10 ms |
13656 KB |
Output is correct |
21 |
Correct |
9 ms |
14764 KB |
Output is correct |
22 |
Correct |
11 ms |
16144 KB |
Output is correct |
23 |
Correct |
10 ms |
16112 KB |
Output is correct |
24 |
Correct |
12 ms |
16224 KB |
Output is correct |
25 |
Correct |
4 ms |
648 KB |
Output is correct |
26 |
Correct |
357 ms |
566096 KB |
Output is correct |
27 |
Correct |
321 ms |
492712 KB |
Output is correct |
28 |
Correct |
313 ms |
496296 KB |
Output is correct |
29 |
Correct |
332 ms |
539664 KB |
Output is correct |
30 |
Correct |
325 ms |
490324 KB |
Output is correct |
31 |
Correct |
331 ms |
566168 KB |
Output is correct |
32 |
Correct |
344 ms |
566168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
572 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
860 KB |
Output is correct |
40 |
Correct |
1 ms |
860 KB |
Output is correct |
41 |
Correct |
1 ms |
860 KB |
Output is correct |
42 |
Correct |
1 ms |
860 KB |
Output is correct |
43 |
Correct |
1 ms |
860 KB |
Output is correct |
44 |
Correct |
1 ms |
860 KB |
Output is correct |
45 |
Correct |
1 ms |
860 KB |
Output is correct |
46 |
Correct |
1 ms |
856 KB |
Output is correct |
47 |
Correct |
1 ms |
860 KB |
Output is correct |
48 |
Correct |
1 ms |
856 KB |
Output is correct |
49 |
Correct |
1 ms |
604 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
572 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
352 KB |
Output is correct |
20 |
Correct |
12 ms |
16248 KB |
Output is correct |
21 |
Correct |
10 ms |
13656 KB |
Output is correct |
22 |
Correct |
9 ms |
14764 KB |
Output is correct |
23 |
Correct |
11 ms |
16144 KB |
Output is correct |
24 |
Correct |
10 ms |
16112 KB |
Output is correct |
25 |
Correct |
12 ms |
16224 KB |
Output is correct |
26 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
1 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
860 KB |
Output is correct |
47 |
Correct |
1 ms |
860 KB |
Output is correct |
48 |
Correct |
1 ms |
860 KB |
Output is correct |
49 |
Correct |
1 ms |
860 KB |
Output is correct |
50 |
Correct |
1 ms |
860 KB |
Output is correct |
51 |
Correct |
1 ms |
860 KB |
Output is correct |
52 |
Correct |
1 ms |
860 KB |
Output is correct |
53 |
Correct |
1 ms |
856 KB |
Output is correct |
54 |
Correct |
1 ms |
860 KB |
Output is correct |
55 |
Correct |
1 ms |
856 KB |
Output is correct |
56 |
Correct |
1 ms |
604 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
2 ms |
972 KB |
Output is correct |
60 |
Correct |
2 ms |
860 KB |
Output is correct |
61 |
Correct |
2 ms |
1864 KB |
Output is correct |
62 |
Correct |
3 ms |
1864 KB |
Output is correct |
63 |
Correct |
10 ms |
16048 KB |
Output is correct |
64 |
Correct |
9 ms |
13916 KB |
Output is correct |
65 |
Correct |
8 ms |
13148 KB |
Output is correct |
66 |
Correct |
10 ms |
14172 KB |
Output is correct |
67 |
Correct |
9 ms |
15960 KB |
Output is correct |
68 |
Correct |
10 ms |
13404 KB |
Output is correct |
69 |
Correct |
10 ms |
15964 KB |
Output is correct |
70 |
Correct |
13 ms |
14684 KB |
Output is correct |
71 |
Correct |
10 ms |
14428 KB |
Output is correct |
72 |
Correct |
9 ms |
15072 KB |
Output is correct |
73 |
Correct |
6 ms |
10040 KB |
Output is correct |
74 |
Correct |
11 ms |
10960 KB |
Output is correct |
75 |
Correct |
2 ms |
936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
572 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
352 KB |
Output is correct |
20 |
Correct |
12 ms |
16248 KB |
Output is correct |
21 |
Correct |
10 ms |
13656 KB |
Output is correct |
22 |
Correct |
9 ms |
14764 KB |
Output is correct |
23 |
Correct |
11 ms |
16144 KB |
Output is correct |
24 |
Correct |
10 ms |
16112 KB |
Output is correct |
25 |
Correct |
12 ms |
16224 KB |
Output is correct |
26 |
Correct |
4 ms |
648 KB |
Output is correct |
27 |
Correct |
357 ms |
566096 KB |
Output is correct |
28 |
Correct |
321 ms |
492712 KB |
Output is correct |
29 |
Correct |
313 ms |
496296 KB |
Output is correct |
30 |
Correct |
332 ms |
539664 KB |
Output is correct |
31 |
Correct |
325 ms |
490324 KB |
Output is correct |
32 |
Correct |
331 ms |
566168 KB |
Output is correct |
33 |
Correct |
344 ms |
566168 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
1 ms |
344 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
860 KB |
Output is correct |
55 |
Correct |
1 ms |
860 KB |
Output is correct |
56 |
Correct |
1 ms |
860 KB |
Output is correct |
57 |
Correct |
1 ms |
860 KB |
Output is correct |
58 |
Correct |
1 ms |
860 KB |
Output is correct |
59 |
Correct |
1 ms |
860 KB |
Output is correct |
60 |
Correct |
1 ms |
860 KB |
Output is correct |
61 |
Correct |
1 ms |
856 KB |
Output is correct |
62 |
Correct |
1 ms |
860 KB |
Output is correct |
63 |
Correct |
1 ms |
856 KB |
Output is correct |
64 |
Correct |
1 ms |
604 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
2 ms |
972 KB |
Output is correct |
68 |
Correct |
2 ms |
860 KB |
Output is correct |
69 |
Correct |
2 ms |
1864 KB |
Output is correct |
70 |
Correct |
3 ms |
1864 KB |
Output is correct |
71 |
Correct |
10 ms |
16048 KB |
Output is correct |
72 |
Correct |
9 ms |
13916 KB |
Output is correct |
73 |
Correct |
8 ms |
13148 KB |
Output is correct |
74 |
Correct |
10 ms |
14172 KB |
Output is correct |
75 |
Correct |
9 ms |
15960 KB |
Output is correct |
76 |
Correct |
10 ms |
13404 KB |
Output is correct |
77 |
Correct |
10 ms |
15964 KB |
Output is correct |
78 |
Correct |
13 ms |
14684 KB |
Output is correct |
79 |
Correct |
10 ms |
14428 KB |
Output is correct |
80 |
Correct |
9 ms |
15072 KB |
Output is correct |
81 |
Correct |
6 ms |
10040 KB |
Output is correct |
82 |
Correct |
11 ms |
10960 KB |
Output is correct |
83 |
Correct |
2 ms |
936 KB |
Output is correct |
84 |
Correct |
8 ms |
640 KB |
Output is correct |
85 |
Correct |
43 ms |
5244 KB |
Output is correct |
86 |
Correct |
11 ms |
1232 KB |
Output is correct |
87 |
Correct |
27 ms |
1896 KB |
Output is correct |
88 |
Correct |
14 ms |
1968 KB |
Output is correct |
89 |
Correct |
373 ms |
565896 KB |
Output is correct |
90 |
Correct |
299 ms |
468820 KB |
Output is correct |
91 |
Correct |
298 ms |
563284 KB |
Output is correct |
92 |
Correct |
298 ms |
491528 KB |
Output is correct |
93 |
Correct |
276 ms |
496856 KB |
Output is correct |
94 |
Correct |
308 ms |
515744 KB |
Output is correct |
95 |
Correct |
331 ms |
540400 KB |
Output is correct |
96 |
Correct |
317 ms |
472296 KB |
Output is correct |
97 |
Correct |
347 ms |
538960 KB |
Output is correct |
98 |
Correct |
300 ms |
520016 KB |
Output is correct |
99 |
Correct |
340 ms |
565912 KB |
Output is correct |
100 |
Correct |
174 ms |
276376 KB |
Output is correct |
101 |
Correct |
38 ms |
16184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
572 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
352 KB |
Output is correct |
20 |
Correct |
12 ms |
16248 KB |
Output is correct |
21 |
Correct |
10 ms |
13656 KB |
Output is correct |
22 |
Correct |
9 ms |
14764 KB |
Output is correct |
23 |
Correct |
11 ms |
16144 KB |
Output is correct |
24 |
Correct |
10 ms |
16112 KB |
Output is correct |
25 |
Correct |
12 ms |
16224 KB |
Output is correct |
26 |
Correct |
4 ms |
648 KB |
Output is correct |
27 |
Correct |
357 ms |
566096 KB |
Output is correct |
28 |
Correct |
321 ms |
492712 KB |
Output is correct |
29 |
Correct |
313 ms |
496296 KB |
Output is correct |
30 |
Correct |
332 ms |
539664 KB |
Output is correct |
31 |
Correct |
325 ms |
490324 KB |
Output is correct |
32 |
Correct |
331 ms |
566168 KB |
Output is correct |
33 |
Correct |
344 ms |
566168 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
1 ms |
344 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
860 KB |
Output is correct |
55 |
Correct |
1 ms |
860 KB |
Output is correct |
56 |
Correct |
1 ms |
860 KB |
Output is correct |
57 |
Correct |
1 ms |
860 KB |
Output is correct |
58 |
Correct |
1 ms |
860 KB |
Output is correct |
59 |
Correct |
1 ms |
860 KB |
Output is correct |
60 |
Correct |
1 ms |
860 KB |
Output is correct |
61 |
Correct |
1 ms |
856 KB |
Output is correct |
62 |
Correct |
1 ms |
860 KB |
Output is correct |
63 |
Correct |
1 ms |
856 KB |
Output is correct |
64 |
Correct |
1 ms |
604 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
2 ms |
972 KB |
Output is correct |
68 |
Correct |
2 ms |
860 KB |
Output is correct |
69 |
Correct |
2 ms |
1864 KB |
Output is correct |
70 |
Correct |
3 ms |
1864 KB |
Output is correct |
71 |
Correct |
10 ms |
16048 KB |
Output is correct |
72 |
Correct |
9 ms |
13916 KB |
Output is correct |
73 |
Correct |
8 ms |
13148 KB |
Output is correct |
74 |
Correct |
10 ms |
14172 KB |
Output is correct |
75 |
Correct |
9 ms |
15960 KB |
Output is correct |
76 |
Correct |
10 ms |
13404 KB |
Output is correct |
77 |
Correct |
10 ms |
15964 KB |
Output is correct |
78 |
Correct |
13 ms |
14684 KB |
Output is correct |
79 |
Correct |
10 ms |
14428 KB |
Output is correct |
80 |
Correct |
9 ms |
15072 KB |
Output is correct |
81 |
Correct |
6 ms |
10040 KB |
Output is correct |
82 |
Correct |
11 ms |
10960 KB |
Output is correct |
83 |
Correct |
2 ms |
936 KB |
Output is correct |
84 |
Correct |
8 ms |
640 KB |
Output is correct |
85 |
Correct |
43 ms |
5244 KB |
Output is correct |
86 |
Correct |
11 ms |
1232 KB |
Output is correct |
87 |
Correct |
27 ms |
1896 KB |
Output is correct |
88 |
Correct |
14 ms |
1968 KB |
Output is correct |
89 |
Correct |
373 ms |
565896 KB |
Output is correct |
90 |
Correct |
299 ms |
468820 KB |
Output is correct |
91 |
Correct |
298 ms |
563284 KB |
Output is correct |
92 |
Correct |
298 ms |
491528 KB |
Output is correct |
93 |
Correct |
276 ms |
496856 KB |
Output is correct |
94 |
Correct |
308 ms |
515744 KB |
Output is correct |
95 |
Correct |
331 ms |
540400 KB |
Output is correct |
96 |
Correct |
317 ms |
472296 KB |
Output is correct |
97 |
Correct |
347 ms |
538960 KB |
Output is correct |
98 |
Correct |
300 ms |
520016 KB |
Output is correct |
99 |
Correct |
340 ms |
565912 KB |
Output is correct |
100 |
Correct |
174 ms |
276376 KB |
Output is correct |
101 |
Correct |
38 ms |
16184 KB |
Output is correct |
102 |
Correct |
574 ms |
3708 KB |
Output is correct |
103 |
Execution timed out |
1051 ms |
13008 KB |
Time limit exceeded |
104 |
Halted |
0 ms |
0 KB |
- |