#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const long long INF = 1e18;
int onp[maxn];
long long depX[maxn], depY[maxn];
vector<pair<int, int>> g[maxn];
void dfsX(int x, int p = -1)
{
for (auto v : g[x])
{
if (v.first == p)
continue;
depX[v.first] = depX[x] + v.second;
dfsX(v.first, x);
}
}
void dfsY(int x, int p = -1)
{
for (auto v : g[x])
{
if (v.first == p)
continue;
depY[v.first] = depY[x] + v.second;
dfsY(v.first, x);
}
}
long long solve1(int n, long long k)
{
vector<long long> vec;
vec.insert(vec.end(), depX, depX + n);
vec.insert(vec.end(), depY, depY + n);
sort(vec.begin(), vec.end());
long long crr = 0;
for (int i = 0; i < vec.size(); i++)
{
crr += vec[i];
if (crr > k)
return i;
}
return vec.size();
}
vector<int> path;
bool dfs_path(int x, int endp, int p = -1)
{
if (x == endp)
return (onp[x] = true);
for (auto v : g[x])
{
if (v.first == p)
continue;
onp[x] |= dfs_path(v.first, endp, x);
}
return onp[x];
}
vector<long long> vec1, vec2;
void dfs_gen(int x, int p, long long cnst)
{
long long val;
if (p == -1)
val = 0;
else
val = min(depX[x], depY[x]);
if (val > cnst)
vec2.push_back(val);
else
vec1.push_back(val);
for (auto v : g[x])
{
if (v.first == p || onp[v.first])
continue;
dfs_gen(v.first, x, cnst);
}
}
vector<long long> v1;
vector<pair<long long, long long>> v2;
vector<long long> mn;
int ptr;
long long mx, sum;
long long solve_v2(long long k)
{
if (k < 0)
return -INF;
while (ptr < v2.size() && v2[ptr].first + sum <= k)
{
mx = max(mx, v2[ptr].first - v2[ptr].second);
sum += v2[ptr].first;
ptr++;
}
if (ptr == v2.size())
return 2 * ptr;
else
{
if (sum - mx + v2[ptr].first <= k || sum + mn[ptr] <= k)
return 2 * ptr + 1;
else
return 2 * ptr;
}
}
long long solve2(int n, long long k, int x, int y)
{
dfs_path(x, y);
long long re = 0;
v1.clear();
v2.clear();
ptr = 0;
mx = -INF;
sum = 0;
for (int i = 0; i < n; i++)
{
if (onp[i])
{
k -= min(depX[i], depY[i]);
vec1.clear();
vec2.clear();
long long inc = abs(depX[i] - depY[i]);
dfs_gen(i, -1, inc);
for (auto v : vec1)
{
v1.push_back(v);
v1.push_back(inc);
}
for (auto v : vec2)
{
v2.push_back({v + inc, v});
}
// cout << i << endl;
// for(auto v: knapsack[len])cout << v << " ";
// cout << endl;
}
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
if (!v2.empty())
{
mn.resize(v2.size());
for (int i = v2.size() - 1; i >= 0; i--)
{
mn[i] = v2[i].second;
if (i + 1 < v2.size())
mn[i] = min(mn[i], mn[i + 1]);
}
}
// cout << "left " << k << endl;
if (k < 0)
return 0;
k -= accumulate(v1.begin(), v1.end(), 0LL);
re = max(re, solve_v2(k) + (long long)v1.size());
for (int i = v1.size() - 1; i >= 0; i--)
{
k += v1[i];
re = max(re, solve_v2(k) + i);
}
return re;
}
void reset(int n)
{
for (int i = 0; i < n; i++)
{
g[i].clear();
onp[i] = 0;
}
path.clear();
}
int max_score(int N, int X, int Y, long long K,
std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
reset(N);
for (int i = 0; i < N - 1; i++)
{
g[U[i]].push_back({V[i], W[i]});
g[V[i]].push_back({U[i], W[i]});
}
depX[X] = 0;
depY[Y] = 0;
dfsX(X);
dfsY(Y);
long long ans = max(solve1(N, K), solve2(N, K, X, Y));
return ans;
}
Compilation message
closing.cpp: In function 'long long int solve1(int, long long int)':
closing.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for (int i = 0; i < vec.size(); i++)
| ~~^~~~~~~~~~~~
closing.cpp: In function 'long long int solve_v2(long long int)':
closing.cpp:97:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
97 | while (ptr < v2.size() && v2[ptr].first + sum <= k)
| ~~~~^~~~~~~~~~~
closing.cpp:103:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
103 | if (ptr == v2.size())
| ~~~~^~~~~~~~~~~~
closing.cpp: In function 'long long int solve2(int, long long int, int, int)':
closing.cpp:154:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
154 | if (i + 1 < v2.size())
| ~~~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
166 ms |
35236 KB |
Output is correct |
2 |
Correct |
200 ms |
40220 KB |
Output is correct |
3 |
Correct |
86 ms |
7568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4968 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4968 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
3 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 |
4996 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 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 |
3 ms |
5076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4968 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
3 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 |
4996 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 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 |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
5 ms |
4948 KB |
Output is correct |
26 |
Correct |
5 ms |
5588 KB |
Output is correct |
27 |
Correct |
5 ms |
5460 KB |
Output is correct |
28 |
Correct |
4 ms |
5588 KB |
Output is correct |
29 |
Correct |
4 ms |
5460 KB |
Output is correct |
30 |
Correct |
5 ms |
5460 KB |
Output is correct |
31 |
Correct |
4 ms |
5588 KB |
Output is correct |
32 |
Correct |
4 ms |
5588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4992 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4992 KB |
Output is correct |
14 |
Correct |
3 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 |
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 |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
4948 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
7 |
Correct |
3 ms |
4968 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
4948 KB |
Output is correct |
21 |
Correct |
3 ms |
4948 KB |
Output is correct |
22 |
Correct |
2 ms |
4948 KB |
Output is correct |
23 |
Correct |
2 ms |
4992 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
2 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
2 ms |
4948 KB |
Output is correct |
28 |
Correct |
3 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 |
4948 KB |
Output is correct |
32 |
Correct |
2 ms |
4948 KB |
Output is correct |
33 |
Correct |
2 ms |
4948 KB |
Output is correct |
34 |
Correct |
3 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 ms |
4948 KB |
Output is correct |
36 |
Correct |
3 ms |
4948 KB |
Output is correct |
37 |
Correct |
3 ms |
4948 KB |
Output is correct |
38 |
Correct |
3 ms |
4948 KB |
Output is correct |
39 |
Correct |
3 ms |
4992 KB |
Output is correct |
40 |
Correct |
2 ms |
4968 KB |
Output is correct |
41 |
Correct |
2 ms |
4948 KB |
Output is correct |
42 |
Correct |
3 ms |
4956 KB |
Output is correct |
43 |
Correct |
3 ms |
4948 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
3 ms |
5020 KB |
Output is correct |
46 |
Correct |
3 ms |
4948 KB |
Output is correct |
47 |
Correct |
3 ms |
4992 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
2 ms |
4948 KB |
Output is correct |
50 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
7 |
Correct |
3 ms |
4968 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
4996 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 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 |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
3 ms |
5076 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
28 |
Correct |
3 ms |
4948 KB |
Output is correct |
29 |
Correct |
2 ms |
4948 KB |
Output is correct |
30 |
Correct |
2 ms |
4992 KB |
Output is correct |
31 |
Correct |
3 ms |
4948 KB |
Output is correct |
32 |
Correct |
2 ms |
4992 KB |
Output is correct |
33 |
Correct |
3 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 |
3 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 |
3 ms |
4948 KB |
Output is correct |
42 |
Correct |
3 ms |
4948 KB |
Output is correct |
43 |
Correct |
3 ms |
4948 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
3 ms |
4948 KB |
Output is correct |
46 |
Correct |
3 ms |
4992 KB |
Output is correct |
47 |
Correct |
2 ms |
4968 KB |
Output is correct |
48 |
Correct |
2 ms |
4948 KB |
Output is correct |
49 |
Correct |
3 ms |
4956 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
3 ms |
4948 KB |
Output is correct |
52 |
Correct |
3 ms |
5020 KB |
Output is correct |
53 |
Correct |
3 ms |
4948 KB |
Output is correct |
54 |
Correct |
3 ms |
4992 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 |
4948 KB |
Output is correct |
60 |
Correct |
3 ms |
4948 KB |
Output is correct |
61 |
Correct |
2 ms |
4948 KB |
Output is correct |
62 |
Correct |
3 ms |
4968 KB |
Output is correct |
63 |
Correct |
3 ms |
5076 KB |
Output is correct |
64 |
Correct |
2 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 |
3 ms |
5076 KB |
Output is correct |
68 |
Correct |
2 ms |
5076 KB |
Output is correct |
69 |
Correct |
3 ms |
5076 KB |
Output is correct |
70 |
Correct |
4 ms |
5076 KB |
Output is correct |
71 |
Correct |
2 ms |
5200 KB |
Output is correct |
72 |
Correct |
2 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 |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
7 |
Correct |
3 ms |
4968 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
4996 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 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 |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
3 ms |
5076 KB |
Output is correct |
26 |
Correct |
5 ms |
4948 KB |
Output is correct |
27 |
Correct |
5 ms |
5588 KB |
Output is correct |
28 |
Correct |
5 ms |
5460 KB |
Output is correct |
29 |
Correct |
4 ms |
5588 KB |
Output is correct |
30 |
Correct |
4 ms |
5460 KB |
Output is correct |
31 |
Correct |
5 ms |
5460 KB |
Output is correct |
32 |
Correct |
4 ms |
5588 KB |
Output is correct |
33 |
Correct |
4 ms |
5588 KB |
Output is correct |
34 |
Correct |
3 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 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 |
4992 KB |
Output is correct |
39 |
Correct |
3 ms |
4948 KB |
Output is correct |
40 |
Correct |
2 ms |
4992 KB |
Output is correct |
41 |
Correct |
3 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 |
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 |
3 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
3 ms |
4948 KB |
Output is correct |
52 |
Correct |
3 ms |
4948 KB |
Output is correct |
53 |
Correct |
3 ms |
4948 KB |
Output is correct |
54 |
Correct |
3 ms |
4992 KB |
Output is correct |
55 |
Correct |
2 ms |
4968 KB |
Output is correct |
56 |
Correct |
2 ms |
4948 KB |
Output is correct |
57 |
Correct |
3 ms |
4956 KB |
Output is correct |
58 |
Correct |
3 ms |
4948 KB |
Output is correct |
59 |
Correct |
3 ms |
4948 KB |
Output is correct |
60 |
Correct |
3 ms |
5020 KB |
Output is correct |
61 |
Correct |
3 ms |
4948 KB |
Output is correct |
62 |
Correct |
3 ms |
4992 KB |
Output is correct |
63 |
Correct |
2 ms |
4948 KB |
Output is correct |
64 |
Correct |
2 ms |
4948 KB |
Output is correct |
65 |
Correct |
2 ms |
4948 KB |
Output is correct |
66 |
Correct |
3 ms |
4948 KB |
Output is correct |
67 |
Correct |
3 ms |
4948 KB |
Output is correct |
68 |
Correct |
3 ms |
4948 KB |
Output is correct |
69 |
Correct |
2 ms |
4948 KB |
Output is correct |
70 |
Correct |
3 ms |
4968 KB |
Output is correct |
71 |
Correct |
3 ms |
5076 KB |
Output is correct |
72 |
Correct |
2 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 |
3 ms |
5076 KB |
Output is correct |
76 |
Correct |
2 ms |
5076 KB |
Output is correct |
77 |
Correct |
3 ms |
5076 KB |
Output is correct |
78 |
Correct |
4 ms |
5076 KB |
Output is correct |
79 |
Correct |
2 ms |
5200 KB |
Output is correct |
80 |
Correct |
2 ms |
5076 KB |
Output is correct |
81 |
Correct |
2 ms |
5076 KB |
Output is correct |
82 |
Correct |
3 ms |
5076 KB |
Output is correct |
83 |
Correct |
3 ms |
4948 KB |
Output is correct |
84 |
Correct |
3 ms |
5076 KB |
Output is correct |
85 |
Correct |
5 ms |
5076 KB |
Output is correct |
86 |
Correct |
4 ms |
5076 KB |
Output is correct |
87 |
Correct |
4 ms |
5100 KB |
Output is correct |
88 |
Correct |
4 ms |
5076 KB |
Output is correct |
89 |
Correct |
5 ms |
5460 KB |
Output is correct |
90 |
Correct |
4 ms |
5376 KB |
Output is correct |
91 |
Correct |
4 ms |
5460 KB |
Output is correct |
92 |
Correct |
4 ms |
5332 KB |
Output is correct |
93 |
Correct |
5 ms |
5332 KB |
Output is correct |
94 |
Correct |
5 ms |
5504 KB |
Output is correct |
95 |
Correct |
5 ms |
5508 KB |
Output is correct |
96 |
Correct |
4 ms |
5460 KB |
Output is correct |
97 |
Correct |
5 ms |
5460 KB |
Output is correct |
98 |
Correct |
4 ms |
5332 KB |
Output is correct |
99 |
Correct |
3 ms |
5332 KB |
Output is correct |
100 |
Correct |
5 ms |
5288 KB |
Output is correct |
101 |
Correct |
4 ms |
5076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 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 |
4992 KB |
Output is correct |
7 |
Correct |
3 ms |
4968 KB |
Output is correct |
8 |
Correct |
3 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 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 |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
3 ms |
4948 KB |
Output is correct |
19 |
Correct |
3 ms |
4996 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 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 |
3 ms |
5076 KB |
Output is correct |
25 |
Correct |
3 ms |
5076 KB |
Output is correct |
26 |
Correct |
5 ms |
4948 KB |
Output is correct |
27 |
Correct |
5 ms |
5588 KB |
Output is correct |
28 |
Correct |
5 ms |
5460 KB |
Output is correct |
29 |
Correct |
4 ms |
5588 KB |
Output is correct |
30 |
Correct |
4 ms |
5460 KB |
Output is correct |
31 |
Correct |
5 ms |
5460 KB |
Output is correct |
32 |
Correct |
4 ms |
5588 KB |
Output is correct |
33 |
Correct |
4 ms |
5588 KB |
Output is correct |
34 |
Correct |
3 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 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 |
4992 KB |
Output is correct |
39 |
Correct |
3 ms |
4948 KB |
Output is correct |
40 |
Correct |
2 ms |
4992 KB |
Output is correct |
41 |
Correct |
3 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 |
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 |
3 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4948 KB |
Output is correct |
51 |
Correct |
3 ms |
4948 KB |
Output is correct |
52 |
Correct |
3 ms |
4948 KB |
Output is correct |
53 |
Correct |
3 ms |
4948 KB |
Output is correct |
54 |
Correct |
3 ms |
4992 KB |
Output is correct |
55 |
Correct |
2 ms |
4968 KB |
Output is correct |
56 |
Correct |
2 ms |
4948 KB |
Output is correct |
57 |
Correct |
3 ms |
4956 KB |
Output is correct |
58 |
Correct |
3 ms |
4948 KB |
Output is correct |
59 |
Correct |
3 ms |
4948 KB |
Output is correct |
60 |
Correct |
3 ms |
5020 KB |
Output is correct |
61 |
Correct |
3 ms |
4948 KB |
Output is correct |
62 |
Correct |
3 ms |
4992 KB |
Output is correct |
63 |
Correct |
2 ms |
4948 KB |
Output is correct |
64 |
Correct |
2 ms |
4948 KB |
Output is correct |
65 |
Correct |
2 ms |
4948 KB |
Output is correct |
66 |
Correct |
3 ms |
4948 KB |
Output is correct |
67 |
Correct |
3 ms |
4948 KB |
Output is correct |
68 |
Correct |
3 ms |
4948 KB |
Output is correct |
69 |
Correct |
2 ms |
4948 KB |
Output is correct |
70 |
Correct |
3 ms |
4968 KB |
Output is correct |
71 |
Correct |
3 ms |
5076 KB |
Output is correct |
72 |
Correct |
2 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 |
3 ms |
5076 KB |
Output is correct |
76 |
Correct |
2 ms |
5076 KB |
Output is correct |
77 |
Correct |
3 ms |
5076 KB |
Output is correct |
78 |
Correct |
4 ms |
5076 KB |
Output is correct |
79 |
Correct |
2 ms |
5200 KB |
Output is correct |
80 |
Correct |
2 ms |
5076 KB |
Output is correct |
81 |
Correct |
2 ms |
5076 KB |
Output is correct |
82 |
Correct |
3 ms |
5076 KB |
Output is correct |
83 |
Correct |
3 ms |
4948 KB |
Output is correct |
84 |
Correct |
3 ms |
5076 KB |
Output is correct |
85 |
Correct |
5 ms |
5076 KB |
Output is correct |
86 |
Correct |
4 ms |
5076 KB |
Output is correct |
87 |
Correct |
4 ms |
5100 KB |
Output is correct |
88 |
Correct |
4 ms |
5076 KB |
Output is correct |
89 |
Correct |
5 ms |
5460 KB |
Output is correct |
90 |
Correct |
4 ms |
5376 KB |
Output is correct |
91 |
Correct |
4 ms |
5460 KB |
Output is correct |
92 |
Correct |
4 ms |
5332 KB |
Output is correct |
93 |
Correct |
5 ms |
5332 KB |
Output is correct |
94 |
Correct |
5 ms |
5504 KB |
Output is correct |
95 |
Correct |
5 ms |
5508 KB |
Output is correct |
96 |
Correct |
4 ms |
5460 KB |
Output is correct |
97 |
Correct |
5 ms |
5460 KB |
Output is correct |
98 |
Correct |
4 ms |
5332 KB |
Output is correct |
99 |
Correct |
3 ms |
5332 KB |
Output is correct |
100 |
Correct |
5 ms |
5288 KB |
Output is correct |
101 |
Correct |
4 ms |
5076 KB |
Output is correct |
102 |
Correct |
82 ms |
7608 KB |
Output is correct |
103 |
Correct |
69 ms |
7556 KB |
Output is correct |
104 |
Correct |
168 ms |
38144 KB |
Output is correct |
105 |
Correct |
104 ms |
10116 KB |
Output is correct |
106 |
Correct |
99 ms |
9400 KB |
Output is correct |
107 |
Correct |
79 ms |
29632 KB |
Output is correct |
108 |
Correct |
75 ms |
30280 KB |
Output is correct |
109 |
Correct |
109 ms |
39876 KB |
Output is correct |
110 |
Correct |
183 ms |
32956 KB |
Output is correct |
111 |
Correct |
110 ms |
38356 KB |
Output is correct |
112 |
Correct |
236 ms |
32616 KB |
Output is correct |
113 |
Correct |
244 ms |
31444 KB |
Output is correct |
114 |
Correct |
192 ms |
31440 KB |
Output is correct |
115 |
Correct |
109 ms |
43324 KB |
Output is correct |
116 |
Correct |
277 ms |
35852 KB |
Output is correct |
117 |
Correct |
242 ms |
35440 KB |
Output is correct |
118 |
Correct |
222 ms |
32736 KB |
Output is correct |
119 |
Correct |
130 ms |
12252 KB |
Output is correct |
120 |
Correct |
91 ms |
8720 KB |
Output is correct |