#include "bits/extc++.h"
using namespace std;
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t;
((cerr << " | " << u), ...);
cerr << endl;
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \
<< ": "; \
dbgh(__VA_ARGS__)
#else
#define cerr \
if (false) \
cerr
#define dbg(...)
#endif
using ll = long long;
#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& arr) {
out << "[";
for (int i = 0; i < sz(arr); i++) {
if (i) {
out << ", ";
}
out << arr[i];
}
return out << "]";
}
template <typename Cb>
struct Cmp {
Cb cb;
Cmp(Cb cb) : cb(cb) {}
template <typename T>
bool operator()(const T& a, const T& b) const {
return cb(a) < cb(b);
}
};
vector<vector<pair<int, long>>> edges_to_adj(
int n,
const vector<tuple<int, int, long>>& edges) {
vector<vector<pair<int, long>>> graph(n);
for (auto& [u, v, w] : edges) {
graph[u].emplace_back(v, w);
graph[v].emplace_back(u, w);
}
return graph;
}
struct DistDFS {
vector<long> dist;
vector<vector<pair<int, long>>> graph;
DistDFS(int root, int n, const vector<tuple<int, int, long>>& edges)
: dist(n), graph(edges_to_adj(n, edges)) {
dfs(root, -1, 0);
}
void dfs(int u, int p, long d) {
dist[u] = d;
for (auto& [v, w] : graph[u]) {
if (v == p) {
continue;
}
dfs(v, u, d + w);
}
}
};
struct PathDFS {
int n;
vector<int> path;
vector<char> on_path;
vector<vector<int>> path_subs;
vector<vector<pair<int, long>>> graph;
PathDFS(int u0, int u1, int n, const vector<tuple<int, int, long>>& edges)
: n(n), on_path(n), graph(edges_to_adj(n, edges)) {
pdfs(u0, -1, u1);
for (auto& a : path) {
on_path[a] = true;
}
for (auto& a : path) {
path_subs.emplace_back();
dfs(a, -1, path_subs.back());
}
}
vector<int> st;
void pdfs(int u, int p, int targ) {
st.push_back(u);
if (u == targ) {
path = st;
}
for (auto& [v, _w] : graph[u]) {
if (v == p) {
continue;
}
pdfs(v, u, targ);
}
st.pop_back();
}
void dfs(int u, int p, vector<int>& out) {
out.push_back(u);
for (auto& [v, _w] : graph[u]) {
if (v == p || on_path[v]) {
continue;
}
dfs(v, u, out);
}
}
};
struct DS {
multiset<long> v[2];
void insert(int ind, long x) {
dbg("+", ind, x);
v[ind].insert(x);
}
void erase(int ind, long x) {
dbg("-", ind, x);
assert(v[ind].find(x) != v[ind].end());
v[ind].erase(v[ind].find(x));
}
int query(long kv) {
vector<long> ps0 {0}, ps1 {0};
for (auto& a : v[0]) {
ps0.push_back(ps0.back() + a);
}
for (auto& a : v[1]) {
ps1.push_back(ps1.back() + a);
}
int ans = -1e9;
for (int i = 0, j = sz(ps1) - 1; i < sz(ps0); i++) {
for (; j >= 0 && ps0[i] + ps1[j] > kv; j--)
;
if (j < 0) {
break;
}
ans = max(ans, 2 * i + j);
}
return ans;
}
};
int solve_disjoint(long kv,
const vector<long>& dist0,
const vector<long>& dist1) {
vector<long> dists;
dists.insert(dists.end(), begin(dist0), end(dist0));
dists.insert(dists.end(), begin(dist1), end(dist1));
sort(begin(dists), end(dists));
long sum = 0;
int i;
for (i = 0; i < sz(dists); i++) {
sum += dists[i];
if (sum > kv) {
break;
}
}
return i;
}
int solve(int n, int u0, int u1, long kv, vector<tuple<int, int, long>> edges) {
auto dist0 = DistDFS(u0, n, edges).dist, dist1 = DistDFS(u1, n, edges).dist;
auto path_dfs = PathDFS(u0, u1, n, edges);
auto path = path_dfs.path_subs;
int m = sz(path);
vector<long> cost1(n), cost2(n), delta(n);
for (int i = 0; i < n; i++) {
cost1[i] = min(dist0[i], dist1[i]);
cost2[i] = max(dist0[i], dist1[i]);
delta[i] = cost2[i] - cost1[i];
}
map<long, vector<int>> mp;
for (int i = 0; i < m; i++) {
mp[delta[path[i][0]]].push_back(i);
}
DS ds;
int ans = solve_disjoint(kv, dist0, dist1);
dbg(ans);
int ans_add = 0;
long min_cost = 0;
for (auto& a : path_dfs.path) {
ans_add++;
min_cost += cost1[a];
}
auto move_vals = [&](vector<int> nodes, bool undo) -> void {
sort(begin(nodes), end(nodes),
Cmp([&](int u) -> long { return cost1[u]; }));
for (auto& u : nodes) {
if (path_dfs.on_path[u]) {
ans_add++;
min_cost += delta[u];
} else {
ds.erase(1, cost1[u]);
ds.insert(0, cost2[u]);
}
ans = max(ans, ans_add + ds.query(kv - min_cost));
dbg(ans, ans_add, min_cost);
}
if (!undo) {
return;
}
for (auto& u : nodes) {
if (path_dfs.on_path[u]) {
ans_add--;
min_cost -= delta[u];
} else {
ds.insert(1, cost1[u]);
ds.erase(0, cost2[u]);
}
}
};
for (int i = 0; i < n; i++) {
if (path_dfs.on_path[i]) {
continue;
}
ds.insert(1, cost1[i]);
}
for (auto& [_k, vals] : mp) {
dbg(vals);
if (sz(vals) == 1) {
move_vals(path[vals[0]], false);
continue;
}
assert(sz(vals) == 2);
dbg(ans_add, min_cost);
move_vals(path[vals[0]], true);
dbg(ans_add, min_cost);
move_vals(path[vals[1]], false);
move_vals(path[vals[0]], false);
}
return ans;
}
int max_score(int n,
int u0,
int u1,
ll kv,
vector<int> edges_u,
vector<int> edges_v,
vector<int> edges_w) {
vector<tuple<int, int, long>> edges;
for (int i = 0; i < n - 1; i++) {
edges.emplace_back(edges_u[i], edges_v[i], edges_w[i]);
}
return solve(n, u0, u1, kv, edges);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1030 ms |
63480 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
444 KB |
Output is correct |
17 |
Correct |
0 ms |
440 KB |
Output is correct |
18 |
Correct |
1 ms |
500 KB |
Output is correct |
19 |
Correct |
4 ms |
348 KB |
Output is correct |
20 |
Correct |
2 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
2 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
444 KB |
Output is correct |
17 |
Correct |
0 ms |
440 KB |
Output is correct |
18 |
Correct |
1 ms |
500 KB |
Output is correct |
19 |
Correct |
4 ms |
348 KB |
Output is correct |
20 |
Correct |
2 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
2 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
5 ms |
348 KB |
Output is correct |
26 |
Correct |
83 ms |
1240 KB |
Output is correct |
27 |
Correct |
69 ms |
1216 KB |
Output is correct |
28 |
Correct |
3 ms |
1528 KB |
Output is correct |
29 |
Correct |
21 ms |
1508 KB |
Output is correct |
30 |
Correct |
54 ms |
1280 KB |
Output is correct |
31 |
Correct |
3 ms |
1748 KB |
Output is correct |
32 |
Correct |
3 ms |
1752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 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 |
436 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
432 KB |
Output is correct |
16 |
Correct |
1 ms |
884 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
444 KB |
Output is correct |
18 |
Correct |
0 ms |
440 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
436 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
432 KB |
Output is correct |
28 |
Correct |
1 ms |
884 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 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 |
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 |
440 KB |
Output is correct |
44 |
Correct |
1 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
344 KB |
Output is correct |
46 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
444 KB |
Output is correct |
18 |
Correct |
0 ms |
440 KB |
Output is correct |
19 |
Correct |
1 ms |
500 KB |
Output is correct |
20 |
Correct |
4 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
2 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
604 KB |
Output is correct |
26 |
Correct |
0 ms |
348 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 |
436 KB |
Output is correct |
31 |
Correct |
1 ms |
604 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
432 KB |
Output is correct |
35 |
Correct |
1 ms |
884 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
1 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 |
344 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
440 KB |
Output is correct |
51 |
Correct |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
344 KB |
Output is correct |
53 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
444 KB |
Output is correct |
59 |
Correct |
2 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 |
4 ms |
348 KB |
Output is correct |
64 |
Correct |
2 ms |
348 KB |
Output is correct |
65 |
Correct |
2 ms |
348 KB |
Output is correct |
66 |
Correct |
4 ms |
348 KB |
Output is correct |
67 |
Correct |
3 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
604 KB |
Output is correct |
69 |
Correct |
1 ms |
604 KB |
Output is correct |
70 |
Correct |
2 ms |
348 KB |
Output is correct |
71 |
Correct |
2 ms |
344 KB |
Output is correct |
72 |
Correct |
2 ms |
436 KB |
Output is correct |
73 |
Correct |
3 ms |
600 KB |
Output is correct |
74 |
Correct |
2 ms |
344 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
444 KB |
Output is correct |
18 |
Correct |
0 ms |
440 KB |
Output is correct |
19 |
Correct |
1 ms |
500 KB |
Output is correct |
20 |
Correct |
4 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
2 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
604 KB |
Output is correct |
26 |
Correct |
5 ms |
348 KB |
Output is correct |
27 |
Correct |
83 ms |
1240 KB |
Output is correct |
28 |
Correct |
69 ms |
1216 KB |
Output is correct |
29 |
Correct |
3 ms |
1528 KB |
Output is correct |
30 |
Correct |
21 ms |
1508 KB |
Output is correct |
31 |
Correct |
54 ms |
1280 KB |
Output is correct |
32 |
Correct |
3 ms |
1748 KB |
Output is correct |
33 |
Correct |
3 ms |
1752 KB |
Output is correct |
34 |
Correct |
0 ms |
348 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 |
436 KB |
Output is correct |
39 |
Correct |
1 ms |
604 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
432 KB |
Output is correct |
43 |
Correct |
1 ms |
884 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
344 KB |
Output is correct |
47 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 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 |
344 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
0 ms |
440 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
344 KB |
Output is correct |
61 |
Correct |
0 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 |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
444 KB |
Output is correct |
67 |
Correct |
2 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 |
4 ms |
348 KB |
Output is correct |
72 |
Correct |
2 ms |
348 KB |
Output is correct |
73 |
Correct |
2 ms |
348 KB |
Output is correct |
74 |
Correct |
4 ms |
348 KB |
Output is correct |
75 |
Correct |
3 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
1 ms |
604 KB |
Output is correct |
78 |
Correct |
2 ms |
348 KB |
Output is correct |
79 |
Correct |
2 ms |
344 KB |
Output is correct |
80 |
Correct |
2 ms |
436 KB |
Output is correct |
81 |
Correct |
3 ms |
600 KB |
Output is correct |
82 |
Correct |
2 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
5 ms |
348 KB |
Output is correct |
85 |
Correct |
8 ms |
348 KB |
Output is correct |
86 |
Correct |
6 ms |
348 KB |
Output is correct |
87 |
Correct |
6 ms |
476 KB |
Output is correct |
88 |
Correct |
6 ms |
348 KB |
Output is correct |
89 |
Correct |
84 ms |
1248 KB |
Output is correct |
90 |
Correct |
99 ms |
1408 KB |
Output is correct |
91 |
Correct |
58 ms |
1116 KB |
Output is correct |
92 |
Correct |
53 ms |
1116 KB |
Output is correct |
93 |
Correct |
61 ms |
1116 KB |
Output is correct |
94 |
Correct |
18 ms |
1372 KB |
Output is correct |
95 |
Correct |
16 ms |
1372 KB |
Output is correct |
96 |
Correct |
27 ms |
1368 KB |
Output is correct |
97 |
Correct |
41 ms |
1116 KB |
Output is correct |
98 |
Correct |
58 ms |
1360 KB |
Output is correct |
99 |
Correct |
65 ms |
1216 KB |
Output is correct |
100 |
Correct |
37 ms |
860 KB |
Output is correct |
101 |
Correct |
11 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
444 KB |
Output is correct |
18 |
Correct |
0 ms |
440 KB |
Output is correct |
19 |
Correct |
1 ms |
500 KB |
Output is correct |
20 |
Correct |
4 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
2 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
604 KB |
Output is correct |
26 |
Correct |
5 ms |
348 KB |
Output is correct |
27 |
Correct |
83 ms |
1240 KB |
Output is correct |
28 |
Correct |
69 ms |
1216 KB |
Output is correct |
29 |
Correct |
3 ms |
1528 KB |
Output is correct |
30 |
Correct |
21 ms |
1508 KB |
Output is correct |
31 |
Correct |
54 ms |
1280 KB |
Output is correct |
32 |
Correct |
3 ms |
1748 KB |
Output is correct |
33 |
Correct |
3 ms |
1752 KB |
Output is correct |
34 |
Correct |
0 ms |
348 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 |
436 KB |
Output is correct |
39 |
Correct |
1 ms |
604 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
432 KB |
Output is correct |
43 |
Correct |
1 ms |
884 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
344 KB |
Output is correct |
47 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 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 |
344 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
0 ms |
440 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
344 KB |
Output is correct |
61 |
Correct |
0 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 |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
444 KB |
Output is correct |
67 |
Correct |
2 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 |
4 ms |
348 KB |
Output is correct |
72 |
Correct |
2 ms |
348 KB |
Output is correct |
73 |
Correct |
2 ms |
348 KB |
Output is correct |
74 |
Correct |
4 ms |
348 KB |
Output is correct |
75 |
Correct |
3 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
1 ms |
604 KB |
Output is correct |
78 |
Correct |
2 ms |
348 KB |
Output is correct |
79 |
Correct |
2 ms |
344 KB |
Output is correct |
80 |
Correct |
2 ms |
436 KB |
Output is correct |
81 |
Correct |
3 ms |
600 KB |
Output is correct |
82 |
Correct |
2 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
5 ms |
348 KB |
Output is correct |
85 |
Correct |
8 ms |
348 KB |
Output is correct |
86 |
Correct |
6 ms |
348 KB |
Output is correct |
87 |
Correct |
6 ms |
476 KB |
Output is correct |
88 |
Correct |
6 ms |
348 KB |
Output is correct |
89 |
Correct |
84 ms |
1248 KB |
Output is correct |
90 |
Correct |
99 ms |
1408 KB |
Output is correct |
91 |
Correct |
58 ms |
1116 KB |
Output is correct |
92 |
Correct |
53 ms |
1116 KB |
Output is correct |
93 |
Correct |
61 ms |
1116 KB |
Output is correct |
94 |
Correct |
18 ms |
1372 KB |
Output is correct |
95 |
Correct |
16 ms |
1372 KB |
Output is correct |
96 |
Correct |
27 ms |
1368 KB |
Output is correct |
97 |
Correct |
41 ms |
1116 KB |
Output is correct |
98 |
Correct |
58 ms |
1360 KB |
Output is correct |
99 |
Correct |
65 ms |
1216 KB |
Output is correct |
100 |
Correct |
37 ms |
860 KB |
Output is correct |
101 |
Correct |
11 ms |
604 KB |
Output is correct |
102 |
Correct |
386 ms |
5580 KB |
Output is correct |
103 |
Correct |
681 ms |
5704 KB |
Output is correct |
104 |
Execution timed out |
1062 ms |
71272 KB |
Time limit exceeded |
105 |
Halted |
0 ms |
0 KB |
- |