// correct/solution-wiwitrifai-set.cpp
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
constexpr long long kInf = 2e18;
struct GreedyPicker
{
vector<long long> vals;
set<pair<long long, int>> ins;
set<pair<long long, int>> outs;
vector<bool> active;
long long total;
int cnt;
GreedyPicker(vector<long long> _vals, bool _active) : vals(_vals)
{
int n = vals.size();
active.assign(n, _active);
cnt = 0;
total = 0;
if (_active)
{
for (int i = 0; i < n; ++i)
{
outs.emplace(vals[i], i);
}
}
}
bool inc()
{
while (!outs.empty())
{
auto it = outs.begin();
auto [val, id] = *it;
outs.erase(it);
total += val;
++cnt;
ins.emplace(val, id);
return true;
}
return false;
}
bool dec()
{
while (!ins.empty())
{
auto it = --ins.end();
auto [val, id] = *it;
ins.erase(it);
total -= val;
--cnt;
outs.emplace(val, id);
return true;
}
return false;
}
long long top()
{
return ins.empty() ? -1 : ins.rbegin()->first;
}
long long check_inc()
{
return outs.empty() ? kInf : outs.begin()->first;
}
void deactivate(int v)
{
if (!active[v])
return;
if (ins.erase({vals[v], v}))
{
--cnt;
total -= vals[v];
}
else
{
outs.erase({vals[v], v});
}
}
void activate(int v)
{
if (active[v])
return;
active[v] = true;
if (vals[v] <= top())
{
ins.emplace(vals[v], v);
++cnt;
total += vals[v];
}
else
{
outs.emplace(vals[v], v);
}
}
};
vector<vector<pair<int, int>>> tree;
void dfs(int v, int par, vector<long long> &dist)
{
for (auto [u, w] : tree[v])
{
if (u == par)
continue;
dist[u] = dist[v] + w;
dfs(u, v, dist);
}
}
int max_score(int N, int X, int Y, long long K,
vector<int> U, vector<int> V, vector<int> W)
{
tree.assign(N, {});
for (int i = 0; i < N - 1; ++i)
{
tree[U[i]].emplace_back(V[i], W[i]);
tree[V[i]].emplace_back(U[i], W[i]);
}
vector<long long> from_x(N, 0), from_y(N, 0);
dfs(X, X, from_x);
dfs(Y, Y, from_y);
vector<long long> val1(N), val2(N), val_diff(N);
for (int i = 0; i < N; ++i)
{
val1[i] = min(from_x[i], from_y[i]);
val2[i] = max(from_x[i], from_y[i]);
val_diff[i] = val2[i] - val1[i];
}
vector<int> sorted(N);
iota(sorted.begin(), sorted.end(), 0);
int ans = 0;
{
sort(sorted.begin(), sorted.end(), [&](int l, int r)
{ return val1[l] < val1[r]; });
long long total = 0;
for (auto v : sorted)
{
if (total + val1[v] > K)
break;
++ans;
total += val1[v];
}
}
GreedyPicker picker_one(val1, true), picker_two(val2, false);
auto in_path = [&](int v)
{
return from_x[v] + from_y[v] == from_x[Y];
};
int cur = 0;
for (int v = 0; v < N; ++v)
{
if (in_path(v))
{
K -= val1[v];
++cur;
picker_one.deactivate(v);
}
}
sort(sorted.begin(), sorted.end(), [&](int l, int r)
{ return make_pair(val_diff[l], val1[l]) < make_pair(val_diff[r], val1[r]); });
for (auto v : sorted)
{
if (!in_path(v))
{
picker_two.activate(v);
picker_one.deactivate(v);
}
else
{
K -= val_diff[v];
++cur;
}
if (K < 0)
break;
// make sure that the total cost <= K
while (picker_one.total + picker_two.total > K)
{
if (picker_two.top() < 2 * picker_one.top())
{
picker_one.dec();
}
else
{
picker_two.dec();
}
}
// balance between picker_one.top() and picker_two.top()/2
while (2 * picker_one.top() > picker_two.check_inc())
{
if (picker_one.total + picker_two.total + picker_two.check_inc() <= K)
{
picker_two.inc();
}
else
{
picker_one.dec();
}
}
while (2 * picker_one.check_inc() < picker_two.top())
{
if (picker_one.total + picker_two.total + picker_one.check_inc() <= K)
{
picker_one.inc();
}
else
{
picker_two.dec();
}
}
// pick more to fill the remaining space
while (true)
{
auto inc_one = picker_one.check_inc();
auto inc_two = picker_two.check_inc();
auto remaining = K - picker_one.total - picker_two.total;
if (min(inc_one, inc_two) > remaining)
break;
if (inc_one > remaining || (inc_two <= remaining && inc_two <= inc_one * 2))
picker_two.inc();
else
picker_one.inc();
}
ans = max(ans, cur + picker_two.cnt * 2 + picker_one.cnt);
// try to pick two by sacrificing one if it's possible
picker_two.inc();
picker_one.dec();
if (picker_one.total + picker_two.total <= K)
{
ans = max(ans, cur + picker_two.cnt * 2 + picker_one.cnt);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
272 ms |
47304 KB |
Output is correct |
2 |
Correct |
314 ms |
53696 KB |
Output is correct |
3 |
Correct |
102 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
240 KB |
Output is correct |
15 |
Correct |
1 ms |
260 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
240 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
240 KB |
Output is correct |
15 |
Correct |
1 ms |
260 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
240 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
3 ms |
340 KB |
Output is correct |
26 |
Correct |
3 ms |
980 KB |
Output is correct |
27 |
Correct |
3 ms |
980 KB |
Output is correct |
28 |
Correct |
2 ms |
1072 KB |
Output is correct |
29 |
Correct |
3 ms |
980 KB |
Output is correct |
30 |
Correct |
2 ms |
980 KB |
Output is correct |
31 |
Correct |
2 ms |
1108 KB |
Output is correct |
32 |
Correct |
2 ms |
1136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
232 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
240 KB |
Output is correct |
16 |
Correct |
1 ms |
260 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
232 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
212 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
1 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
0 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
300 KB |
Output is correct |
37 |
Correct |
1 ms |
212 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
0 ms |
212 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
296 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
240 KB |
Output is correct |
16 |
Correct |
1 ms |
260 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
240 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
232 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
300 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
1 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
0 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
212 KB |
Output is correct |
54 |
Correct |
1 ms |
212 KB |
Output is correct |
55 |
Correct |
1 ms |
212 KB |
Output is correct |
56 |
Correct |
1 ms |
296 KB |
Output is correct |
57 |
Correct |
1 ms |
212 KB |
Output is correct |
58 |
Correct |
1 ms |
212 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
1 ms |
212 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
340 KB |
Output is correct |
65 |
Correct |
1 ms |
340 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
340 KB |
Output is correct |
69 |
Correct |
1 ms |
308 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
1 ms |
340 KB |
Output is correct |
72 |
Correct |
2 ms |
340 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
2 ms |
296 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
240 KB |
Output is correct |
16 |
Correct |
1 ms |
260 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
240 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
3 ms |
340 KB |
Output is correct |
27 |
Correct |
3 ms |
980 KB |
Output is correct |
28 |
Correct |
3 ms |
980 KB |
Output is correct |
29 |
Correct |
2 ms |
1072 KB |
Output is correct |
30 |
Correct |
3 ms |
980 KB |
Output is correct |
31 |
Correct |
2 ms |
980 KB |
Output is correct |
32 |
Correct |
2 ms |
1108 KB |
Output is correct |
33 |
Correct |
2 ms |
1136 KB |
Output is correct |
34 |
Correct |
1 ms |
232 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
212 KB |
Output is correct |
37 |
Correct |
1 ms |
212 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
300 KB |
Output is correct |
52 |
Correct |
1 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
212 KB |
Output is correct |
54 |
Correct |
1 ms |
212 KB |
Output is correct |
55 |
Correct |
0 ms |
212 KB |
Output is correct |
56 |
Correct |
1 ms |
212 KB |
Output is correct |
57 |
Correct |
1 ms |
212 KB |
Output is correct |
58 |
Correct |
1 ms |
212 KB |
Output is correct |
59 |
Correct |
1 ms |
212 KB |
Output is correct |
60 |
Correct |
0 ms |
212 KB |
Output is correct |
61 |
Correct |
1 ms |
212 KB |
Output is correct |
62 |
Correct |
1 ms |
212 KB |
Output is correct |
63 |
Correct |
1 ms |
212 KB |
Output is correct |
64 |
Correct |
1 ms |
296 KB |
Output is correct |
65 |
Correct |
1 ms |
212 KB |
Output is correct |
66 |
Correct |
1 ms |
212 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
212 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
1 ms |
340 KB |
Output is correct |
72 |
Correct |
1 ms |
340 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
1 ms |
340 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
308 KB |
Output is correct |
78 |
Correct |
1 ms |
340 KB |
Output is correct |
79 |
Correct |
1 ms |
340 KB |
Output is correct |
80 |
Correct |
2 ms |
340 KB |
Output is correct |
81 |
Correct |
1 ms |
340 KB |
Output is correct |
82 |
Correct |
2 ms |
296 KB |
Output is correct |
83 |
Correct |
1 ms |
340 KB |
Output is correct |
84 |
Correct |
4 ms |
340 KB |
Output is correct |
85 |
Correct |
4 ms |
340 KB |
Output is correct |
86 |
Correct |
2 ms |
340 KB |
Output is correct |
87 |
Correct |
3 ms |
340 KB |
Output is correct |
88 |
Correct |
3 ms |
336 KB |
Output is correct |
89 |
Correct |
5 ms |
884 KB |
Output is correct |
90 |
Correct |
4 ms |
904 KB |
Output is correct |
91 |
Correct |
4 ms |
852 KB |
Output is correct |
92 |
Correct |
3 ms |
852 KB |
Output is correct |
93 |
Correct |
3 ms |
852 KB |
Output is correct |
94 |
Correct |
2 ms |
984 KB |
Output is correct |
95 |
Correct |
4 ms |
1072 KB |
Output is correct |
96 |
Correct |
2 ms |
1000 KB |
Output is correct |
97 |
Correct |
4 ms |
956 KB |
Output is correct |
98 |
Correct |
5 ms |
904 KB |
Output is correct |
99 |
Correct |
4 ms |
892 KB |
Output is correct |
100 |
Correct |
4 ms |
724 KB |
Output is correct |
101 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
240 KB |
Output is correct |
16 |
Correct |
1 ms |
260 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
240 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
3 ms |
340 KB |
Output is correct |
27 |
Correct |
3 ms |
980 KB |
Output is correct |
28 |
Correct |
3 ms |
980 KB |
Output is correct |
29 |
Correct |
2 ms |
1072 KB |
Output is correct |
30 |
Correct |
3 ms |
980 KB |
Output is correct |
31 |
Correct |
2 ms |
980 KB |
Output is correct |
32 |
Correct |
2 ms |
1108 KB |
Output is correct |
33 |
Correct |
2 ms |
1136 KB |
Output is correct |
34 |
Correct |
1 ms |
232 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
212 KB |
Output is correct |
37 |
Correct |
1 ms |
212 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
300 KB |
Output is correct |
52 |
Correct |
1 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
212 KB |
Output is correct |
54 |
Correct |
1 ms |
212 KB |
Output is correct |
55 |
Correct |
0 ms |
212 KB |
Output is correct |
56 |
Correct |
1 ms |
212 KB |
Output is correct |
57 |
Correct |
1 ms |
212 KB |
Output is correct |
58 |
Correct |
1 ms |
212 KB |
Output is correct |
59 |
Correct |
1 ms |
212 KB |
Output is correct |
60 |
Correct |
0 ms |
212 KB |
Output is correct |
61 |
Correct |
1 ms |
212 KB |
Output is correct |
62 |
Correct |
1 ms |
212 KB |
Output is correct |
63 |
Correct |
1 ms |
212 KB |
Output is correct |
64 |
Correct |
1 ms |
296 KB |
Output is correct |
65 |
Correct |
1 ms |
212 KB |
Output is correct |
66 |
Correct |
1 ms |
212 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
212 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
1 ms |
340 KB |
Output is correct |
72 |
Correct |
1 ms |
340 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
1 ms |
340 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
308 KB |
Output is correct |
78 |
Correct |
1 ms |
340 KB |
Output is correct |
79 |
Correct |
1 ms |
340 KB |
Output is correct |
80 |
Correct |
2 ms |
340 KB |
Output is correct |
81 |
Correct |
1 ms |
340 KB |
Output is correct |
82 |
Correct |
2 ms |
296 KB |
Output is correct |
83 |
Correct |
1 ms |
340 KB |
Output is correct |
84 |
Correct |
4 ms |
340 KB |
Output is correct |
85 |
Correct |
4 ms |
340 KB |
Output is correct |
86 |
Correct |
2 ms |
340 KB |
Output is correct |
87 |
Correct |
3 ms |
340 KB |
Output is correct |
88 |
Correct |
3 ms |
336 KB |
Output is correct |
89 |
Correct |
5 ms |
884 KB |
Output is correct |
90 |
Correct |
4 ms |
904 KB |
Output is correct |
91 |
Correct |
4 ms |
852 KB |
Output is correct |
92 |
Correct |
3 ms |
852 KB |
Output is correct |
93 |
Correct |
3 ms |
852 KB |
Output is correct |
94 |
Correct |
2 ms |
984 KB |
Output is correct |
95 |
Correct |
4 ms |
1072 KB |
Output is correct |
96 |
Correct |
2 ms |
1000 KB |
Output is correct |
97 |
Correct |
4 ms |
956 KB |
Output is correct |
98 |
Correct |
5 ms |
904 KB |
Output is correct |
99 |
Correct |
4 ms |
892 KB |
Output is correct |
100 |
Correct |
4 ms |
724 KB |
Output is correct |
101 |
Correct |
3 ms |
340 KB |
Output is correct |
102 |
Correct |
178 ms |
4660 KB |
Output is correct |
103 |
Correct |
180 ms |
4712 KB |
Output is correct |
104 |
Correct |
404 ms |
52028 KB |
Output is correct |
105 |
Correct |
248 ms |
6736 KB |
Output is correct |
106 |
Correct |
299 ms |
6220 KB |
Output is correct |
107 |
Correct |
221 ms |
41044 KB |
Output is correct |
108 |
Correct |
224 ms |
42056 KB |
Output is correct |
109 |
Correct |
150 ms |
51716 KB |
Output is correct |
110 |
Correct |
543 ms |
45888 KB |
Output is correct |
111 |
Correct |
238 ms |
49072 KB |
Output is correct |
112 |
Correct |
412 ms |
45076 KB |
Output is correct |
113 |
Correct |
367 ms |
43460 KB |
Output is correct |
114 |
Correct |
248 ms |
44888 KB |
Output is correct |
115 |
Correct |
186 ms |
54792 KB |
Output is correct |
116 |
Correct |
399 ms |
47092 KB |
Output is correct |
117 |
Correct |
339 ms |
46504 KB |
Output is correct |
118 |
Correct |
463 ms |
46168 KB |
Output is correct |
119 |
Correct |
247 ms |
9520 KB |
Output is correct |
120 |
Correct |
171 ms |
4616 KB |
Output is correct |