#include "closing.h"
#ifdef LOCAL
#include "Debug.h"
#else
#define debug(...) 42
#endif
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long oo = (1LL << 62) - 10;
int n;
vector<pair<int, int>> a[N];
vector<int> idPath, idTree, trees[N];
vector<long long> bfs(int s)
{
vector<long long> dist(n, -1);
queue<int> q;
dist[s] = 0;
q.push(s);
while (!empty(q))
{
int x = q.front();
q.pop();
for (auto [y, w] : a[x])
if (dist[y] < 0)
{
dist[y] = dist[x] + w;
q.push(y);
}
}
return dist;
}
int isLinear()
{
for (int i = 0; i + 1 < n; i++)
{
int isGood = 0;
for (auto [j, _] : a[i])
if (j == i + 1)
isGood = 1;
if (!isGood)
return 0;
}
return 1;
}
int solveLinear(int n, int A, int B, long long budget, vector<long long> distA, vector<long long> distB)
{
vector<long long> sumA(n), sumB(n), sumAB(n);
for (int i = A; i <= B; i++)
{
sumA[i] = distA[i];
sumAB[i] = max(distA[i], distB[i]);
if (i)
{
sumA[i] += sumA[i - 1];
sumAB[i] += sumAB[i - 1];
}
}
for (int i = B - 1; i >= A; i--)
sumB[i] = sumB[i + 1] + distB[i];
vector<pair<long long, int>> ext;
for (int i = 0; i < n; i++)
if (i < A) ext.push_back({distA[i], i});
else if (i > B) ext.push_back({distB[i], i});
vector<long long> costFor(n, oo);
costFor[0] = 0;
sort(begin(ext), end(ext));
for (int i = 0; i < size(ext); i++)
costFor[i + 1] = costFor[i] + ext[i].first;
int ans = 0, distAB = distA[B];
for (int l = A; l <= B; l++)
for (int r = A; r <= B; r++)
{
long long cost = 0;
int curAns = l - A + 1 + B - r + 1;
if (l < r) cost = sumA[l] + sumB[r];
else
{
cost = sumAB[l];
if (r)
{
cost -= sumAB[r - 1];
cost += sumA[r - 1];
}
if (l + 1 < n)
cost += sumB[l + 1];
}
if (cost > budget)
continue;
if (l < B && r > A)
{
int u = upper_bound(begin(costFor), end(costFor), budget - cost) - begin(costFor);
curAns += u - 1;
}
else
{
long long rem = budget - cost;
int both = 0;
for (int i = 0; i < size(ext); i++)
{
auto [extCost, id] = ext[i];
while (both && extCost > distAB)
{
rem -= distAB;
if (rem < 0)
break;
curAns++;
both--;
}
rem -= extCost;
if (rem < 0)
break;
curAns++;
if (id < A && r == A) both++;
else if (id > B && l == B) both++;
}
if (rem >= 0)
curAns += min(1LL * both, rem / distAB);
}
ans = max(ans, curAns);
}
return ans;
}
int findPath(int x, int goal, int par, vector<int> &path)
{
path.push_back(x);
if (x == goal)
return 1;
for (auto [y, _] : a[x])
if (y != par)
{
if (findPath(y, goal, x, path))
return 1;
}
path.pop_back();
return 0;
}
void dfs(int x)
{
trees[idTree[x]].push_back(x);
for (auto [y, _] : a[x])
if (idTree[y] < 0)
{
idTree[y] = idTree[x];
dfs(y);
}
}
int max_score(int N, int A, int B, long long budget, vector<int> U, vector<int> V, vector<int> W)
{
n = N;
for (int i = 0; i < n; i++)
a[i].clear();
for (int i = 0; i < size(U); i++)
{
a[U[i]].push_back({V[i], W[i]});
a[V[i]].push_back({U[i], W[i]});
}
auto distA = bfs(A);
auto distB = bfs(B);
auto distAB = distA[B];
if (distAB > budget * 2)
{
vector<long long> allDists = distA;
for (auto d : distB)
allDists.push_back(d);
sort(begin(allDists), end(allDists));
int ans = 0;
for (auto d : allDists)
if (d <= budget)
{
ans++;
budget -= d;
}
return ans;
}
if (isLinear())
return solveLinear(n, A, B, budget, distA, distB);
// O(n^3)
vector<int> path;
findPath(A, B, -1, path);
idPath.assign(n, -1);
idTree.assign(n, -1);
int len = size(path);
for (int i = 0; i < len; i++)
{
idPath[path[i]] = idTree[path[i]] = i;
trees[i].clear();
}
for (int x : path)
dfs(x);
int ans = 0;
for (int l = 0; l < len; l++)
{
vector<long long> f(n * 2 + 1, oo);
f[0] = 0;
int cnt = 0;
for (int r = len - 1; r >= 0; r--)
{
long long curCost = 0;
int curAns = 0;
vector<long long> c1;
for (int i = 0; i < n; i++)
{
if (idTree[i] > l && idTree[i] < r)
continue;
if (idTree[i] < r) // A
{
if (idPath[i] < 0) c1.push_back(distA[i]);
else curCost += distA[i], curAns++;
}
else if (idTree[i] > l) // B
{
if (idPath[i] < 0) c1.push_back(distB[i]);
else curCost += distB[i], curAns++;
}
else // AB
{
if (idPath[i] >= 0)
curCost += max(distA[i], distB[i]), curAns += 2;
}
}
if (curCost > budget)
break;
long long rem = budget - curCost;
// add new tree to f
if (r <= l)
{
for (int x : trees[r])
if (idPath[x] < 0)
{
auto minDist = min(distA[x], distB[x]);
auto maxDist = max(distA[x], distB[x]);
for (int i = cnt; i >= 0; i--)
{
f[i + 1] = min(f[i + 1], f[i] + minDist);
f[i + 2] = min(f[i + 2], f[i] + maxDist);
}
cnt += 2;
}
}
sort(begin(c1), end(c1));
vector<long long> costFor(size(c1) + 1);
for (int i = 0; i < size(c1); i++)
costFor[i + 1] = costFor[i] + c1[i];
for (int i = 0; i <= cnt; i++)
if (f[i] > rem) break;
else
{
int u = upper_bound(begin(costFor), end(costFor), rem - f[i]) - begin(costFor);
ans = max(ans, curAns + i + u - 1);
}
}
}
return ans;
}
Compilation message
closing.cpp: In function 'int solveLinear(int, int, int, long long int, std::vector<long long int>, std::vector<long long int>)':
closing.cpp:74:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | for (int i = 0; i < size(ext); i++)
| ~~^~~~~~~~~~~
closing.cpp:108:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
108 | for (int i = 0; i < size(ext); i++)
| ~~^~~~~~~~~~~
closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:169:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
169 | for (int i = 0; i < size(U); i++)
| ~~^~~~~~~~~
closing.cpp:270:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
270 | for (int i = 0; i < size(c1); i++)
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
28136 KB |
Output is correct |
2 |
Correct |
110 ms |
27956 KB |
Output is correct |
3 |
Correct |
67 ms |
12236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
3 ms |
9820 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
2 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
3 ms |
9820 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
2 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9820 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9820 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
21 |
Correct |
4 ms |
9820 KB |
Output is correct |
22 |
Correct |
2 ms |
9820 KB |
Output is correct |
23 |
Correct |
3 ms |
9820 KB |
Output is correct |
24 |
Correct |
3 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
3 ms |
9820 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
2 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9820 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9820 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
21 |
Correct |
4 ms |
9820 KB |
Output is correct |
22 |
Correct |
2 ms |
9820 KB |
Output is correct |
23 |
Correct |
3 ms |
9820 KB |
Output is correct |
24 |
Correct |
3 ms |
9820 KB |
Output is correct |
25 |
Correct |
3 ms |
9820 KB |
Output is correct |
26 |
Correct |
3 ms |
10072 KB |
Output is correct |
27 |
Correct |
5 ms |
10076 KB |
Output is correct |
28 |
Correct |
80 ms |
10132 KB |
Output is correct |
29 |
Correct |
52 ms |
10072 KB |
Output is correct |
30 |
Correct |
5 ms |
10076 KB |
Output is correct |
31 |
Correct |
40 ms |
10076 KB |
Output is correct |
32 |
Correct |
40 ms |
10156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
2 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9816 KB |
Output is correct |
10 |
Correct |
2 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
2 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
2 ms |
9820 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9820 KB |
Output is correct |
20 |
Correct |
2 ms |
9820 KB |
Output is correct |
21 |
Correct |
2 ms |
9820 KB |
Output is correct |
22 |
Correct |
2 ms |
9820 KB |
Output is correct |
23 |
Correct |
2 ms |
9820 KB |
Output is correct |
24 |
Correct |
2 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
2 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
2 ms |
9820 KB |
Output is correct |
21 |
Correct |
2 ms |
9816 KB |
Output is correct |
22 |
Correct |
2 ms |
9816 KB |
Output is correct |
23 |
Correct |
2 ms |
9820 KB |
Output is correct |
24 |
Correct |
2 ms |
9820 KB |
Output is correct |
25 |
Correct |
3 ms |
9820 KB |
Output is correct |
26 |
Correct |
2 ms |
9820 KB |
Output is correct |
27 |
Correct |
2 ms |
9820 KB |
Output is correct |
28 |
Correct |
2 ms |
9820 KB |
Output is correct |
29 |
Correct |
2 ms |
9820 KB |
Output is correct |
30 |
Correct |
2 ms |
9820 KB |
Output is correct |
31 |
Correct |
2 ms |
9820 KB |
Output is correct |
32 |
Correct |
2 ms |
9820 KB |
Output is correct |
33 |
Correct |
2 ms |
9820 KB |
Output is correct |
34 |
Correct |
2 ms |
9820 KB |
Output is correct |
35 |
Correct |
2 ms |
9820 KB |
Output is correct |
36 |
Correct |
2 ms |
9820 KB |
Output is correct |
37 |
Correct |
2 ms |
9652 KB |
Output is correct |
38 |
Correct |
2 ms |
9820 KB |
Output is correct |
39 |
Correct |
3 ms |
9820 KB |
Output is correct |
40 |
Correct |
3 ms |
9820 KB |
Output is correct |
41 |
Correct |
2 ms |
9820 KB |
Output is correct |
42 |
Correct |
2 ms |
9820 KB |
Output is correct |
43 |
Correct |
3 ms |
9820 KB |
Output is correct |
44 |
Correct |
3 ms |
9820 KB |
Output is correct |
45 |
Correct |
2 ms |
9820 KB |
Output is correct |
46 |
Correct |
3 ms |
9816 KB |
Output is correct |
47 |
Correct |
2 ms |
9820 KB |
Output is correct |
48 |
Correct |
2 ms |
9820 KB |
Output is correct |
49 |
Correct |
2 ms |
9820 KB |
Output is correct |
50 |
Correct |
2 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
2 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9820 KB |
Output is correct |
20 |
Correct |
2 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9820 KB |
Output is correct |
22 |
Correct |
4 ms |
9820 KB |
Output is correct |
23 |
Correct |
2 ms |
9820 KB |
Output is correct |
24 |
Correct |
3 ms |
9820 KB |
Output is correct |
25 |
Correct |
3 ms |
9820 KB |
Output is correct |
26 |
Correct |
2 ms |
9816 KB |
Output is correct |
27 |
Correct |
2 ms |
9820 KB |
Output is correct |
28 |
Correct |
2 ms |
9816 KB |
Output is correct |
29 |
Correct |
2 ms |
9816 KB |
Output is correct |
30 |
Correct |
2 ms |
9820 KB |
Output is correct |
31 |
Correct |
2 ms |
9820 KB |
Output is correct |
32 |
Correct |
3 ms |
9820 KB |
Output is correct |
33 |
Correct |
2 ms |
9820 KB |
Output is correct |
34 |
Correct |
2 ms |
9820 KB |
Output is correct |
35 |
Correct |
2 ms |
9820 KB |
Output is correct |
36 |
Correct |
2 ms |
9820 KB |
Output is correct |
37 |
Correct |
2 ms |
9820 KB |
Output is correct |
38 |
Correct |
2 ms |
9820 KB |
Output is correct |
39 |
Correct |
2 ms |
9820 KB |
Output is correct |
40 |
Correct |
2 ms |
9820 KB |
Output is correct |
41 |
Correct |
2 ms |
9820 KB |
Output is correct |
42 |
Correct |
2 ms |
9820 KB |
Output is correct |
43 |
Correct |
2 ms |
9820 KB |
Output is correct |
44 |
Correct |
2 ms |
9652 KB |
Output is correct |
45 |
Correct |
2 ms |
9820 KB |
Output is correct |
46 |
Correct |
3 ms |
9820 KB |
Output is correct |
47 |
Correct |
3 ms |
9820 KB |
Output is correct |
48 |
Correct |
2 ms |
9820 KB |
Output is correct |
49 |
Correct |
2 ms |
9820 KB |
Output is correct |
50 |
Correct |
3 ms |
9820 KB |
Output is correct |
51 |
Correct |
3 ms |
9820 KB |
Output is correct |
52 |
Correct |
2 ms |
9820 KB |
Output is correct |
53 |
Correct |
3 ms |
9816 KB |
Output is correct |
54 |
Correct |
2 ms |
9820 KB |
Output is correct |
55 |
Correct |
2 ms |
9820 KB |
Output is correct |
56 |
Correct |
2 ms |
9820 KB |
Output is correct |
57 |
Correct |
2 ms |
9820 KB |
Output is correct |
58 |
Correct |
3 ms |
9820 KB |
Output is correct |
59 |
Correct |
4 ms |
9820 KB |
Output is correct |
60 |
Correct |
2 ms |
9820 KB |
Output is correct |
61 |
Correct |
12 ms |
9820 KB |
Output is correct |
62 |
Correct |
12 ms |
9860 KB |
Output is correct |
63 |
Correct |
3 ms |
9820 KB |
Output is correct |
64 |
Correct |
5 ms |
9820 KB |
Output is correct |
65 |
Correct |
26 ms |
9820 KB |
Output is correct |
66 |
Correct |
3 ms |
9820 KB |
Output is correct |
67 |
Correct |
2 ms |
9820 KB |
Output is correct |
68 |
Correct |
48 ms |
9820 KB |
Output is correct |
69 |
Correct |
323 ms |
9820 KB |
Output is correct |
70 |
Correct |
47 ms |
9816 KB |
Output is correct |
71 |
Correct |
35 ms |
10068 KB |
Output is correct |
72 |
Correct |
7 ms |
9820 KB |
Output is correct |
73 |
Correct |
3 ms |
9820 KB |
Output is correct |
74 |
Correct |
3 ms |
9820 KB |
Output is correct |
75 |
Correct |
2 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
2 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9820 KB |
Output is correct |
20 |
Correct |
2 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9820 KB |
Output is correct |
22 |
Correct |
4 ms |
9820 KB |
Output is correct |
23 |
Correct |
2 ms |
9820 KB |
Output is correct |
24 |
Correct |
3 ms |
9820 KB |
Output is correct |
25 |
Correct |
3 ms |
9820 KB |
Output is correct |
26 |
Correct |
3 ms |
9820 KB |
Output is correct |
27 |
Correct |
3 ms |
10072 KB |
Output is correct |
28 |
Correct |
5 ms |
10076 KB |
Output is correct |
29 |
Correct |
80 ms |
10132 KB |
Output is correct |
30 |
Correct |
52 ms |
10072 KB |
Output is correct |
31 |
Correct |
5 ms |
10076 KB |
Output is correct |
32 |
Correct |
40 ms |
10076 KB |
Output is correct |
33 |
Correct |
40 ms |
10156 KB |
Output is correct |
34 |
Correct |
2 ms |
9816 KB |
Output is correct |
35 |
Correct |
2 ms |
9820 KB |
Output is correct |
36 |
Correct |
2 ms |
9816 KB |
Output is correct |
37 |
Correct |
2 ms |
9816 KB |
Output is correct |
38 |
Correct |
2 ms |
9820 KB |
Output is correct |
39 |
Correct |
2 ms |
9820 KB |
Output is correct |
40 |
Correct |
3 ms |
9820 KB |
Output is correct |
41 |
Correct |
2 ms |
9820 KB |
Output is correct |
42 |
Correct |
2 ms |
9820 KB |
Output is correct |
43 |
Correct |
2 ms |
9820 KB |
Output is correct |
44 |
Correct |
2 ms |
9820 KB |
Output is correct |
45 |
Correct |
2 ms |
9820 KB |
Output is correct |
46 |
Correct |
2 ms |
9820 KB |
Output is correct |
47 |
Correct |
2 ms |
9820 KB |
Output is correct |
48 |
Correct |
2 ms |
9820 KB |
Output is correct |
49 |
Correct |
2 ms |
9820 KB |
Output is correct |
50 |
Correct |
2 ms |
9820 KB |
Output is correct |
51 |
Correct |
2 ms |
9820 KB |
Output is correct |
52 |
Correct |
2 ms |
9652 KB |
Output is correct |
53 |
Correct |
2 ms |
9820 KB |
Output is correct |
54 |
Correct |
3 ms |
9820 KB |
Output is correct |
55 |
Correct |
3 ms |
9820 KB |
Output is correct |
56 |
Correct |
2 ms |
9820 KB |
Output is correct |
57 |
Correct |
2 ms |
9820 KB |
Output is correct |
58 |
Correct |
3 ms |
9820 KB |
Output is correct |
59 |
Correct |
3 ms |
9820 KB |
Output is correct |
60 |
Correct |
2 ms |
9820 KB |
Output is correct |
61 |
Correct |
3 ms |
9816 KB |
Output is correct |
62 |
Correct |
2 ms |
9820 KB |
Output is correct |
63 |
Correct |
2 ms |
9820 KB |
Output is correct |
64 |
Correct |
2 ms |
9820 KB |
Output is correct |
65 |
Correct |
2 ms |
9820 KB |
Output is correct |
66 |
Correct |
3 ms |
9820 KB |
Output is correct |
67 |
Correct |
4 ms |
9820 KB |
Output is correct |
68 |
Correct |
2 ms |
9820 KB |
Output is correct |
69 |
Correct |
12 ms |
9820 KB |
Output is correct |
70 |
Correct |
12 ms |
9860 KB |
Output is correct |
71 |
Correct |
3 ms |
9820 KB |
Output is correct |
72 |
Correct |
5 ms |
9820 KB |
Output is correct |
73 |
Correct |
26 ms |
9820 KB |
Output is correct |
74 |
Correct |
3 ms |
9820 KB |
Output is correct |
75 |
Correct |
2 ms |
9820 KB |
Output is correct |
76 |
Correct |
48 ms |
9820 KB |
Output is correct |
77 |
Correct |
323 ms |
9820 KB |
Output is correct |
78 |
Correct |
47 ms |
9816 KB |
Output is correct |
79 |
Correct |
35 ms |
10068 KB |
Output is correct |
80 |
Correct |
7 ms |
9820 KB |
Output is correct |
81 |
Correct |
3 ms |
9820 KB |
Output is correct |
82 |
Correct |
3 ms |
9820 KB |
Output is correct |
83 |
Correct |
2 ms |
9820 KB |
Output is correct |
84 |
Correct |
6 ms |
9816 KB |
Output is correct |
85 |
Correct |
13 ms |
9816 KB |
Output is correct |
86 |
Correct |
3 ms |
9820 KB |
Output is correct |
87 |
Correct |
69 ms |
9896 KB |
Output is correct |
88 |
Correct |
71 ms |
9876 KB |
Output is correct |
89 |
Correct |
43 ms |
10440 KB |
Output is correct |
90 |
Correct |
140 ms |
10156 KB |
Output is correct |
91 |
Execution timed out |
1091 ms |
10072 KB |
Time limit exceeded |
92 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
2 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
2 ms |
9820 KB |
Output is correct |
12 |
Correct |
2 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9820 KB |
Output is correct |
16 |
Correct |
2 ms |
9820 KB |
Output is correct |
17 |
Correct |
2 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9820 KB |
Output is correct |
20 |
Correct |
2 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9820 KB |
Output is correct |
22 |
Correct |
4 ms |
9820 KB |
Output is correct |
23 |
Correct |
2 ms |
9820 KB |
Output is correct |
24 |
Correct |
3 ms |
9820 KB |
Output is correct |
25 |
Correct |
3 ms |
9820 KB |
Output is correct |
26 |
Correct |
3 ms |
9820 KB |
Output is correct |
27 |
Correct |
3 ms |
10072 KB |
Output is correct |
28 |
Correct |
5 ms |
10076 KB |
Output is correct |
29 |
Correct |
80 ms |
10132 KB |
Output is correct |
30 |
Correct |
52 ms |
10072 KB |
Output is correct |
31 |
Correct |
5 ms |
10076 KB |
Output is correct |
32 |
Correct |
40 ms |
10076 KB |
Output is correct |
33 |
Correct |
40 ms |
10156 KB |
Output is correct |
34 |
Correct |
2 ms |
9816 KB |
Output is correct |
35 |
Correct |
2 ms |
9820 KB |
Output is correct |
36 |
Correct |
2 ms |
9816 KB |
Output is correct |
37 |
Correct |
2 ms |
9816 KB |
Output is correct |
38 |
Correct |
2 ms |
9820 KB |
Output is correct |
39 |
Correct |
2 ms |
9820 KB |
Output is correct |
40 |
Correct |
3 ms |
9820 KB |
Output is correct |
41 |
Correct |
2 ms |
9820 KB |
Output is correct |
42 |
Correct |
2 ms |
9820 KB |
Output is correct |
43 |
Correct |
2 ms |
9820 KB |
Output is correct |
44 |
Correct |
2 ms |
9820 KB |
Output is correct |
45 |
Correct |
2 ms |
9820 KB |
Output is correct |
46 |
Correct |
2 ms |
9820 KB |
Output is correct |
47 |
Correct |
2 ms |
9820 KB |
Output is correct |
48 |
Correct |
2 ms |
9820 KB |
Output is correct |
49 |
Correct |
2 ms |
9820 KB |
Output is correct |
50 |
Correct |
2 ms |
9820 KB |
Output is correct |
51 |
Correct |
2 ms |
9820 KB |
Output is correct |
52 |
Correct |
2 ms |
9652 KB |
Output is correct |
53 |
Correct |
2 ms |
9820 KB |
Output is correct |
54 |
Correct |
3 ms |
9820 KB |
Output is correct |
55 |
Correct |
3 ms |
9820 KB |
Output is correct |
56 |
Correct |
2 ms |
9820 KB |
Output is correct |
57 |
Correct |
2 ms |
9820 KB |
Output is correct |
58 |
Correct |
3 ms |
9820 KB |
Output is correct |
59 |
Correct |
3 ms |
9820 KB |
Output is correct |
60 |
Correct |
2 ms |
9820 KB |
Output is correct |
61 |
Correct |
3 ms |
9816 KB |
Output is correct |
62 |
Correct |
2 ms |
9820 KB |
Output is correct |
63 |
Correct |
2 ms |
9820 KB |
Output is correct |
64 |
Correct |
2 ms |
9820 KB |
Output is correct |
65 |
Correct |
2 ms |
9820 KB |
Output is correct |
66 |
Correct |
3 ms |
9820 KB |
Output is correct |
67 |
Correct |
4 ms |
9820 KB |
Output is correct |
68 |
Correct |
2 ms |
9820 KB |
Output is correct |
69 |
Correct |
12 ms |
9820 KB |
Output is correct |
70 |
Correct |
12 ms |
9860 KB |
Output is correct |
71 |
Correct |
3 ms |
9820 KB |
Output is correct |
72 |
Correct |
5 ms |
9820 KB |
Output is correct |
73 |
Correct |
26 ms |
9820 KB |
Output is correct |
74 |
Correct |
3 ms |
9820 KB |
Output is correct |
75 |
Correct |
2 ms |
9820 KB |
Output is correct |
76 |
Correct |
48 ms |
9820 KB |
Output is correct |
77 |
Correct |
323 ms |
9820 KB |
Output is correct |
78 |
Correct |
47 ms |
9816 KB |
Output is correct |
79 |
Correct |
35 ms |
10068 KB |
Output is correct |
80 |
Correct |
7 ms |
9820 KB |
Output is correct |
81 |
Correct |
3 ms |
9820 KB |
Output is correct |
82 |
Correct |
3 ms |
9820 KB |
Output is correct |
83 |
Correct |
2 ms |
9820 KB |
Output is correct |
84 |
Correct |
6 ms |
9816 KB |
Output is correct |
85 |
Correct |
13 ms |
9816 KB |
Output is correct |
86 |
Correct |
3 ms |
9820 KB |
Output is correct |
87 |
Correct |
69 ms |
9896 KB |
Output is correct |
88 |
Correct |
71 ms |
9876 KB |
Output is correct |
89 |
Correct |
43 ms |
10440 KB |
Output is correct |
90 |
Correct |
140 ms |
10156 KB |
Output is correct |
91 |
Execution timed out |
1091 ms |
10072 KB |
Time limit exceeded |
92 |
Halted |
0 ms |
0 KB |
- |