#include "closing.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <queue>
typedef long long llong;
const int MAXN = 3000 + 10;
const llong INF = 8e18;
const int INTINF = 2e9;
int n;
int x;
int y;
llong k;
int sz[MAXN];
int par[MAXN];
bool isOnPath[MAXN];
std::vector <int> path;
std::vector <int> pathSizes;
std::vector <std::pair <int,int>> g[MAXN];
std::vector <int> suffixSizes[MAXN];
llong dpR[MAXN][2 * MAXN][2][2]; // root
llong dpC[MAXN][2 * MAXN][2][2]; // children, knapsack
llong dpS[MAXN][2 * MAXN][2][2]; // stick
bool blR[MAXN][2 * MAXN][2][2];
bool blC[MAXN][2 * MAXN][2][2];
bool blS[MAXN][2 * MAXN][2][2];
llong distX[MAXN];
llong distY[MAXN];
void reset()
{
path.clear();
pathSizes.clear();
for (int i = 0 ; i < n ; ++i)
{
g[i].clear();
suffixSizes[i].clear();
isOnPath[i] = false;
distX[i] = distY[i] = 0;
for (int j = 0 ; j <= 2 * n ; ++j)
{
for (int flagX = 0 ; flagX < 2 ; ++flagX)
{
for (int flagY = 0 ; flagY < 2 ; ++flagY)
{
dpR[i][j][flagX][flagY] = 0;
dpC[i][j][flagX][flagY] = 0;
dpS[i][j][flagX][flagY] = 0;
blR[i][j][flagX][flagY] = false;
blC[i][j][flagX][flagY] = false;
blS[i][j][flagX][flagY] = false;
}
}
}
}
}
void dfs(int node, int par, llong to[], llong dist)
{
to[node] = dist;
for (const auto &[u, d] : g[node])
{
if (u == par)
{
continue;
}
dfs(u, node, to, dist + d);
}
}
bool dfsPath(int node, int par)
{
if (node == y)
{
path.push_back(node);
return true;
}
for (const auto &[u, d] : g[node])
{
if (u == par)
{
continue;
}
if (dfsPath(u, node))
{
path.push_back(node);
return true;
}
}
return false;
}
void dfsSize(int node, int p)
{
sz[node] = 1;
par[node] = p;
for (const auto &[u, d] : g[node])
{
if (p == u)
{
continue;
}
dfsSize(u, node);
if (!isOnPath[u]) sz[node] += sz[u];
}
}
llong fRoot(int, int, int, int);
llong fChildren(int, int, int, int, int);
llong fStick(int, int, int, int);
llong stepsRoot;
llong stepsChildren;
llong stepsStick;
llong fRoot(int node, int choose, int flagX, int flagY)
{
stepsRoot++;
if (choose == 0)
{
return 0;
}
if (!flagX && !flagY)
{
return k + 1;
}
if (blR[node][choose][flagX][flagY])
{
return dpR[node][choose][flagX][flagY];
}
blR[node][choose][flagX][flagY] = true;
dpR[node][choose][flagX][flagY] = fChildren(node, 0, choose, flagX, flagY);
dpR[node][choose][flagX][flagY] = std::min(dpR[node][choose][flagX][flagY], k + 1);
return dpR[node][choose][flagX][flagY];
}
llong fChildren(int node, int idx, int choose, int flagX, int flagY)
{
stepsChildren++;
if (idx == g[node].size())
{
if (choose == 0) return 0;
return k + 1;
}
int current = g[node][idx].first;
if (isOnPath[current] || current == par[node])
{
return fChildren(node, idx + 1, choose, flagX, flagY);
}
if (blC[current][choose][flagX][flagY])
{
return dpC[current][choose][flagX][flagY];
}
blC[current][choose][flagX][flagY] = true;
dpC[current][choose][flagX][flagY] = k + 1;
for (int currX = 0 ; currX <= flagX ; ++currX)
{
for (int currY = 0 ; currY <= flagY ; ++currY)
{
for (int subtreeChoose = std::max(choose - (flagX + flagY) * suffixSizes[node][idx + 1], currX + currY) ; subtreeChoose <= std::min((currX + currY) * sz[g[node][idx].first], choose) ; ++subtreeChoose)
{
stepsChildren++;
dpC[current][choose][flagX][flagY] = std::min(dpC[current][choose][flagX][flagY], fChildren(node, idx + 1, choose - subtreeChoose, flagX, flagY) + std::max((currX == 0 ? 0 : distX[current]), (currY == 0 ? 0 : distY[current])) + fRoot(current, subtreeChoose - currX - currY, currX, currY));
}
}
}
return dpC[current][choose][flagX][flagY];
}
llong fStick(int idx, int choose, int flagX, int flagY)
{
stepsStick++;
if (idx == path.size())
{
if (choose == 0) return 0;
return k + 1;
}
if (blS[idx][choose][flagX][flagY])
{
return dpS[idx][choose][flagX][flagY];
}
blS[idx][choose][flagX][flagY] = true;
dpS[idx][choose][flagX][flagY] = k + 1;
for (int currX = 0 ; currX <= flagX ; ++currX)
{
for (int currY = flagY ; currY <= 1 ; ++currY)
{
for (int subtreeChoose = std::max(choose - (1 + (currX == 1)) * pathSizes[idx + 1], currX + currY) ; subtreeChoose <= std::min((currX + currY) * sz[path[idx]], choose) ; ++subtreeChoose)
{
stepsStick++;
int val = dpS[idx][choose][flagX][flagY];
dpS[idx][choose][flagX][flagY] = std::min(dpS[idx][choose][flagX][flagY], fStick(idx + 1, choose - subtreeChoose, currX, currY) + std::max((currX == 0 ? 0 : distX[path[idx]]), (currY == 0 ? 0 : distY[path[idx]])) + fRoot(path[idx], subtreeChoose - currX - currY, currX, currY));
}
}
}
return dpS[idx][choose][flagX][flagY];
}
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 = N;
x = X;
y = Y;
k = K;
for (int i = 0 ; i < n - 1 ; ++i)
{
g[U[i]].emplace_back(V[i], W[i]);
g[V[i]].emplace_back(U[i], W[i]);
}
dfs(x, -1, distX, 0);
dfs(y, -1, distY, 0);
dfsPath(x, -1);
std::reverse(path.begin(), path.end());
for (const int &i : path)
{
isOnPath[i] = true;
}
dfsSize(x, -1);
for (int i = 0 ; i < n ; ++i)
{
suffixSizes[i].resize(g[i].size() + 1, 0);
for (int j = g[i].size() - 1 ; j >= 0 ; --j)
{
int add = 0;
suffixSizes[i][j] = suffixSizes[i][j + 1];
if (!isOnPath[g[i][j].first] && g[i][j].first != par[i])
{
add = sz[g[i][j].first];
}
suffixSizes[i][j] += add;
}
}
pathSizes.resize(path.size() + 1, 0);
for (int i = path.size() - 1 ; i >= 0 ; --i)
{
pathSizes[i] = pathSizes[i + 1] + sz[path[i]];
}
for (int i = 2 * n ; i >= 1 ; --i)
{
if (fStick(0, i, 1, 0) <= k)
{
return i;
}
}
return 0;
}
Compilation message
closing.cpp: In function 'llong fChildren(int, int, int, int, int)':
closing.cpp:151:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
151 | if (idx == g[node].size())
| ~~~~^~~~~~~~~~~~~~~~~
closing.cpp: In function 'llong fStick(int, int, int, int)':
closing.cpp:189:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
189 | if (idx == path.size())
| ~~~~^~~~~~~~~~~~~~
closing.cpp:209:21: warning: unused variable 'val' [-Wunused-variable]
209 | int val = dpS[idx][choose][flagX][flagY];
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
57 ms |
5212 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
7004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
7004 KB |
Output is correct |
12 |
Correct |
2 ms |
8540 KB |
Output is correct |
13 |
Correct |
2 ms |
8784 KB |
Output is correct |
14 |
Correct |
2 ms |
7772 KB |
Output is correct |
15 |
Correct |
2 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
1628 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
3164 KB |
Output is correct |
19 |
Correct |
12 ms |
15196 KB |
Output is correct |
20 |
Correct |
25 ms |
21340 KB |
Output is correct |
21 |
Correct |
5 ms |
7516 KB |
Output is correct |
22 |
Correct |
30 ms |
18584 KB |
Output is correct |
23 |
Correct |
18 ms |
13912 KB |
Output is correct |
24 |
Correct |
20 ms |
14168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
7004 KB |
Output is correct |
12 |
Correct |
2 ms |
8540 KB |
Output is correct |
13 |
Correct |
2 ms |
8784 KB |
Output is correct |
14 |
Correct |
2 ms |
7772 KB |
Output is correct |
15 |
Correct |
2 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
1628 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
3164 KB |
Output is correct |
19 |
Correct |
12 ms |
15196 KB |
Output is correct |
20 |
Correct |
25 ms |
21340 KB |
Output is correct |
21 |
Correct |
5 ms |
7516 KB |
Output is correct |
22 |
Correct |
30 ms |
18584 KB |
Output is correct |
23 |
Correct |
18 ms |
13912 KB |
Output is correct |
24 |
Correct |
20 ms |
14168 KB |
Output is correct |
25 |
Correct |
9 ms |
4184 KB |
Output is correct |
26 |
Correct |
122 ms |
131408 KB |
Output is correct |
27 |
Correct |
696 ms |
367112 KB |
Output is correct |
28 |
Correct |
34 ms |
45392 KB |
Output is correct |
29 |
Correct |
66 ms |
72464 KB |
Output is correct |
30 |
Correct |
602 ms |
293204 KB |
Output is correct |
31 |
Correct |
842 ms |
293460 KB |
Output is correct |
32 |
Correct |
790 ms |
292660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
6744 KB |
Output is correct |
8 |
Correct |
1 ms |
6744 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
600 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Correct |
0 ms |
860 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
6748 KB |
Output is correct |
18 |
Correct |
1 ms |
6748 KB |
Output is correct |
19 |
Correct |
1 ms |
6748 KB |
Output is correct |
20 |
Correct |
1 ms |
6744 KB |
Output is correct |
21 |
Correct |
0 ms |
860 KB |
Output is correct |
22 |
Correct |
0 ms |
860 KB |
Output is correct |
23 |
Correct |
0 ms |
860 KB |
Output is correct |
24 |
Correct |
0 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
7004 KB |
Output is correct |
13 |
Correct |
2 ms |
8540 KB |
Output is correct |
14 |
Correct |
2 ms |
8784 KB |
Output is correct |
15 |
Correct |
2 ms |
7772 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
1628 KB |
Output is correct |
19 |
Correct |
1 ms |
6744 KB |
Output is correct |
20 |
Correct |
1 ms |
6744 KB |
Output is correct |
21 |
Correct |
0 ms |
604 KB |
Output is correct |
22 |
Correct |
0 ms |
860 KB |
Output is correct |
23 |
Correct |
1 ms |
860 KB |
Output is correct |
24 |
Correct |
1 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
0 ms |
860 KB |
Output is correct |
27 |
Correct |
0 ms |
604 KB |
Output is correct |
28 |
Correct |
0 ms |
860 KB |
Output is correct |
29 |
Correct |
1 ms |
6748 KB |
Output is correct |
30 |
Correct |
1 ms |
6748 KB |
Output is correct |
31 |
Correct |
1 ms |
6748 KB |
Output is correct |
32 |
Correct |
1 ms |
6744 KB |
Output is correct |
33 |
Correct |
0 ms |
860 KB |
Output is correct |
34 |
Correct |
0 ms |
860 KB |
Output is correct |
35 |
Correct |
0 ms |
860 KB |
Output is correct |
36 |
Correct |
0 ms |
860 KB |
Output is correct |
37 |
Correct |
1 ms |
7004 KB |
Output is correct |
38 |
Correct |
2 ms |
8088 KB |
Output is correct |
39 |
Correct |
1 ms |
1884 KB |
Output is correct |
40 |
Correct |
1 ms |
1884 KB |
Output is correct |
41 |
Correct |
2 ms |
2140 KB |
Output is correct |
42 |
Correct |
2 ms |
1884 KB |
Output is correct |
43 |
Correct |
1 ms |
1628 KB |
Output is correct |
44 |
Correct |
2 ms |
1884 KB |
Output is correct |
45 |
Correct |
2 ms |
2140 KB |
Output is correct |
46 |
Correct |
2 ms |
8024 KB |
Output is correct |
47 |
Correct |
2 ms |
7768 KB |
Output is correct |
48 |
Correct |
1 ms |
1628 KB |
Output is correct |
49 |
Correct |
2 ms |
2652 KB |
Output is correct |
50 |
Correct |
1 ms |
7260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
7004 KB |
Output is correct |
13 |
Correct |
2 ms |
8540 KB |
Output is correct |
14 |
Correct |
2 ms |
8784 KB |
Output is correct |
15 |
Correct |
2 ms |
7772 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
1628 KB |
Output is correct |
19 |
Correct |
1 ms |
3164 KB |
Output is correct |
20 |
Correct |
12 ms |
15196 KB |
Output is correct |
21 |
Correct |
25 ms |
21340 KB |
Output is correct |
22 |
Correct |
5 ms |
7516 KB |
Output is correct |
23 |
Correct |
30 ms |
18584 KB |
Output is correct |
24 |
Correct |
18 ms |
13912 KB |
Output is correct |
25 |
Correct |
20 ms |
14168 KB |
Output is correct |
26 |
Correct |
1 ms |
6744 KB |
Output is correct |
27 |
Correct |
1 ms |
6744 KB |
Output is correct |
28 |
Correct |
0 ms |
604 KB |
Output is correct |
29 |
Correct |
0 ms |
860 KB |
Output is correct |
30 |
Correct |
1 ms |
860 KB |
Output is correct |
31 |
Correct |
1 ms |
600 KB |
Output is correct |
32 |
Correct |
1 ms |
860 KB |
Output is correct |
33 |
Correct |
0 ms |
860 KB |
Output is correct |
34 |
Correct |
0 ms |
604 KB |
Output is correct |
35 |
Correct |
0 ms |
860 KB |
Output is correct |
36 |
Correct |
1 ms |
6748 KB |
Output is correct |
37 |
Correct |
1 ms |
6748 KB |
Output is correct |
38 |
Correct |
1 ms |
6748 KB |
Output is correct |
39 |
Correct |
1 ms |
6744 KB |
Output is correct |
40 |
Correct |
0 ms |
860 KB |
Output is correct |
41 |
Correct |
0 ms |
860 KB |
Output is correct |
42 |
Correct |
0 ms |
860 KB |
Output is correct |
43 |
Correct |
0 ms |
860 KB |
Output is correct |
44 |
Correct |
1 ms |
7004 KB |
Output is correct |
45 |
Correct |
2 ms |
8088 KB |
Output is correct |
46 |
Correct |
1 ms |
1884 KB |
Output is correct |
47 |
Correct |
1 ms |
1884 KB |
Output is correct |
48 |
Correct |
2 ms |
2140 KB |
Output is correct |
49 |
Correct |
2 ms |
1884 KB |
Output is correct |
50 |
Correct |
1 ms |
1628 KB |
Output is correct |
51 |
Correct |
2 ms |
1884 KB |
Output is correct |
52 |
Correct |
2 ms |
2140 KB |
Output is correct |
53 |
Correct |
2 ms |
8024 KB |
Output is correct |
54 |
Correct |
2 ms |
7768 KB |
Output is correct |
55 |
Correct |
1 ms |
1628 KB |
Output is correct |
56 |
Correct |
2 ms |
2652 KB |
Output is correct |
57 |
Correct |
1 ms |
7260 KB |
Output is correct |
58 |
Correct |
2 ms |
7512 KB |
Output is correct |
59 |
Correct |
5 ms |
4696 KB |
Output is correct |
60 |
Correct |
3 ms |
5208 KB |
Output is correct |
61 |
Correct |
7 ms |
9052 KB |
Output is correct |
62 |
Correct |
7 ms |
9052 KB |
Output is correct |
63 |
Correct |
6 ms |
8284 KB |
Output is correct |
64 |
Correct |
3 ms |
7004 KB |
Output is correct |
65 |
Correct |
17 ms |
8028 KB |
Output is correct |
66 |
Correct |
16 ms |
8472 KB |
Output is correct |
67 |
Correct |
15 ms |
9052 KB |
Output is correct |
68 |
Correct |
15 ms |
10076 KB |
Output is correct |
69 |
Correct |
7 ms |
14172 KB |
Output is correct |
70 |
Correct |
18 ms |
15708 KB |
Output is correct |
71 |
Correct |
22 ms |
16220 KB |
Output is correct |
72 |
Correct |
15 ms |
13828 KB |
Output is correct |
73 |
Correct |
17 ms |
47964 KB |
Output is correct |
74 |
Correct |
29 ms |
52052 KB |
Output is correct |
75 |
Correct |
4 ms |
11100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
7004 KB |
Output is correct |
13 |
Correct |
2 ms |
8540 KB |
Output is correct |
14 |
Correct |
2 ms |
8784 KB |
Output is correct |
15 |
Correct |
2 ms |
7772 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
1628 KB |
Output is correct |
19 |
Correct |
1 ms |
3164 KB |
Output is correct |
20 |
Correct |
12 ms |
15196 KB |
Output is correct |
21 |
Correct |
25 ms |
21340 KB |
Output is correct |
22 |
Correct |
5 ms |
7516 KB |
Output is correct |
23 |
Correct |
30 ms |
18584 KB |
Output is correct |
24 |
Correct |
18 ms |
13912 KB |
Output is correct |
25 |
Correct |
20 ms |
14168 KB |
Output is correct |
26 |
Correct |
9 ms |
4184 KB |
Output is correct |
27 |
Correct |
122 ms |
131408 KB |
Output is correct |
28 |
Correct |
696 ms |
367112 KB |
Output is correct |
29 |
Correct |
34 ms |
45392 KB |
Output is correct |
30 |
Correct |
66 ms |
72464 KB |
Output is correct |
31 |
Correct |
602 ms |
293204 KB |
Output is correct |
32 |
Correct |
842 ms |
293460 KB |
Output is correct |
33 |
Correct |
790 ms |
292660 KB |
Output is correct |
34 |
Correct |
1 ms |
6744 KB |
Output is correct |
35 |
Correct |
1 ms |
6744 KB |
Output is correct |
36 |
Correct |
0 ms |
604 KB |
Output is correct |
37 |
Correct |
0 ms |
860 KB |
Output is correct |
38 |
Correct |
1 ms |
860 KB |
Output is correct |
39 |
Correct |
1 ms |
600 KB |
Output is correct |
40 |
Correct |
1 ms |
860 KB |
Output is correct |
41 |
Correct |
0 ms |
860 KB |
Output is correct |
42 |
Correct |
0 ms |
604 KB |
Output is correct |
43 |
Correct |
0 ms |
860 KB |
Output is correct |
44 |
Correct |
1 ms |
6748 KB |
Output is correct |
45 |
Correct |
1 ms |
6748 KB |
Output is correct |
46 |
Correct |
1 ms |
6748 KB |
Output is correct |
47 |
Correct |
1 ms |
6744 KB |
Output is correct |
48 |
Correct |
0 ms |
860 KB |
Output is correct |
49 |
Correct |
0 ms |
860 KB |
Output is correct |
50 |
Correct |
0 ms |
860 KB |
Output is correct |
51 |
Correct |
0 ms |
860 KB |
Output is correct |
52 |
Correct |
1 ms |
7004 KB |
Output is correct |
53 |
Correct |
2 ms |
8088 KB |
Output is correct |
54 |
Correct |
1 ms |
1884 KB |
Output is correct |
55 |
Correct |
1 ms |
1884 KB |
Output is correct |
56 |
Correct |
2 ms |
2140 KB |
Output is correct |
57 |
Correct |
2 ms |
1884 KB |
Output is correct |
58 |
Correct |
1 ms |
1628 KB |
Output is correct |
59 |
Correct |
2 ms |
1884 KB |
Output is correct |
60 |
Correct |
2 ms |
2140 KB |
Output is correct |
61 |
Correct |
2 ms |
8024 KB |
Output is correct |
62 |
Correct |
2 ms |
7768 KB |
Output is correct |
63 |
Correct |
1 ms |
1628 KB |
Output is correct |
64 |
Correct |
2 ms |
2652 KB |
Output is correct |
65 |
Correct |
1 ms |
7260 KB |
Output is correct |
66 |
Correct |
2 ms |
7512 KB |
Output is correct |
67 |
Correct |
5 ms |
4696 KB |
Output is correct |
68 |
Correct |
3 ms |
5208 KB |
Output is correct |
69 |
Correct |
7 ms |
9052 KB |
Output is correct |
70 |
Correct |
7 ms |
9052 KB |
Output is correct |
71 |
Correct |
6 ms |
8284 KB |
Output is correct |
72 |
Correct |
3 ms |
7004 KB |
Output is correct |
73 |
Correct |
17 ms |
8028 KB |
Output is correct |
74 |
Correct |
16 ms |
8472 KB |
Output is correct |
75 |
Correct |
15 ms |
9052 KB |
Output is correct |
76 |
Correct |
15 ms |
10076 KB |
Output is correct |
77 |
Correct |
7 ms |
14172 KB |
Output is correct |
78 |
Correct |
18 ms |
15708 KB |
Output is correct |
79 |
Correct |
22 ms |
16220 KB |
Output is correct |
80 |
Correct |
15 ms |
13828 KB |
Output is correct |
81 |
Correct |
17 ms |
47964 KB |
Output is correct |
82 |
Correct |
29 ms |
52052 KB |
Output is correct |
83 |
Correct |
4 ms |
11100 KB |
Output is correct |
84 |
Correct |
9 ms |
8280 KB |
Output is correct |
85 |
Correct |
56 ms |
29172 KB |
Output is correct |
86 |
Correct |
15 ms |
11252 KB |
Output is correct |
87 |
Correct |
27 ms |
14940 KB |
Output is correct |
88 |
Correct |
29 ms |
14848 KB |
Output is correct |
89 |
Correct |
159 ms |
62224 KB |
Output is correct |
90 |
Correct |
19 ms |
44380 KB |
Output is correct |
91 |
Correct |
651 ms |
69516 KB |
Output is correct |
92 |
Correct |
456 ms |
79184 KB |
Output is correct |
93 |
Correct |
538 ms |
65880 KB |
Output is correct |
94 |
Correct |
863 ms |
221012 KB |
Output is correct |
95 |
Correct |
187 ms |
120656 KB |
Output is correct |
96 |
Execution timed out |
1010 ms |
156180 KB |
Time limit exceeded |
97 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6744 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
7004 KB |
Output is correct |
13 |
Correct |
2 ms |
8540 KB |
Output is correct |
14 |
Correct |
2 ms |
8784 KB |
Output is correct |
15 |
Correct |
2 ms |
7772 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
1628 KB |
Output is correct |
18 |
Correct |
1 ms |
1628 KB |
Output is correct |
19 |
Correct |
1 ms |
3164 KB |
Output is correct |
20 |
Correct |
12 ms |
15196 KB |
Output is correct |
21 |
Correct |
25 ms |
21340 KB |
Output is correct |
22 |
Correct |
5 ms |
7516 KB |
Output is correct |
23 |
Correct |
30 ms |
18584 KB |
Output is correct |
24 |
Correct |
18 ms |
13912 KB |
Output is correct |
25 |
Correct |
20 ms |
14168 KB |
Output is correct |
26 |
Correct |
9 ms |
4184 KB |
Output is correct |
27 |
Correct |
122 ms |
131408 KB |
Output is correct |
28 |
Correct |
696 ms |
367112 KB |
Output is correct |
29 |
Correct |
34 ms |
45392 KB |
Output is correct |
30 |
Correct |
66 ms |
72464 KB |
Output is correct |
31 |
Correct |
602 ms |
293204 KB |
Output is correct |
32 |
Correct |
842 ms |
293460 KB |
Output is correct |
33 |
Correct |
790 ms |
292660 KB |
Output is correct |
34 |
Correct |
1 ms |
6744 KB |
Output is correct |
35 |
Correct |
1 ms |
6744 KB |
Output is correct |
36 |
Correct |
0 ms |
604 KB |
Output is correct |
37 |
Correct |
0 ms |
860 KB |
Output is correct |
38 |
Correct |
1 ms |
860 KB |
Output is correct |
39 |
Correct |
1 ms |
600 KB |
Output is correct |
40 |
Correct |
1 ms |
860 KB |
Output is correct |
41 |
Correct |
0 ms |
860 KB |
Output is correct |
42 |
Correct |
0 ms |
604 KB |
Output is correct |
43 |
Correct |
0 ms |
860 KB |
Output is correct |
44 |
Correct |
1 ms |
6748 KB |
Output is correct |
45 |
Correct |
1 ms |
6748 KB |
Output is correct |
46 |
Correct |
1 ms |
6748 KB |
Output is correct |
47 |
Correct |
1 ms |
6744 KB |
Output is correct |
48 |
Correct |
0 ms |
860 KB |
Output is correct |
49 |
Correct |
0 ms |
860 KB |
Output is correct |
50 |
Correct |
0 ms |
860 KB |
Output is correct |
51 |
Correct |
0 ms |
860 KB |
Output is correct |
52 |
Correct |
1 ms |
7004 KB |
Output is correct |
53 |
Correct |
2 ms |
8088 KB |
Output is correct |
54 |
Correct |
1 ms |
1884 KB |
Output is correct |
55 |
Correct |
1 ms |
1884 KB |
Output is correct |
56 |
Correct |
2 ms |
2140 KB |
Output is correct |
57 |
Correct |
2 ms |
1884 KB |
Output is correct |
58 |
Correct |
1 ms |
1628 KB |
Output is correct |
59 |
Correct |
2 ms |
1884 KB |
Output is correct |
60 |
Correct |
2 ms |
2140 KB |
Output is correct |
61 |
Correct |
2 ms |
8024 KB |
Output is correct |
62 |
Correct |
2 ms |
7768 KB |
Output is correct |
63 |
Correct |
1 ms |
1628 KB |
Output is correct |
64 |
Correct |
2 ms |
2652 KB |
Output is correct |
65 |
Correct |
1 ms |
7260 KB |
Output is correct |
66 |
Correct |
2 ms |
7512 KB |
Output is correct |
67 |
Correct |
5 ms |
4696 KB |
Output is correct |
68 |
Correct |
3 ms |
5208 KB |
Output is correct |
69 |
Correct |
7 ms |
9052 KB |
Output is correct |
70 |
Correct |
7 ms |
9052 KB |
Output is correct |
71 |
Correct |
6 ms |
8284 KB |
Output is correct |
72 |
Correct |
3 ms |
7004 KB |
Output is correct |
73 |
Correct |
17 ms |
8028 KB |
Output is correct |
74 |
Correct |
16 ms |
8472 KB |
Output is correct |
75 |
Correct |
15 ms |
9052 KB |
Output is correct |
76 |
Correct |
15 ms |
10076 KB |
Output is correct |
77 |
Correct |
7 ms |
14172 KB |
Output is correct |
78 |
Correct |
18 ms |
15708 KB |
Output is correct |
79 |
Correct |
22 ms |
16220 KB |
Output is correct |
80 |
Correct |
15 ms |
13828 KB |
Output is correct |
81 |
Correct |
17 ms |
47964 KB |
Output is correct |
82 |
Correct |
29 ms |
52052 KB |
Output is correct |
83 |
Correct |
4 ms |
11100 KB |
Output is correct |
84 |
Correct |
9 ms |
8280 KB |
Output is correct |
85 |
Correct |
56 ms |
29172 KB |
Output is correct |
86 |
Correct |
15 ms |
11252 KB |
Output is correct |
87 |
Correct |
27 ms |
14940 KB |
Output is correct |
88 |
Correct |
29 ms |
14848 KB |
Output is correct |
89 |
Correct |
159 ms |
62224 KB |
Output is correct |
90 |
Correct |
19 ms |
44380 KB |
Output is correct |
91 |
Correct |
651 ms |
69516 KB |
Output is correct |
92 |
Correct |
456 ms |
79184 KB |
Output is correct |
93 |
Correct |
538 ms |
65880 KB |
Output is correct |
94 |
Correct |
863 ms |
221012 KB |
Output is correct |
95 |
Correct |
187 ms |
120656 KB |
Output is correct |
96 |
Execution timed out |
1010 ms |
156180 KB |
Time limit exceeded |
97 |
Halted |
0 ms |
0 KB |
- |