#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 202020;
long long dx[MAXN], dy[MAXN];
vector<pair<int, int>> g[MAXN];
void dfs_x(int p, int v) {
for (auto [w, x] : g[v]) if (p != x) {
dx[x] = dx[v] + w;
dfs_x(v, x);
}
}
void dfs_y(int p, int v) {
for (auto [w, x] : g[v]) if (p != x) {
dy[x] = dy[v] + w;
dfs_y(v, x);
}
}
int max_score(int N, int X, int Y, long long K,
vector<int> U, vector<int> V, vector<int> W)
{
for (int i = 0; i < N - 1; i++) {
g[U[i]].push_back({W[i], V[i]});
g[V[i]].push_back({W[i], U[i]});
}
dx[X] = 0;
dy[Y] = 0;
dfs_x(-1, X);
dfs_y(-1, Y);
long long D = dx[Y];
long long vx = X;
long long vy = Y;
long long tx = 0;
long long ty = 0;
for (int i = 0; i < N; i++) {
if (dx[i] + dy[i] == D) {
if (dx[i] <= dy[i] && tx < dx[i]) {
vx = i;
tx = dx[i];
}
if (dx[i] > dy[i] && ty < dy[i]) {
vy = i;
ty = dy[i];
}
}
}
// no overlap
priority_queue<tuple<long long, int, int, int>> pq;
pq.push({0, X, -1, 0});
pq.push({0, Y, -1, 1});
int ans1 = 0;
long long tk = K;
while (!pq.empty()) {
auto [c, v, p, t] = pq.top();
pq.pop();
c = -c;
if (c > K) break;
K -= c;
++ans1;
for (auto [w, x] : g[v]) if (p != x) {
if ((v == vx && x == vy) || (v == vy && x == vx)) continue;
if (t == 0)
pq.push({-dx[x], x, v, 0});
else
pq.push({-dy[x], x, v, 1});
}
}
// yes overlap
K = tk;
int ans2 = 0;
for (int i = 0; i < N; i++) {
if (dx[i] + dy[i] == D) {
K -= min(dx[i], dy[i]);
++ans2;
}
}
if (K >= 0) {
vector<long long> t1;
vector<pair<long long, long long>> t2;
for (int i = 0; i < N; i++) {
if (dx[i] + dy[i] == D) {
if (dx[i] <= dy[i]) t1.push_back(dy[i] - dx[i]);
else t1.push_back(dx[i] - dy[i]);
}
else {
if (dx[i] <= dy[i]) {
if (dx[i] <= dy[i] - dx[i]) {
t1.push_back(dx[i]);
t1.push_back(dy[i] - dx[i]);
}
else t2.push_back({dx[i], dy[i]});
}
else {
if (dy[i] <= dx[i] - dy[i]) {
t1.push_back(dy[i]);
t1.push_back(dx[i] - dy[i]);
}
else t2.push_back({dy[i], dx[i]});
}
}
}
sort(t1.begin(), t1.end());
sort(t2.begin(), t2.end(), [&](auto p, auto q) {
return p.second < q.second;
});
for (int i = 1; i < t1.size(); i++) t1[i] += t1[i - 1];
int s = upper_bound(t1.begin(), t1.end(), K) - t1.begin();
int sz = t2.size();
if (sz != 0) {
vector<long long> pre(sz), suf(sz), sum(sz);
pre[0] = t2[0].second - t2[0].first;
sum[0] = t2[0].second;
for (int i = 1; i < sz; i++) {
pre[i] = max(pre[i - 1], t2[i].second - t2[i].first);
sum[i] = sum[i - 1] + t2[i].second;
}
suf[sz - 1] = t2[sz - 1].first;
for (int i = sz - 1; i > 0; i--) {
suf[i - 1] = min(suf[i], t2[i - 1].first);
}
if (suf[0] <= K) {
s = max(s, 1 + (int)(upper_bound(t1.begin(), t1.end(), K - suf[0]) - t1.begin()));
}
for (int i = 0; i < sz; i++) {
if (sum[i] - pre[i] <= K)
s = max(s, 2 * i + 1 + (int)(upper_bound(t1.begin(), t1.end(), K - sum[i] + pre[i]) - t1.begin()));
if (sum[i] <= K)
s = max(s, 2 * i + 2 + (int)(upper_bound(t1.begin(), t1.end(), K - sum[i]) - t1.begin()));
if (i != sz - 1 && sum[i] + suf[i + 1] <= K)
s = max(s, 2 * i + 3 + (int)(upper_bound(t1.begin(), t1.end(), K - sum[i] - suf[i + 1]) - t1.begin()));
}
}
ans1 = max(ans1, ans2 + s);
}
for (int i = 0; i < N; i++) {
g[i].clear();
}
return ans1;
}
Compilation message
closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:109:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
109 | for (int i = 1; i < t1.size(); i++) t1[i] += t1[i - 1];
| ~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
22372 KB |
Output is correct |
2 |
Correct |
88 ms |
24396 KB |
Output is correct |
3 |
Correct |
50 ms |
7532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
14 |
Correct |
4 ms |
4948 KB |
Output is correct |
15 |
Correct |
2 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
2 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
5076 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
2 ms |
5076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
14 |
Correct |
4 ms |
4948 KB |
Output is correct |
15 |
Correct |
2 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
2 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
5076 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
2 ms |
5076 KB |
Output is correct |
25 |
Correct |
4 ms |
5076 KB |
Output is correct |
26 |
Correct |
3 ms |
5460 KB |
Output is correct |
27 |
Correct |
3 ms |
5460 KB |
Output is correct |
28 |
Correct |
4 ms |
5332 KB |
Output is correct |
29 |
Correct |
4 ms |
5332 KB |
Output is correct |
30 |
Correct |
3 ms |
5332 KB |
Output is correct |
31 |
Correct |
3 ms |
5324 KB |
Output is correct |
32 |
Correct |
3 ms |
5332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
14 |
Correct |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
2 ms |
4948 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
2 ms |
5056 KB |
Output is correct |
20 |
Correct |
2 ms |
5052 KB |
Output is correct |
21 |
Correct |
2 ms |
4948 KB |
Output is correct |
22 |
Correct |
2 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
4948 KB |
Output is correct |
24 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
4948 KB |
Output is correct |
14 |
Correct |
2 ms |
4948 KB |
Output is correct |
15 |
Correct |
4 ms |
4948 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
2 ms |
4948 KB |
Output is correct |
20 |
Correct |
2 ms |
4948 KB |
Output is correct |
21 |
Correct |
2 ms |
4948 KB |
Output is correct |
22 |
Correct |
2 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
4948 KB |
Output is correct |
24 |
Correct |
2 ms |
4948 KB |
Output is correct |
25 |
Correct |
2 ms |
4948 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
2 ms |
4948 KB |
Output is correct |
28 |
Correct |
2 ms |
4948 KB |
Output is correct |
29 |
Correct |
3 ms |
4948 KB |
Output is correct |
30 |
Correct |
2 ms |
4948 KB |
Output is correct |
31 |
Correct |
2 ms |
5056 KB |
Output is correct |
32 |
Correct |
2 ms |
5052 KB |
Output is correct |
33 |
Correct |
2 ms |
4948 KB |
Output is correct |
34 |
Correct |
2 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 ms |
4948 KB |
Output is correct |
36 |
Correct |
2 ms |
4948 KB |
Output is correct |
37 |
Correct |
2 ms |
4948 KB |
Output is correct |
38 |
Correct |
2 ms |
4948 KB |
Output is correct |
39 |
Correct |
2 ms |
4948 KB |
Output is correct |
40 |
Correct |
2 ms |
4948 KB |
Output is correct |
41 |
Correct |
2 ms |
4948 KB |
Output is correct |
42 |
Correct |
2 ms |
4948 KB |
Output is correct |
43 |
Correct |
3 ms |
4948 KB |
Output is correct |
44 |
Correct |
3 ms |
5076 KB |
Output is correct |
45 |
Correct |
2 ms |
4948 KB |
Output is correct |
46 |
Correct |
2 ms |
4948 KB |
Output is correct |
47 |
Correct |
2 ms |
5076 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
4 ms |
4948 KB |
Output is correct |
50 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
4948 KB |
Output is correct |
14 |
Correct |
2 ms |
4948 KB |
Output is correct |
15 |
Correct |
4 ms |
4948 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
2 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
2 ms |
5076 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
2 ms |
5076 KB |
Output is correct |
26 |
Correct |
2 ms |
4948 KB |
Output is correct |
27 |
Correct |
2 ms |
4948 KB |
Output is correct |
28 |
Correct |
2 ms |
4948 KB |
Output is correct |
29 |
Correct |
2 ms |
4948 KB |
Output is correct |
30 |
Correct |
3 ms |
4948 KB |
Output is correct |
31 |
Correct |
2 ms |
4948 KB |
Output is correct |
32 |
Correct |
2 ms |
4948 KB |
Output is correct |
33 |
Correct |
3 ms |
4948 KB |
Output is correct |
34 |
Correct |
2 ms |
4948 KB |
Output is correct |
35 |
Correct |
2 ms |
4948 KB |
Output is correct |
36 |
Correct |
3 ms |
4948 KB |
Output is correct |
37 |
Correct |
2 ms |
4948 KB |
Output is correct |
38 |
Correct |
2 ms |
5056 KB |
Output is correct |
39 |
Correct |
2 ms |
5052 KB |
Output is correct |
40 |
Correct |
2 ms |
4948 KB |
Output is correct |
41 |
Correct |
2 ms |
4948 KB |
Output is correct |
42 |
Correct |
3 ms |
4948 KB |
Output is correct |
43 |
Correct |
2 ms |
4948 KB |
Output is correct |
44 |
Correct |
2 ms |
4948 KB |
Output is correct |
45 |
Correct |
2 ms |
4948 KB |
Output is correct |
46 |
Correct |
2 ms |
4948 KB |
Output is correct |
47 |
Correct |
2 ms |
4948 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
2 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
3 ms |
5076 KB |
Output is correct |
52 |
Correct |
2 ms |
4948 KB |
Output is correct |
53 |
Correct |
2 ms |
4948 KB |
Output is correct |
54 |
Correct |
2 ms |
5076 KB |
Output is correct |
55 |
Correct |
2 ms |
4948 KB |
Output is correct |
56 |
Correct |
4 ms |
4948 KB |
Output is correct |
57 |
Correct |
2 ms |
4948 KB |
Output is correct |
58 |
Correct |
3 ms |
5076 KB |
Output is correct |
59 |
Correct |
2 ms |
5076 KB |
Output is correct |
60 |
Correct |
3 ms |
5076 KB |
Output is correct |
61 |
Correct |
2 ms |
5076 KB |
Output is correct |
62 |
Correct |
2 ms |
5076 KB |
Output is correct |
63 |
Correct |
3 ms |
5076 KB |
Output is correct |
64 |
Correct |
3 ms |
5076 KB |
Output is correct |
65 |
Correct |
2 ms |
5076 KB |
Output is correct |
66 |
Correct |
3 ms |
5076 KB |
Output is correct |
67 |
Correct |
2 ms |
5076 KB |
Output is correct |
68 |
Correct |
3 ms |
5076 KB |
Output is correct |
69 |
Correct |
3 ms |
5064 KB |
Output is correct |
70 |
Correct |
3 ms |
5076 KB |
Output is correct |
71 |
Correct |
2 ms |
5076 KB |
Output is correct |
72 |
Correct |
3 ms |
5076 KB |
Output is correct |
73 |
Correct |
3 ms |
5076 KB |
Output is correct |
74 |
Correct |
3 ms |
5076 KB |
Output is correct |
75 |
Correct |
3 ms |
5060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
4948 KB |
Output is correct |
14 |
Correct |
2 ms |
4948 KB |
Output is correct |
15 |
Correct |
4 ms |
4948 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
2 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
2 ms |
5076 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
2 ms |
5076 KB |
Output is correct |
26 |
Correct |
4 ms |
5076 KB |
Output is correct |
27 |
Correct |
3 ms |
5460 KB |
Output is correct |
28 |
Correct |
3 ms |
5460 KB |
Output is correct |
29 |
Correct |
4 ms |
5332 KB |
Output is correct |
30 |
Correct |
4 ms |
5332 KB |
Output is correct |
31 |
Correct |
3 ms |
5332 KB |
Output is correct |
32 |
Correct |
3 ms |
5324 KB |
Output is correct |
33 |
Correct |
3 ms |
5332 KB |
Output is correct |
34 |
Correct |
2 ms |
4948 KB |
Output is correct |
35 |
Correct |
2 ms |
4948 KB |
Output is correct |
36 |
Correct |
2 ms |
4948 KB |
Output is correct |
37 |
Correct |
2 ms |
4948 KB |
Output is correct |
38 |
Correct |
3 ms |
4948 KB |
Output is correct |
39 |
Correct |
2 ms |
4948 KB |
Output is correct |
40 |
Correct |
2 ms |
4948 KB |
Output is correct |
41 |
Correct |
3 ms |
4948 KB |
Output is correct |
42 |
Correct |
2 ms |
4948 KB |
Output is correct |
43 |
Correct |
2 ms |
4948 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
2 ms |
4948 KB |
Output is correct |
46 |
Correct |
2 ms |
5056 KB |
Output is correct |
47 |
Correct |
2 ms |
5052 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
2 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
2 ms |
4948 KB |
Output is correct |
52 |
Correct |
2 ms |
4948 KB |
Output is correct |
53 |
Correct |
2 ms |
4948 KB |
Output is correct |
54 |
Correct |
2 ms |
4948 KB |
Output is correct |
55 |
Correct |
2 ms |
4948 KB |
Output is correct |
56 |
Correct |
2 ms |
4948 KB |
Output is correct |
57 |
Correct |
2 ms |
4948 KB |
Output is correct |
58 |
Correct |
3 ms |
4948 KB |
Output is correct |
59 |
Correct |
3 ms |
5076 KB |
Output is correct |
60 |
Correct |
2 ms |
4948 KB |
Output is correct |
61 |
Correct |
2 ms |
4948 KB |
Output is correct |
62 |
Correct |
2 ms |
5076 KB |
Output is correct |
63 |
Correct |
2 ms |
4948 KB |
Output is correct |
64 |
Correct |
4 ms |
4948 KB |
Output is correct |
65 |
Correct |
2 ms |
4948 KB |
Output is correct |
66 |
Correct |
3 ms |
5076 KB |
Output is correct |
67 |
Correct |
2 ms |
5076 KB |
Output is correct |
68 |
Correct |
3 ms |
5076 KB |
Output is correct |
69 |
Correct |
2 ms |
5076 KB |
Output is correct |
70 |
Correct |
2 ms |
5076 KB |
Output is correct |
71 |
Correct |
3 ms |
5076 KB |
Output is correct |
72 |
Correct |
3 ms |
5076 KB |
Output is correct |
73 |
Correct |
2 ms |
5076 KB |
Output is correct |
74 |
Correct |
3 ms |
5076 KB |
Output is correct |
75 |
Correct |
2 ms |
5076 KB |
Output is correct |
76 |
Correct |
3 ms |
5076 KB |
Output is correct |
77 |
Correct |
3 ms |
5064 KB |
Output is correct |
78 |
Correct |
3 ms |
5076 KB |
Output is correct |
79 |
Correct |
2 ms |
5076 KB |
Output is correct |
80 |
Correct |
3 ms |
5076 KB |
Output is correct |
81 |
Correct |
3 ms |
5076 KB |
Output is correct |
82 |
Correct |
3 ms |
5076 KB |
Output is correct |
83 |
Correct |
3 ms |
5060 KB |
Output is correct |
84 |
Correct |
4 ms |
5076 KB |
Output is correct |
85 |
Correct |
3 ms |
5076 KB |
Output is correct |
86 |
Correct |
3 ms |
5104 KB |
Output is correct |
87 |
Correct |
4 ms |
5076 KB |
Output is correct |
88 |
Correct |
4 ms |
5076 KB |
Output is correct |
89 |
Correct |
4 ms |
5440 KB |
Output is correct |
90 |
Correct |
4 ms |
5332 KB |
Output is correct |
91 |
Correct |
4 ms |
5332 KB |
Output is correct |
92 |
Correct |
3 ms |
5332 KB |
Output is correct |
93 |
Correct |
4 ms |
5204 KB |
Output is correct |
94 |
Correct |
4 ms |
5332 KB |
Output is correct |
95 |
Correct |
3 ms |
5332 KB |
Output is correct |
96 |
Correct |
3 ms |
5332 KB |
Output is correct |
97 |
Correct |
5 ms |
5332 KB |
Output is correct |
98 |
Correct |
4 ms |
5428 KB |
Output is correct |
99 |
Correct |
4 ms |
5460 KB |
Output is correct |
100 |
Correct |
5 ms |
5332 KB |
Output is correct |
101 |
Correct |
3 ms |
5076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4992 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
4948 KB |
Output is correct |
14 |
Correct |
2 ms |
4948 KB |
Output is correct |
15 |
Correct |
4 ms |
4948 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
2 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
2 ms |
5076 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
2 ms |
5076 KB |
Output is correct |
26 |
Correct |
4 ms |
5076 KB |
Output is correct |
27 |
Correct |
3 ms |
5460 KB |
Output is correct |
28 |
Correct |
3 ms |
5460 KB |
Output is correct |
29 |
Correct |
4 ms |
5332 KB |
Output is correct |
30 |
Correct |
4 ms |
5332 KB |
Output is correct |
31 |
Correct |
3 ms |
5332 KB |
Output is correct |
32 |
Correct |
3 ms |
5324 KB |
Output is correct |
33 |
Correct |
3 ms |
5332 KB |
Output is correct |
34 |
Correct |
2 ms |
4948 KB |
Output is correct |
35 |
Correct |
2 ms |
4948 KB |
Output is correct |
36 |
Correct |
2 ms |
4948 KB |
Output is correct |
37 |
Correct |
2 ms |
4948 KB |
Output is correct |
38 |
Correct |
3 ms |
4948 KB |
Output is correct |
39 |
Correct |
2 ms |
4948 KB |
Output is correct |
40 |
Correct |
2 ms |
4948 KB |
Output is correct |
41 |
Correct |
3 ms |
4948 KB |
Output is correct |
42 |
Correct |
2 ms |
4948 KB |
Output is correct |
43 |
Correct |
2 ms |
4948 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
2 ms |
4948 KB |
Output is correct |
46 |
Correct |
2 ms |
5056 KB |
Output is correct |
47 |
Correct |
2 ms |
5052 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
2 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
2 ms |
4948 KB |
Output is correct |
52 |
Correct |
2 ms |
4948 KB |
Output is correct |
53 |
Correct |
2 ms |
4948 KB |
Output is correct |
54 |
Correct |
2 ms |
4948 KB |
Output is correct |
55 |
Correct |
2 ms |
4948 KB |
Output is correct |
56 |
Correct |
2 ms |
4948 KB |
Output is correct |
57 |
Correct |
2 ms |
4948 KB |
Output is correct |
58 |
Correct |
3 ms |
4948 KB |
Output is correct |
59 |
Correct |
3 ms |
5076 KB |
Output is correct |
60 |
Correct |
2 ms |
4948 KB |
Output is correct |
61 |
Correct |
2 ms |
4948 KB |
Output is correct |
62 |
Correct |
2 ms |
5076 KB |
Output is correct |
63 |
Correct |
2 ms |
4948 KB |
Output is correct |
64 |
Correct |
4 ms |
4948 KB |
Output is correct |
65 |
Correct |
2 ms |
4948 KB |
Output is correct |
66 |
Correct |
3 ms |
5076 KB |
Output is correct |
67 |
Correct |
2 ms |
5076 KB |
Output is correct |
68 |
Correct |
3 ms |
5076 KB |
Output is correct |
69 |
Correct |
2 ms |
5076 KB |
Output is correct |
70 |
Correct |
2 ms |
5076 KB |
Output is correct |
71 |
Correct |
3 ms |
5076 KB |
Output is correct |
72 |
Correct |
3 ms |
5076 KB |
Output is correct |
73 |
Correct |
2 ms |
5076 KB |
Output is correct |
74 |
Correct |
3 ms |
5076 KB |
Output is correct |
75 |
Correct |
2 ms |
5076 KB |
Output is correct |
76 |
Correct |
3 ms |
5076 KB |
Output is correct |
77 |
Correct |
3 ms |
5064 KB |
Output is correct |
78 |
Correct |
3 ms |
5076 KB |
Output is correct |
79 |
Correct |
2 ms |
5076 KB |
Output is correct |
80 |
Correct |
3 ms |
5076 KB |
Output is correct |
81 |
Correct |
3 ms |
5076 KB |
Output is correct |
82 |
Correct |
3 ms |
5076 KB |
Output is correct |
83 |
Correct |
3 ms |
5060 KB |
Output is correct |
84 |
Correct |
4 ms |
5076 KB |
Output is correct |
85 |
Correct |
3 ms |
5076 KB |
Output is correct |
86 |
Correct |
3 ms |
5104 KB |
Output is correct |
87 |
Correct |
4 ms |
5076 KB |
Output is correct |
88 |
Correct |
4 ms |
5076 KB |
Output is correct |
89 |
Correct |
4 ms |
5440 KB |
Output is correct |
90 |
Correct |
4 ms |
5332 KB |
Output is correct |
91 |
Correct |
4 ms |
5332 KB |
Output is correct |
92 |
Correct |
3 ms |
5332 KB |
Output is correct |
93 |
Correct |
4 ms |
5204 KB |
Output is correct |
94 |
Correct |
4 ms |
5332 KB |
Output is correct |
95 |
Correct |
3 ms |
5332 KB |
Output is correct |
96 |
Correct |
3 ms |
5332 KB |
Output is correct |
97 |
Correct |
5 ms |
5332 KB |
Output is correct |
98 |
Correct |
4 ms |
5428 KB |
Output is correct |
99 |
Correct |
4 ms |
5460 KB |
Output is correct |
100 |
Correct |
5 ms |
5332 KB |
Output is correct |
101 |
Correct |
3 ms |
5076 KB |
Output is correct |
102 |
Correct |
77 ms |
8696 KB |
Output is correct |
103 |
Correct |
82 ms |
8712 KB |
Output is correct |
104 |
Correct |
160 ms |
30148 KB |
Output is correct |
105 |
Correct |
73 ms |
10212 KB |
Output is correct |
106 |
Correct |
81 ms |
9968 KB |
Output is correct |
107 |
Correct |
94 ms |
31776 KB |
Output is correct |
108 |
Correct |
88 ms |
32312 KB |
Output is correct |
109 |
Correct |
62 ms |
24868 KB |
Output is correct |
110 |
Correct |
163 ms |
29912 KB |
Output is correct |
111 |
Correct |
86 ms |
30964 KB |
Output is correct |
112 |
Correct |
138 ms |
29392 KB |
Output is correct |
113 |
Correct |
101 ms |
21180 KB |
Output is correct |
114 |
Correct |
110 ms |
29804 KB |
Output is correct |
115 |
Correct |
87 ms |
28596 KB |
Output is correct |
116 |
Correct |
138 ms |
30916 KB |
Output is correct |
117 |
Correct |
171 ms |
22920 KB |
Output is correct |
118 |
Correct |
143 ms |
30464 KB |
Output is correct |
119 |
Correct |
93 ms |
12080 KB |
Output is correct |
120 |
Correct |
71 ms |
9036 KB |
Output is correct |