#ifndef Nhoksocqt1
#include "closing.h"
#endif // Nhoksocqt1
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define sz(x) int((x).size())
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
template<class X, class Y>
inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
return uniform_int_distribution<int>(l, r)(rng);
}
const bool isMultiTest = 0;
const int MAXN = 200005;
vector<ii> adj[MAXN];
ll fen_dist[3 * MAXN], fen_l[3 * MAXN], fen_h[3 * MAXN];
ll dist_l[MAXN], dist_h[MAXN], maxSum;
int pa[MAXN], numNode, x_node, y_node;
bool inPath[MAXN];
void dfs_init(int u, int p, ll dist_from_root, ll dist[], int par[]) {
par[u] = p;
dist[u] = dist_from_root;
for (int it = 0; it < sz(adj[u]); ++it) {
int v(adj[u][it].fi), w(adj[u][it].se);
if(v != par[u])
dfs_init(v, u, dist_from_root + w, dist, par);
}
}
typedef pair<ll, int> pli;
struct Data {
ll dif, val_l;
int node;
};
vector<Data> sorted_diff;
vector<pli> sorted_val;
void modify(ll fen[], int i, ll v) {
for (; i <= 3 * numNode; i += i & -i)
fen[i] += v;
}
ll get(ll fen[], int i) {
ll res(0);
for (; i > 0; i -= i & -i)
res += fen[i];
return res;
}
int walkOnFen(ll fen[], ll maxSum) {
int i(0);
for (int j = 31 - __builtin_clz(3 * numNode); j >= 0; --j) {
if(i + (1 << j) <= 3 * numNode && maxSum >= fen[i + (1 << j)]) {
i += (1 << j);
maxSum -= fen[i];
}
}
return i;
}
int getSumOptLeft(ll maxSum) {
int idx = walkOnFen(fen_dist, maxSum);
ll max_sum = get(fen_dist, idx);
int get_l = get(fen_l, idx), get_h = get(fen_h, idx);
int max_cnt = get_l + get_h;
int id_h_now = walkOnFen(fen_h, get_h - 1);
int dist_h_now = sorted_val[id_h_now].fi;
if(get_h % 2 == 0)
return max_cnt;
// replace highest q with next lowest p
if(get_l < get(fen_l, 3 * numNode)) {
int id_l_now = walkOnFen(fen_l, get_l);
ll dist_l_now = sorted_val[id_l_now].fi;
if(max_sum - dist_h_now + dist_l_now <= maxSum)
return max_cnt;
}
// replace highest p with highest q
if(get_l > 0) {
int id_l_now = walkOnFen(fen_l, get_l - 1);
ll dist_l_now = sorted_val[id_l_now].fi;
if(max_sum - dist_l_now + dist_h_now <= maxSum)
return max_cnt;
}
return max_cnt - 1;
}
int calcWithCommon(void) {
sorted_diff.clear();
for (int i = 0; i < numNode; ++i)
sorted_diff.push_back({dist_h[i] - dist_l[i], dist_l[i], i});
sort(sorted_diff.begin(), sorted_diff.end(), [](const Data &a, const Data &b) {
return (a.dif != b.dif) ? a.dif < b.dif : a.val_l < b.val_l;
});
sorted_val.clear();
for (int i = 0; i < numNode; ++i) {
sorted_val.push_back(pli(2 * dist_l[i], i));
sorted_val.push_back(pli(dist_h[i], -2 * i - 2));
sorted_val.push_back(pli(dist_h[i], -2 * i - 1));
}
sort(sorted_val.begin(), sorted_val.end());
for (int i = 1; i <= 3 * numNode; ++i)
fen_dist[i] = fen_l[i] = fen_h[i] = 0;
ll sum_in_path(0);
int cnt_in_path(0), res(0);
for (int u = 0; u < numNode; ++u) {
if(inPath[u]) {
sum_in_path += dist_l[u];
++cnt_in_path;
continue;
}
int pos = upper_bound(sorted_val.begin(), sorted_val.end(), pli(2 * dist_l[u], u)) - sorted_val.begin();
modify(fen_dist, pos, 2 * dist_l[u]);
modify(fen_l, pos, +1);
}
if(sum_in_path <= maxSum) {
int cnt_optleft = getSumOptLeft(2 * (maxSum - sum_in_path));
res = cnt_in_path + cnt_optleft;
}
for (int i = 0; i < numNode; ++i) {
int u(sorted_diff[i].node);
if(inPath[u]) {
sum_in_path += dist_h[u] - dist_l[u];
++cnt_in_path;
} else {
int pos = upper_bound(sorted_val.begin(), sorted_val.end(), pli(2 * dist_l[u], u)) - sorted_val.begin();
modify(fen_dist, pos, -2 * dist_l[u]);
modify(fen_l, pos, -1);
pos = upper_bound(sorted_val.begin(), sorted_val.end(), pli(dist_h[u], -2 * u - 2)) - sorted_val.begin();
modify(fen_dist, pos, dist_h[u]);
modify(fen_h, pos, +1);
modify(fen_dist, pos + 1, dist_h[u]);
modify(fen_h, pos + 1, +1);
}
if(sum_in_path > maxSum)
break;
int cnt_optleft = getSumOptLeft(2 * (maxSum - sum_in_path));
res = max(res, cnt_in_path + cnt_optleft);
}
return res;
}
int calcWithoutCommon(void) {
vector<ll> sorted_dist;
for (int i = 0; i < numNode; ++i) {
sorted_dist.push_back(dist_l[i]);
sorted_dist.push_back(dist_h[i]);
}
sort(sorted_dist.begin(), sorted_dist.end());
ll tot_sum(0);
int res(0);
for (int i = 0; i < sz(sorted_dist); ++i) {
ll dis(sorted_dist[i]);
tot_sum += dis;
if(tot_sum <= maxSum)
res = i + 1;
}
return res;
}
int max_score(int _N, int _X, int _Y, ll _K, vector<int> _U, vector<int> _V, vector<int> _W) {
numNode = _N, x_node = _X, y_node = _Y, maxSum = _K;
for (int i = 0; i < numNode; ++i) {
adj[i].clear();
inPath[i] = 0;
}
for (int i = 0; i + 1 < numNode; ++i) {
int u(_U[i]), v(_V[i]), w(_W[i]);
adj[u].push_back(ii(v, w));
adj[v].push_back(ii(u, w));
}
dfs_init(x_node, -1, 0, dist_l, pa);
dfs_init(y_node, -1, 0, dist_h, pa);
for (int u = x_node; u != -1; u = pa[u])
inPath[u] = 1;
for (int i = 0; i < numNode; ++i) {
ll min_dist = min(dist_l[i], dist_h[i]);
ll max_dist = max(dist_l[i], dist_h[i]);
dist_l[i] = min_dist, dist_h[i] = max_dist;
}
return max(calcWithCommon(), calcWithoutCommon());
}
#ifdef Nhoksocqt1
int main(void) {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TASK "closing"
if(fopen(TASK".inp", "r")) {
freopen(TASK".inp", "r", stdin);
freopen(TASK".out", "w", stdout);
}
vector<int> _U, _V, _W;
int _N, _X, _Y, _K;
cin >> _N >> _X >> _Y >> _K;
_U.resize(_N), _V.resize(_N), _W.resize(_N);
for (int i = 0; i + 1 < _N; ++i)
cin >> _U[i] >> _V[i] >> _W[i];
int x = max_score(_N, _X, _Y, _K, _U, _V, _W);
cout << "ANSWER: " << x << '\n';
return 0;
}
#endif // Nhoksocqt1
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
56420 KB |
Output is correct |
2 |
Correct |
217 ms |
62772 KB |
Output is correct |
3 |
Correct |
118 ms |
17440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14936 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
3 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14940 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
2 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
3 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14936 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
3 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14940 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
2 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
3 ms |
14940 KB |
Output is correct |
12 |
Correct |
2 ms |
14936 KB |
Output is correct |
13 |
Correct |
2 ms |
14940 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14936 KB |
Output is correct |
16 |
Correct |
3 ms |
14940 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
4 ms |
14940 KB |
Output is correct |
19 |
Correct |
3 ms |
14940 KB |
Output is correct |
20 |
Correct |
3 ms |
14940 KB |
Output is correct |
21 |
Correct |
3 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
15192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14936 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
3 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14940 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
2 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
3 ms |
14940 KB |
Output is correct |
12 |
Correct |
2 ms |
14936 KB |
Output is correct |
13 |
Correct |
2 ms |
14940 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14936 KB |
Output is correct |
16 |
Correct |
3 ms |
14940 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
4 ms |
14940 KB |
Output is correct |
19 |
Correct |
3 ms |
14940 KB |
Output is correct |
20 |
Correct |
3 ms |
14940 KB |
Output is correct |
21 |
Correct |
3 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
15192 KB |
Output is correct |
25 |
Correct |
5 ms |
14936 KB |
Output is correct |
26 |
Correct |
6 ms |
15576 KB |
Output is correct |
27 |
Correct |
6 ms |
15572 KB |
Output is correct |
28 |
Correct |
5 ms |
15572 KB |
Output is correct |
29 |
Correct |
5 ms |
15576 KB |
Output is correct |
30 |
Correct |
5 ms |
15576 KB |
Output is correct |
31 |
Correct |
4 ms |
15732 KB |
Output is correct |
32 |
Correct |
5 ms |
15576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14940 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
2 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14936 KB |
Output is correct |
7 |
Correct |
2 ms |
14936 KB |
Output is correct |
8 |
Correct |
2 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
3 ms |
14940 KB |
Output is correct |
12 |
Correct |
3 ms |
14940 KB |
Output is correct |
13 |
Correct |
3 ms |
14936 KB |
Output is correct |
14 |
Correct |
3 ms |
15192 KB |
Output is correct |
15 |
Correct |
2 ms |
14940 KB |
Output is correct |
16 |
Correct |
2 ms |
14940 KB |
Output is correct |
17 |
Correct |
2 ms |
14940 KB |
Output is correct |
18 |
Correct |
2 ms |
14936 KB |
Output is correct |
19 |
Correct |
2 ms |
14940 KB |
Output is correct |
20 |
Correct |
2 ms |
14940 KB |
Output is correct |
21 |
Correct |
2 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
2 ms |
14940 KB |
Output is correct |
24 |
Correct |
2 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14940 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
2 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14936 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
3 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
2 ms |
14940 KB |
Output is correct |
12 |
Correct |
3 ms |
14940 KB |
Output is correct |
13 |
Correct |
2 ms |
14936 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14940 KB |
Output is correct |
16 |
Correct |
2 ms |
14936 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
3 ms |
14940 KB |
Output is correct |
19 |
Correct |
2 ms |
14936 KB |
Output is correct |
20 |
Correct |
2 ms |
14940 KB |
Output is correct |
21 |
Correct |
2 ms |
14940 KB |
Output is correct |
22 |
Correct |
2 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
14940 KB |
Output is correct |
25 |
Correct |
3 ms |
14936 KB |
Output is correct |
26 |
Correct |
3 ms |
15192 KB |
Output is correct |
27 |
Correct |
2 ms |
14940 KB |
Output is correct |
28 |
Correct |
2 ms |
14940 KB |
Output is correct |
29 |
Correct |
2 ms |
14940 KB |
Output is correct |
30 |
Correct |
2 ms |
14936 KB |
Output is correct |
31 |
Correct |
2 ms |
14940 KB |
Output is correct |
32 |
Correct |
2 ms |
14940 KB |
Output is correct |
33 |
Correct |
2 ms |
14940 KB |
Output is correct |
34 |
Correct |
3 ms |
14940 KB |
Output is correct |
35 |
Correct |
2 ms |
14940 KB |
Output is correct |
36 |
Correct |
2 ms |
14940 KB |
Output is correct |
37 |
Correct |
3 ms |
14940 KB |
Output is correct |
38 |
Correct |
2 ms |
14940 KB |
Output is correct |
39 |
Correct |
2 ms |
14940 KB |
Output is correct |
40 |
Correct |
3 ms |
14940 KB |
Output is correct |
41 |
Correct |
2 ms |
14940 KB |
Output is correct |
42 |
Correct |
2 ms |
14940 KB |
Output is correct |
43 |
Correct |
3 ms |
14988 KB |
Output is correct |
44 |
Correct |
3 ms |
14940 KB |
Output is correct |
45 |
Correct |
3 ms |
14940 KB |
Output is correct |
46 |
Correct |
2 ms |
14940 KB |
Output is correct |
47 |
Correct |
3 ms |
14940 KB |
Output is correct |
48 |
Correct |
3 ms |
14936 KB |
Output is correct |
49 |
Correct |
3 ms |
14940 KB |
Output is correct |
50 |
Correct |
3 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14940 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
2 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14936 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
3 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
2 ms |
14940 KB |
Output is correct |
12 |
Correct |
3 ms |
14940 KB |
Output is correct |
13 |
Correct |
2 ms |
14936 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14940 KB |
Output is correct |
16 |
Correct |
2 ms |
14936 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
3 ms |
14940 KB |
Output is correct |
19 |
Correct |
4 ms |
14940 KB |
Output is correct |
20 |
Correct |
3 ms |
14940 KB |
Output is correct |
21 |
Correct |
3 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
14940 KB |
Output is correct |
25 |
Correct |
3 ms |
15192 KB |
Output is correct |
26 |
Correct |
2 ms |
14936 KB |
Output is correct |
27 |
Correct |
2 ms |
14940 KB |
Output is correct |
28 |
Correct |
2 ms |
14940 KB |
Output is correct |
29 |
Correct |
2 ms |
14940 KB |
Output is correct |
30 |
Correct |
3 ms |
14940 KB |
Output is correct |
31 |
Correct |
3 ms |
14940 KB |
Output is correct |
32 |
Correct |
3 ms |
14936 KB |
Output is correct |
33 |
Correct |
3 ms |
15192 KB |
Output is correct |
34 |
Correct |
2 ms |
14940 KB |
Output is correct |
35 |
Correct |
2 ms |
14940 KB |
Output is correct |
36 |
Correct |
2 ms |
14940 KB |
Output is correct |
37 |
Correct |
2 ms |
14936 KB |
Output is correct |
38 |
Correct |
2 ms |
14940 KB |
Output is correct |
39 |
Correct |
2 ms |
14940 KB |
Output is correct |
40 |
Correct |
2 ms |
14940 KB |
Output is correct |
41 |
Correct |
3 ms |
14940 KB |
Output is correct |
42 |
Correct |
2 ms |
14940 KB |
Output is correct |
43 |
Correct |
2 ms |
14940 KB |
Output is correct |
44 |
Correct |
3 ms |
14940 KB |
Output is correct |
45 |
Correct |
2 ms |
14940 KB |
Output is correct |
46 |
Correct |
2 ms |
14940 KB |
Output is correct |
47 |
Correct |
3 ms |
14940 KB |
Output is correct |
48 |
Correct |
2 ms |
14940 KB |
Output is correct |
49 |
Correct |
2 ms |
14940 KB |
Output is correct |
50 |
Correct |
3 ms |
14988 KB |
Output is correct |
51 |
Correct |
3 ms |
14940 KB |
Output is correct |
52 |
Correct |
3 ms |
14940 KB |
Output is correct |
53 |
Correct |
2 ms |
14940 KB |
Output is correct |
54 |
Correct |
3 ms |
14940 KB |
Output is correct |
55 |
Correct |
3 ms |
14936 KB |
Output is correct |
56 |
Correct |
3 ms |
14940 KB |
Output is correct |
57 |
Correct |
3 ms |
14940 KB |
Output is correct |
58 |
Correct |
3 ms |
14940 KB |
Output is correct |
59 |
Correct |
3 ms |
14940 KB |
Output is correct |
60 |
Correct |
3 ms |
14940 KB |
Output is correct |
61 |
Correct |
3 ms |
14940 KB |
Output is correct |
62 |
Correct |
3 ms |
14936 KB |
Output is correct |
63 |
Correct |
3 ms |
14940 KB |
Output is correct |
64 |
Correct |
3 ms |
14940 KB |
Output is correct |
65 |
Correct |
3 ms |
14940 KB |
Output is correct |
66 |
Correct |
3 ms |
14940 KB |
Output is correct |
67 |
Correct |
3 ms |
14940 KB |
Output is correct |
68 |
Correct |
3 ms |
14940 KB |
Output is correct |
69 |
Correct |
3 ms |
14940 KB |
Output is correct |
70 |
Correct |
3 ms |
14940 KB |
Output is correct |
71 |
Correct |
3 ms |
14940 KB |
Output is correct |
72 |
Correct |
3 ms |
14940 KB |
Output is correct |
73 |
Correct |
3 ms |
14940 KB |
Output is correct |
74 |
Correct |
3 ms |
14940 KB |
Output is correct |
75 |
Correct |
3 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14940 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
2 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14936 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
3 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
2 ms |
14940 KB |
Output is correct |
12 |
Correct |
3 ms |
14940 KB |
Output is correct |
13 |
Correct |
2 ms |
14936 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14940 KB |
Output is correct |
16 |
Correct |
2 ms |
14936 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
3 ms |
14940 KB |
Output is correct |
19 |
Correct |
4 ms |
14940 KB |
Output is correct |
20 |
Correct |
3 ms |
14940 KB |
Output is correct |
21 |
Correct |
3 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
14940 KB |
Output is correct |
25 |
Correct |
3 ms |
15192 KB |
Output is correct |
26 |
Correct |
5 ms |
14936 KB |
Output is correct |
27 |
Correct |
6 ms |
15576 KB |
Output is correct |
28 |
Correct |
6 ms |
15572 KB |
Output is correct |
29 |
Correct |
5 ms |
15572 KB |
Output is correct |
30 |
Correct |
5 ms |
15576 KB |
Output is correct |
31 |
Correct |
5 ms |
15576 KB |
Output is correct |
32 |
Correct |
4 ms |
15732 KB |
Output is correct |
33 |
Correct |
5 ms |
15576 KB |
Output is correct |
34 |
Correct |
2 ms |
14936 KB |
Output is correct |
35 |
Correct |
2 ms |
14940 KB |
Output is correct |
36 |
Correct |
2 ms |
14940 KB |
Output is correct |
37 |
Correct |
2 ms |
14940 KB |
Output is correct |
38 |
Correct |
3 ms |
14940 KB |
Output is correct |
39 |
Correct |
3 ms |
14940 KB |
Output is correct |
40 |
Correct |
3 ms |
14936 KB |
Output is correct |
41 |
Correct |
3 ms |
15192 KB |
Output is correct |
42 |
Correct |
2 ms |
14940 KB |
Output is correct |
43 |
Correct |
2 ms |
14940 KB |
Output is correct |
44 |
Correct |
2 ms |
14940 KB |
Output is correct |
45 |
Correct |
2 ms |
14936 KB |
Output is correct |
46 |
Correct |
2 ms |
14940 KB |
Output is correct |
47 |
Correct |
2 ms |
14940 KB |
Output is correct |
48 |
Correct |
2 ms |
14940 KB |
Output is correct |
49 |
Correct |
3 ms |
14940 KB |
Output is correct |
50 |
Correct |
2 ms |
14940 KB |
Output is correct |
51 |
Correct |
2 ms |
14940 KB |
Output is correct |
52 |
Correct |
3 ms |
14940 KB |
Output is correct |
53 |
Correct |
2 ms |
14940 KB |
Output is correct |
54 |
Correct |
2 ms |
14940 KB |
Output is correct |
55 |
Correct |
3 ms |
14940 KB |
Output is correct |
56 |
Correct |
2 ms |
14940 KB |
Output is correct |
57 |
Correct |
2 ms |
14940 KB |
Output is correct |
58 |
Correct |
3 ms |
14988 KB |
Output is correct |
59 |
Correct |
3 ms |
14940 KB |
Output is correct |
60 |
Correct |
3 ms |
14940 KB |
Output is correct |
61 |
Correct |
2 ms |
14940 KB |
Output is correct |
62 |
Correct |
3 ms |
14940 KB |
Output is correct |
63 |
Correct |
3 ms |
14936 KB |
Output is correct |
64 |
Correct |
3 ms |
14940 KB |
Output is correct |
65 |
Correct |
3 ms |
14940 KB |
Output is correct |
66 |
Correct |
3 ms |
14940 KB |
Output is correct |
67 |
Correct |
3 ms |
14940 KB |
Output is correct |
68 |
Correct |
3 ms |
14940 KB |
Output is correct |
69 |
Correct |
3 ms |
14940 KB |
Output is correct |
70 |
Correct |
3 ms |
14936 KB |
Output is correct |
71 |
Correct |
3 ms |
14940 KB |
Output is correct |
72 |
Correct |
3 ms |
14940 KB |
Output is correct |
73 |
Correct |
3 ms |
14940 KB |
Output is correct |
74 |
Correct |
3 ms |
14940 KB |
Output is correct |
75 |
Correct |
3 ms |
14940 KB |
Output is correct |
76 |
Correct |
3 ms |
14940 KB |
Output is correct |
77 |
Correct |
3 ms |
14940 KB |
Output is correct |
78 |
Correct |
3 ms |
14940 KB |
Output is correct |
79 |
Correct |
3 ms |
14940 KB |
Output is correct |
80 |
Correct |
3 ms |
14940 KB |
Output is correct |
81 |
Correct |
3 ms |
14940 KB |
Output is correct |
82 |
Correct |
3 ms |
14940 KB |
Output is correct |
83 |
Correct |
3 ms |
14940 KB |
Output is correct |
84 |
Correct |
5 ms |
14936 KB |
Output is correct |
85 |
Correct |
5 ms |
14940 KB |
Output is correct |
86 |
Correct |
4 ms |
14940 KB |
Output is correct |
87 |
Correct |
5 ms |
14940 KB |
Output is correct |
88 |
Correct |
5 ms |
14936 KB |
Output is correct |
89 |
Correct |
6 ms |
15320 KB |
Output is correct |
90 |
Correct |
5 ms |
15452 KB |
Output is correct |
91 |
Correct |
6 ms |
15572 KB |
Output is correct |
92 |
Correct |
5 ms |
15316 KB |
Output is correct |
93 |
Correct |
5 ms |
15320 KB |
Output is correct |
94 |
Correct |
4 ms |
15576 KB |
Output is correct |
95 |
Correct |
5 ms |
15576 KB |
Output is correct |
96 |
Correct |
5 ms |
15576 KB |
Output is correct |
97 |
Correct |
6 ms |
15576 KB |
Output is correct |
98 |
Correct |
6 ms |
15320 KB |
Output is correct |
99 |
Correct |
5 ms |
15316 KB |
Output is correct |
100 |
Correct |
5 ms |
15196 KB |
Output is correct |
101 |
Correct |
5 ms |
14940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14940 KB |
Output is correct |
2 |
Correct |
2 ms |
14940 KB |
Output is correct |
3 |
Correct |
2 ms |
14936 KB |
Output is correct |
4 |
Correct |
2 ms |
14936 KB |
Output is correct |
5 |
Correct |
2 ms |
14936 KB |
Output is correct |
6 |
Correct |
3 ms |
14936 KB |
Output is correct |
7 |
Correct |
3 ms |
14940 KB |
Output is correct |
8 |
Correct |
3 ms |
14940 KB |
Output is correct |
9 |
Correct |
2 ms |
14940 KB |
Output is correct |
10 |
Correct |
2 ms |
14940 KB |
Output is correct |
11 |
Correct |
2 ms |
14940 KB |
Output is correct |
12 |
Correct |
3 ms |
14940 KB |
Output is correct |
13 |
Correct |
2 ms |
14936 KB |
Output is correct |
14 |
Correct |
2 ms |
14940 KB |
Output is correct |
15 |
Correct |
2 ms |
14940 KB |
Output is correct |
16 |
Correct |
2 ms |
14936 KB |
Output is correct |
17 |
Correct |
3 ms |
14940 KB |
Output is correct |
18 |
Correct |
3 ms |
14940 KB |
Output is correct |
19 |
Correct |
4 ms |
14940 KB |
Output is correct |
20 |
Correct |
3 ms |
14940 KB |
Output is correct |
21 |
Correct |
3 ms |
14940 KB |
Output is correct |
22 |
Correct |
3 ms |
14940 KB |
Output is correct |
23 |
Correct |
3 ms |
14940 KB |
Output is correct |
24 |
Correct |
3 ms |
14940 KB |
Output is correct |
25 |
Correct |
3 ms |
15192 KB |
Output is correct |
26 |
Correct |
5 ms |
14936 KB |
Output is correct |
27 |
Correct |
6 ms |
15576 KB |
Output is correct |
28 |
Correct |
6 ms |
15572 KB |
Output is correct |
29 |
Correct |
5 ms |
15572 KB |
Output is correct |
30 |
Correct |
5 ms |
15576 KB |
Output is correct |
31 |
Correct |
5 ms |
15576 KB |
Output is correct |
32 |
Correct |
4 ms |
15732 KB |
Output is correct |
33 |
Correct |
5 ms |
15576 KB |
Output is correct |
34 |
Correct |
2 ms |
14936 KB |
Output is correct |
35 |
Correct |
2 ms |
14940 KB |
Output is correct |
36 |
Correct |
2 ms |
14940 KB |
Output is correct |
37 |
Correct |
2 ms |
14940 KB |
Output is correct |
38 |
Correct |
3 ms |
14940 KB |
Output is correct |
39 |
Correct |
3 ms |
14940 KB |
Output is correct |
40 |
Correct |
3 ms |
14936 KB |
Output is correct |
41 |
Correct |
3 ms |
15192 KB |
Output is correct |
42 |
Correct |
2 ms |
14940 KB |
Output is correct |
43 |
Correct |
2 ms |
14940 KB |
Output is correct |
44 |
Correct |
2 ms |
14940 KB |
Output is correct |
45 |
Correct |
2 ms |
14936 KB |
Output is correct |
46 |
Correct |
2 ms |
14940 KB |
Output is correct |
47 |
Correct |
2 ms |
14940 KB |
Output is correct |
48 |
Correct |
2 ms |
14940 KB |
Output is correct |
49 |
Correct |
3 ms |
14940 KB |
Output is correct |
50 |
Correct |
2 ms |
14940 KB |
Output is correct |
51 |
Correct |
2 ms |
14940 KB |
Output is correct |
52 |
Correct |
3 ms |
14940 KB |
Output is correct |
53 |
Correct |
2 ms |
14940 KB |
Output is correct |
54 |
Correct |
2 ms |
14940 KB |
Output is correct |
55 |
Correct |
3 ms |
14940 KB |
Output is correct |
56 |
Correct |
2 ms |
14940 KB |
Output is correct |
57 |
Correct |
2 ms |
14940 KB |
Output is correct |
58 |
Correct |
3 ms |
14988 KB |
Output is correct |
59 |
Correct |
3 ms |
14940 KB |
Output is correct |
60 |
Correct |
3 ms |
14940 KB |
Output is correct |
61 |
Correct |
2 ms |
14940 KB |
Output is correct |
62 |
Correct |
3 ms |
14940 KB |
Output is correct |
63 |
Correct |
3 ms |
14936 KB |
Output is correct |
64 |
Correct |
3 ms |
14940 KB |
Output is correct |
65 |
Correct |
3 ms |
14940 KB |
Output is correct |
66 |
Correct |
3 ms |
14940 KB |
Output is correct |
67 |
Correct |
3 ms |
14940 KB |
Output is correct |
68 |
Correct |
3 ms |
14940 KB |
Output is correct |
69 |
Correct |
3 ms |
14940 KB |
Output is correct |
70 |
Correct |
3 ms |
14936 KB |
Output is correct |
71 |
Correct |
3 ms |
14940 KB |
Output is correct |
72 |
Correct |
3 ms |
14940 KB |
Output is correct |
73 |
Correct |
3 ms |
14940 KB |
Output is correct |
74 |
Correct |
3 ms |
14940 KB |
Output is correct |
75 |
Correct |
3 ms |
14940 KB |
Output is correct |
76 |
Correct |
3 ms |
14940 KB |
Output is correct |
77 |
Correct |
3 ms |
14940 KB |
Output is correct |
78 |
Correct |
3 ms |
14940 KB |
Output is correct |
79 |
Correct |
3 ms |
14940 KB |
Output is correct |
80 |
Correct |
3 ms |
14940 KB |
Output is correct |
81 |
Correct |
3 ms |
14940 KB |
Output is correct |
82 |
Correct |
3 ms |
14940 KB |
Output is correct |
83 |
Correct |
3 ms |
14940 KB |
Output is correct |
84 |
Correct |
5 ms |
14936 KB |
Output is correct |
85 |
Correct |
5 ms |
14940 KB |
Output is correct |
86 |
Correct |
4 ms |
14940 KB |
Output is correct |
87 |
Correct |
5 ms |
14940 KB |
Output is correct |
88 |
Correct |
5 ms |
14936 KB |
Output is correct |
89 |
Correct |
6 ms |
15320 KB |
Output is correct |
90 |
Correct |
5 ms |
15452 KB |
Output is correct |
91 |
Correct |
6 ms |
15572 KB |
Output is correct |
92 |
Correct |
5 ms |
15316 KB |
Output is correct |
93 |
Correct |
5 ms |
15320 KB |
Output is correct |
94 |
Correct |
4 ms |
15576 KB |
Output is correct |
95 |
Correct |
5 ms |
15576 KB |
Output is correct |
96 |
Correct |
5 ms |
15576 KB |
Output is correct |
97 |
Correct |
6 ms |
15576 KB |
Output is correct |
98 |
Correct |
6 ms |
15320 KB |
Output is correct |
99 |
Correct |
5 ms |
15316 KB |
Output is correct |
100 |
Correct |
5 ms |
15196 KB |
Output is correct |
101 |
Correct |
5 ms |
14940 KB |
Output is correct |
102 |
Correct |
154 ms |
17420 KB |
Output is correct |
103 |
Correct |
159 ms |
17440 KB |
Output is correct |
104 |
Correct |
272 ms |
60204 KB |
Output is correct |
105 |
Correct |
205 ms |
21436 KB |
Output is correct |
106 |
Correct |
207 ms |
18424 KB |
Output is correct |
107 |
Correct |
179 ms |
50596 KB |
Output is correct |
108 |
Correct |
171 ms |
49744 KB |
Output is correct |
109 |
Correct |
142 ms |
63384 KB |
Output is correct |
110 |
Correct |
368 ms |
51948 KB |
Output is correct |
111 |
Correct |
223 ms |
56888 KB |
Output is correct |
112 |
Correct |
301 ms |
55428 KB |
Output is correct |
113 |
Correct |
265 ms |
54360 KB |
Output is correct |
114 |
Correct |
228 ms |
54332 KB |
Output is correct |
115 |
Correct |
174 ms |
67660 KB |
Output is correct |
116 |
Incorrect |
346 ms |
57952 KB |
1st lines differ - on the 1st token, expected: '125329', found: '125328' |
117 |
Halted |
0 ms |
0 KB |
- |