#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Fenwick {
vector<ll> a;
int size;
int lg;
Fenwick(int size_) {
size = size_;
a.resize(size + 1, 0);
lg = 0;
while ((1 << lg) <= size) lg++;
}
void add(int i, ll v) {
for (; i <= size; i += i & -i) a[i] += v;
}
ll query(int i) {
ll ans = 0;
for (; i > 0; i -= i & -i) ans += a[i];
return ans;
}
int lower_bound(ll v) {
int idx = 0;
ll sum = 0;
for (int i = lg - 1; i >= 0; i--)
if (idx + (1 << i) <= size && sum + a[idx + (1 << i)] < v) {
idx += (1 << i);
sum += a[idx];
}
return idx + 1;
}
};
vector<ll> pval, qval;
vector<vector<tuple<int, int>>> gr;
vector<bool> inxy;
vector<int> parent;
int N;
ll K;
void dfs(int p, int u, ll d, vector<ll> &dist) {
parent[u] = p;
dist[u] = d;
for (auto &t : gr[u]) {
int v = get<0>(t);
if (v != p) dfs(u, v, d + get<1>(t), dist);
}
}
int GetScoreWithoutCommon() {
vector<ll> pq;
pq.insert(pq.end(), pval.begin(), pval.end());
pq.insert(pq.end(), qval.begin(), qval.end());
sort(pq.begin(), pq.end());
ll total = 0;
int ans = 0;
for (auto &c : pq) {
if (total + c <= K) {
total += c;
ans++;
} else
break;
}
return ans;
}
int GetScoreWithCommon() {
ll total_xy = 0;
int ans = 0;
for (int i = 0; i < N; i++)
if (inxy[i]) {
total_xy += pval[i];
qval[i] -= pval[i];
pval[i] = 0;
}
vector<tuple<ll, ll, int>> diffs;
for (int i = 0; i < N; i++) diffs.emplace_back(qval[i] - pval[i], pval[i], i);
sort(diffs.begin(), diffs.end());
vector<tuple<ll, int, int>> elem;
for (int i = 0; i < N; i++) {
elem.emplace_back(2 * pval[i], i, i);
elem.emplace_back(qval[i], -2 * i - 1, i);
elem.emplace_back(qval[i], -2 * i - 2, i);
}
elem.emplace_back(-1, 0, 0);
sort(elem.begin(), elem.end());
vector<int> pidx(N), qidx(N);
for (int i = 1; i <= 3 * N; i++) {
int j = get<2>(elem[i]);
if (get<1>(elem[i]) >= 0)
pidx[j] = i;
else
qidx[j] = i;
}
Fenwick prefix(3 * N), p_ctr(3 * N), q_ctr(3 * N);
auto Knapsack01 = [&](ll cap) -> int {
int idx = prefix.lower_bound(cap + 1) - 1;
ll total = prefix.query(idx);
int score = p_ctr.query(idx) + q_ctr.query(idx);
if (q_ctr.query(idx) % 2 == 0) return score;
int curr_p = p_ctr.lower_bound(p_ctr.query(idx)),
curr_q = q_ctr.lower_bound(q_ctr.query(idx));
if (p_ctr.query(idx) != p_ctr.query(3 * N)) {
int next_p = p_ctr.lower_bound(p_ctr.query(idx) + 1);
if (total - get<0>(elem[curr_q]) + get<0>(elem[next_p]) <= cap)
return score;
}
if (curr_p > 0) {
if (total - get<0>(elem[curr_p]) + get<0>(elem[curr_q]) <= cap)
return score;
}
return score - 1;
};
for (int i = 0; i < N; i++) {
int idx = pidx[i];
prefix.add(idx, 2 * pval[i]);
p_ctr.add(idx, 1);
}
for (int i = 0; i < N; i++) {
int node = get<2>(diffs[i]);
int idx = pidx[node];
prefix.add(idx, -2 * pval[node]);
p_ctr.add(idx, -1);
idx = qidx[node];
prefix.add(idx, qval[node]);
prefix.add(idx - 1, qval[node]);
q_ctr.add(idx, 1);
q_ctr.add(idx - 1, 1);
if (total_xy <= K) {
int score = Knapsack01(2 * (K - total_xy));
ans = max(ans, score);
}
}
return ans;
}
int max_score(int N_, int X, int Y, ll K_, vector<int> U, vector<int> V,
vector<int> W) {
N = N_;
K = K_;
gr.assign(N, vector<tuple<int, int>>());
pval.resize(N);
qval.resize(N);
inxy.assign(N, false);
parent.resize(N);
for (int i = 0; i < static_cast<int>(U.size()); i++) {
gr[U[i]].emplace_back(V[i], W[i]);
gr[V[i]].emplace_back(U[i], W[i]);
}
dfs(-1, X, 0, pval);
dfs(-1, Y, 0, qval);
for (int i = 0; i < N; i++) {
auto t = min(pval[i], qval[i]);
qval[i] = max(pval[i], qval[i]);
pval[i] = t;
}
for (int u = X; u != -1; u = parent[u]) inxy[u] = true;
int ans = GetScoreWithoutCommon();
return max(ans, GetScoreWithCommon());
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
244 ms |
59860 KB |
Output is correct |
2 |
Correct |
258 ms |
63940 KB |
Output is correct |
3 |
Correct |
132 ms |
5744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
432 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
432 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
436 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
432 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
436 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
2 ms |
348 KB |
Output is correct |
26 |
Correct |
4 ms |
1368 KB |
Output is correct |
27 |
Correct |
3 ms |
1240 KB |
Output is correct |
28 |
Correct |
3 ms |
1368 KB |
Output is correct |
29 |
Correct |
3 ms |
1368 KB |
Output is correct |
30 |
Correct |
2 ms |
1376 KB |
Output is correct |
31 |
Correct |
3 ms |
1504 KB |
Output is correct |
32 |
Correct |
3 ms |
1340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
352 KB |
Output is correct |
16 |
Correct |
1 ms |
352 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
432 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
352 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
352 KB |
Output is correct |
28 |
Correct |
1 ms |
352 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
344 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
348 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
344 KB |
Output is correct |
44 |
Correct |
1 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
344 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
432 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
436 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
352 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
352 KB |
Output is correct |
35 |
Correct |
1 ms |
352 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 |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
344 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
344 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
344 KB |
Output is correct |
51 |
Correct |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
344 KB |
Output is correct |
53 |
Correct |
1 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
1 ms |
344 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
348 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
436 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
1 ms |
348 KB |
Output is correct |
74 |
Correct |
1 ms |
436 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
432 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
436 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
2 ms |
348 KB |
Output is correct |
27 |
Correct |
4 ms |
1368 KB |
Output is correct |
28 |
Correct |
3 ms |
1240 KB |
Output is correct |
29 |
Correct |
3 ms |
1368 KB |
Output is correct |
30 |
Correct |
3 ms |
1368 KB |
Output is correct |
31 |
Correct |
2 ms |
1376 KB |
Output is correct |
32 |
Correct |
3 ms |
1504 KB |
Output is correct |
33 |
Correct |
3 ms |
1340 KB |
Output is correct |
34 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
352 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
352 KB |
Output is correct |
43 |
Correct |
1 ms |
352 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
344 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
1 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
1 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
344 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
344 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
0 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
344 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
1 ms |
436 KB |
Output is correct |
74 |
Correct |
1 ms |
348 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
348 KB |
Output is correct |
77 |
Correct |
1 ms |
348 KB |
Output is correct |
78 |
Correct |
1 ms |
348 KB |
Output is correct |
79 |
Correct |
1 ms |
348 KB |
Output is correct |
80 |
Correct |
1 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
348 KB |
Output is correct |
82 |
Correct |
1 ms |
436 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
2 ms |
344 KB |
Output is correct |
85 |
Correct |
2 ms |
604 KB |
Output is correct |
86 |
Correct |
2 ms |
344 KB |
Output is correct |
87 |
Correct |
3 ms |
344 KB |
Output is correct |
88 |
Correct |
2 ms |
344 KB |
Output is correct |
89 |
Correct |
3 ms |
1240 KB |
Output is correct |
90 |
Correct |
3 ms |
1116 KB |
Output is correct |
91 |
Correct |
3 ms |
1248 KB |
Output is correct |
92 |
Correct |
3 ms |
1116 KB |
Output is correct |
93 |
Correct |
3 ms |
1116 KB |
Output is correct |
94 |
Correct |
3 ms |
1372 KB |
Output is correct |
95 |
Correct |
3 ms |
1372 KB |
Output is correct |
96 |
Correct |
3 ms |
1236 KB |
Output is correct |
97 |
Correct |
3 ms |
1240 KB |
Output is correct |
98 |
Correct |
3 ms |
1116 KB |
Output is correct |
99 |
Correct |
4 ms |
1240 KB |
Output is correct |
100 |
Correct |
3 ms |
1112 KB |
Output is correct |
101 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
432 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
436 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
2 ms |
348 KB |
Output is correct |
27 |
Correct |
4 ms |
1368 KB |
Output is correct |
28 |
Correct |
3 ms |
1240 KB |
Output is correct |
29 |
Correct |
3 ms |
1368 KB |
Output is correct |
30 |
Correct |
3 ms |
1368 KB |
Output is correct |
31 |
Correct |
2 ms |
1376 KB |
Output is correct |
32 |
Correct |
3 ms |
1504 KB |
Output is correct |
33 |
Correct |
3 ms |
1340 KB |
Output is correct |
34 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
352 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
352 KB |
Output is correct |
43 |
Correct |
1 ms |
352 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
344 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
1 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
1 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
344 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
344 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
0 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
344 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
1 ms |
436 KB |
Output is correct |
74 |
Correct |
1 ms |
348 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
348 KB |
Output is correct |
77 |
Correct |
1 ms |
348 KB |
Output is correct |
78 |
Correct |
1 ms |
348 KB |
Output is correct |
79 |
Correct |
1 ms |
348 KB |
Output is correct |
80 |
Correct |
1 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
348 KB |
Output is correct |
82 |
Correct |
1 ms |
436 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
2 ms |
344 KB |
Output is correct |
85 |
Correct |
2 ms |
604 KB |
Output is correct |
86 |
Correct |
2 ms |
344 KB |
Output is correct |
87 |
Correct |
3 ms |
344 KB |
Output is correct |
88 |
Correct |
2 ms |
344 KB |
Output is correct |
89 |
Correct |
3 ms |
1240 KB |
Output is correct |
90 |
Correct |
3 ms |
1116 KB |
Output is correct |
91 |
Correct |
3 ms |
1248 KB |
Output is correct |
92 |
Correct |
3 ms |
1116 KB |
Output is correct |
93 |
Correct |
3 ms |
1116 KB |
Output is correct |
94 |
Correct |
3 ms |
1372 KB |
Output is correct |
95 |
Correct |
3 ms |
1372 KB |
Output is correct |
96 |
Correct |
3 ms |
1236 KB |
Output is correct |
97 |
Correct |
3 ms |
1240 KB |
Output is correct |
98 |
Correct |
3 ms |
1116 KB |
Output is correct |
99 |
Correct |
4 ms |
1240 KB |
Output is correct |
100 |
Correct |
3 ms |
1112 KB |
Output is correct |
101 |
Correct |
2 ms |
604 KB |
Output is correct |
102 |
Correct |
139 ms |
5560 KB |
Output is correct |
103 |
Correct |
139 ms |
5752 KB |
Output is correct |
104 |
Correct |
273 ms |
61804 KB |
Output is correct |
105 |
Correct |
178 ms |
8436 KB |
Output is correct |
106 |
Correct |
178 ms |
7560 KB |
Output is correct |
107 |
Correct |
142 ms |
50424 KB |
Output is correct |
108 |
Correct |
135 ms |
51968 KB |
Output is correct |
109 |
Correct |
155 ms |
63348 KB |
Output is correct |
110 |
Correct |
352 ms |
56728 KB |
Output is correct |
111 |
Correct |
182 ms |
60620 KB |
Output is correct |
112 |
Correct |
256 ms |
54736 KB |
Output is correct |
113 |
Correct |
250 ms |
53596 KB |
Output is correct |
114 |
Correct |
248 ms |
55424 KB |
Output is correct |
115 |
Correct |
202 ms |
65436 KB |
Output is correct |
116 |
Correct |
318 ms |
57244 KB |
Output is correct |
117 |
Correct |
283 ms |
57320 KB |
Output is correct |
118 |
Correct |
301 ms |
56152 KB |
Output is correct |
119 |
Correct |
178 ms |
13292 KB |
Output is correct |
120 |
Correct |
115 ms |
5028 KB |
Output is correct |