#include <bits/stdc++.h>
using namespace std;
void dfs(int x, int p, vector<vector<int>> &sons, vector<int> &depth, int prof, vector<vector<int>> &lca)
{
depth[x] = prof;
lca[0][x] = p;
for (int i = 0; i < sons[x].size(); i++)
{
dfs(sons[x][i], x, sons, depth, prof + 1, lca);
}
}
void dfs2(int x, vector<vector<int>> &sons, vector<int> &Tab, vector<vector<pair<int, int>>> &colors, vector<vector<pair<int, int>>> &sub, vector<pair<int, int>> &ans, vector<int> &big, vector<map<int, int>> &M, map<int, int> &space, vector<int> &num, vector<int> &swaps, vector<vector<int>> &precalc, vector<vector<int>> &taken, int prof)
{
map<int, int> space2;
space2[prof]++;
vector<int> num2(big.size()), swaps2(big.size());
vector<map<int, int>> M2(big.size());
if (colors[Tab[x]].size() > sqrt(sons.size()))
{
int temp = lower_bound(big.begin(), big.end(), Tab[x]) - big.begin();
M2[temp][prof]++;
num2[temp]++;
}
for (int i = 0; i < big.size(); i++)
{
swaps2[i] -= num2[i];
num2[i] = min(precalc[i][prof], space2[prof]);
swaps2[i] += num2[i];
}
for (int i = 0; i < sons[x].size(); i++)
{
dfs2(sons[x][i], sons, Tab, colors, sub, ans, big, M, space, num, swaps, precalc, taken, prof + 1);
if (space.size() > space2.size())
{
swap(space, space2);
swap(M, M2);
swap(num, num2);
swap(swaps, swaps2);
}
for (auto val : space)
{
for (int j = 0; j < big.size(); j++)
{
swaps2[j] -= min(space2[val.first], precalc[j][val.first]) - M2[j][val.first];
num2[j] -= min(space2[val.first], precalc[j][val.first]);
num2[j] += min(space2[val.first] + val.second, precalc[j][val.first]);
swaps2[j] += min(space2[val.first] + val.second, precalc[j][val.first]) - M2[j][val.first] - M[j][val.first];
if (M2[j][val.first] == 0)
M2[j].erase(val.first);
if (M[j][val.first] == 0)
M[j].erase(val.first);
}
space2[val.first] += val.second;
}
for (int j = 0; j < big.size(); j++)
{
for (auto val : M[j])
{
M2[j][val.first] += val.second;
}
}
}
if (colors[Tab[x]].size() > sqrt(sons.size()))
{
int temp = lower_bound(big.begin(), big.end(), Tab[x]) - big.begin();
ans[x] = {num2[temp], swaps2[temp]};
}
else
{
for (int i = 0; i < taken[x].size(); i++)
space2[taken[x][i]]--;
for (int i = 0; i < sub[x].size(); i++)
{
space2[sub[x][i].first]--;
if (space2[sub[x][i].first] >= 0)
{
ans[x].first++;
ans[x].second++;
}
}
for (int i = 0; i < sub[x].size(); i++)
{
space2[sub[x][i].first]++;
if (space2[sub[x][i].first] == 0)
space2.erase(sub[x][i].first);
}
for (int i = 0; i < taken[x].size(); i++)
{
space2[taken[x][i]]++;
if (space2[taken[x][i]] == 0)
space2.erase(taken[x][i]);
}
}
swap(M, M2);
swap(space, space2);
swap(num, num2);
swap(swaps, swaps2);
}
int main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int N, K;
cin >> N >> K;
vector<int> Tab(N);
vector<vector<pair<int, int>>> colors(K);
for (int i = 0; i < N; i++)
{
cin >> Tab[i];
colors[Tab[i]].push_back({0, i});
}
vector<int> big, small;
for (int i = 0; i < K; i++)
if (colors[i].size() > sqrt(N))
big.push_back(i);
else
small.push_back(i);
vector<vector<int>> sons(N);
for (int i = 0; i < N - 1; i++)
{
int x;
cin >> x;
sons[x].push_back(i + 1);
}
vector<int> depth(N);
vector<vector<int>> lca(log2(N) + 1, vector<int>(N));
dfs(0, 0, sons, depth, 0, lca);
for (int i = 1; i <= log2(N); i++)
{
for (int j = 0; j < N; j++)
{
lca[i][j] = lca[i - 1][lca[i - 1][j]];
}
}
for (int i = 0; i < K; i++)
{
for (int j = 0; j < colors[i].size(); j++)
{
colors[i][j].first = depth[colors[i][j].second];
}
sort(colors[i].begin(), colors[i].end());
}
vector<vector<pair<int, int>>> sub(N);
vector<vector<int>> taken(N);
vector<pair<int, int>> ans(N);
for (int i = 0; i < small.size(); i++)
{
int cur = small[i];
for (int j = 0; j < colors[cur].size(); j++)
{
ans[colors[cur][j].second].first++;
for (int k = 0; k < colors[cur].size(); k++)
{
if (colors[cur][k].first == colors[cur][j].first)
break;
int a = colors[cur][j].second;
for (int l = log2(N); l >= 0; l--)
if (depth[lca[l][a]] >= depth[colors[cur][k].second])
a = lca[l][a];
if (a == colors[cur][k].second)
{
ans[colors[cur][k].second].first++;
taken[colors[cur][k].second].push_back(colors[cur][j].first);
continue;
}
sub[colors[cur][k].second].push_back(colors[cur][j]);
}
}
}
vector<map<int, int>> M(big.size());
map<int, int> space;
vector<int> num(big.size()), swaps(big.size());
vector<vector<int>> precalc(big.size(), vector<int>(N));
for (int i = 0; i < big.size(); i++)
{
for (int j = 0; j < colors[big[i]].size(); j++)
{
precalc[i][colors[big[i]][j].first]++;
}
}
dfs2(0, sons, Tab, colors, sub, ans, big, M, space, num, swaps, precalc, taken, 0);
int best = 0, best2 = 0;
for (int i = 0; i < N; i++)
{
if (ans[i].first > best || (ans[i].first == best && ans[i].second < best2))
{
best = ans[i].first;
best2 = ans[i].second;
}
}
cout << best << ' ' << best2;
}
Compilation message
Main.cpp: In function 'void dfs(int, int, std::vector<std::vector<int> >&, std::vector<int>&, int, std::vector<std::vector<int> >&)':
Main.cpp:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | for (int i = 0; i < sons[x].size(); i++)
| ~~^~~~~~~~~~~~~~~~
Main.cpp: In function 'void dfs2(int, std::vector<std::vector<int> >&, std::vector<int>&, std::vector<std::vector<std::pair<int, int> > >&, std::vector<std::vector<std::pair<int, int> > >&, std::vector<std::pair<int, int> >&, std::vector<int>&, std::vector<std::map<int, int> >&, std::map<int, int>&, std::vector<int>&, std::vector<int>&, std::vector<std::vector<int> >&, std::vector<std::vector<int> >&, int)':
Main.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (int i = 0; i < big.size(); i++)
| ~~^~~~~~~~~~~~
Main.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for (int i = 0; i < sons[x].size(); i++)
| ~~^~~~~~~~~~~~~~~~
Main.cpp:42:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for (int j = 0; j < big.size(); j++)
| ~~^~~~~~~~~~~~
Main.cpp:55:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for (int j = 0; j < big.size(); j++)
| ~~^~~~~~~~~~~~
Main.cpp:70:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
70 | for (int i = 0; i < taken[x].size(); i++)
| ~~^~~~~~~~~~~~~~~~~
Main.cpp:72:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
72 | for (int i = 0; i < sub[x].size(); i++)
| ~~^~~~~~~~~~~~~~~
Main.cpp:81:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
81 | for (int i = 0; i < sub[x].size(); i++)
| ~~^~~~~~~~~~~~~~~
Main.cpp:87:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
87 | for (int i = 0; i < taken[x].size(); i++)
| ~~^~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:138:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
138 | for (int j = 0; j < colors[i].size(); j++)
| ~~^~~~~~~~~~~~~~~~~~
Main.cpp:147:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
147 | for (int i = 0; i < small.size(); i++)
| ~~^~~~~~~~~~~~~~
Main.cpp:150:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
150 | for (int j = 0; j < colors[cur].size(); j++)
| ~~^~~~~~~~~~~~~~~~~~~~
Main.cpp:153:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
153 | for (int k = 0; k < colors[cur].size(); k++)
| ~~^~~~~~~~~~~~~~~~~~~~
Main.cpp:175:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
175 | for (int i = 0; i < big.size(); i++)
| ~~^~~~~~~~~~~~
Main.cpp:177:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
177 | for (int j = 0; j < colors[big[i]].size(); j++)
| ~~^~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
460 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
12 ms |
5468 KB |
Output is correct |
9 |
Correct |
169 ms |
92312 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
3 ms |
2396 KB |
Output is correct |
12 |
Correct |
207 ms |
110368 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
2140 KB |
Output is correct |
15 |
Correct |
165 ms |
93212 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
2396 KB |
Output is correct |
5 |
Correct |
217 ms |
110396 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
60 ms |
20032 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
3 ms |
1492 KB |
Output is correct |
11 |
Correct |
155 ms |
66608 KB |
Output is correct |
12 |
Correct |
36 ms |
18132 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
91 ms |
20116 KB |
Output is correct |
16 |
Correct |
95 ms |
19892 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
604 KB |
Output is correct |
19 |
Correct |
101 ms |
20480 KB |
Output is correct |
20 |
Correct |
88 ms |
20308 KB |
Output is correct |
21 |
Correct |
92 ms |
20484 KB |
Output is correct |
22 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
452 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
173 ms |
92488 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
2136 KB |
Output is correct |
11 |
Correct |
146 ms |
93320 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
860 KB |
Output is correct |
16 |
Correct |
2 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
88 ms |
24052 KB |
Output is correct |
19 |
Correct |
92 ms |
24136 KB |
Output is correct |
20 |
Correct |
267 ms |
40648 KB |
Output is correct |
21 |
Correct |
108 ms |
23928 KB |
Output is correct |
22 |
Correct |
59 ms |
23628 KB |
Output is correct |
23 |
Correct |
166 ms |
60488 KB |
Output is correct |
24 |
Correct |
100 ms |
47996 KB |
Output is correct |
25 |
Correct |
2 ms |
1112 KB |
Output is correct |
26 |
Correct |
2 ms |
1628 KB |
Output is correct |
27 |
Correct |
1 ms |
792 KB |
Output is correct |
28 |
Correct |
1 ms |
888 KB |
Output is correct |
29 |
Correct |
8 ms |
2720 KB |
Output is correct |
30 |
Correct |
89 ms |
23620 KB |
Output is correct |
31 |
Correct |
96 ms |
25156 KB |
Output is correct |
32 |
Correct |
117 ms |
38468 KB |
Output is correct |
33 |
Correct |
63 ms |
23620 KB |
Output is correct |
34 |
Correct |
1 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
456 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
12 ms |
5652 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
3 ms |
2448 KB |
Output is correct |
11 |
Correct |
0 ms |
420 KB |
Output is correct |
12 |
Correct |
2 ms |
2136 KB |
Output is correct |
13 |
Correct |
1 ms |
456 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
1628 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 |
348 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
860 KB |
Output is correct |
24 |
Correct |
2 ms |
860 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
1 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
1624 KB |
Output is correct |
28 |
Correct |
1 ms |
860 KB |
Output is correct |
29 |
Correct |
1 ms |
856 KB |
Output is correct |
30 |
Correct |
2 ms |
1628 KB |
Output is correct |
31 |
Correct |
20 ms |
1364 KB |
Output is correct |
32 |
Correct |
2 ms |
604 KB |
Output is correct |
33 |
Correct |
2 ms |
980 KB |
Output is correct |
34 |
Correct |
3 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
860 KB |
Output is correct |
36 |
Correct |
5 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
856 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
460 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
12 ms |
5468 KB |
Output is correct |
9 |
Correct |
169 ms |
92312 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
3 ms |
2396 KB |
Output is correct |
12 |
Correct |
207 ms |
110368 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
2140 KB |
Output is correct |
15 |
Correct |
165 ms |
93212 KB |
Output is correct |
16 |
Correct |
0 ms |
348 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 |
3 ms |
2396 KB |
Output is correct |
21 |
Correct |
217 ms |
110396 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
60 ms |
20032 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
3 ms |
1492 KB |
Output is correct |
27 |
Correct |
155 ms |
66608 KB |
Output is correct |
28 |
Correct |
36 ms |
18132 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
91 ms |
20116 KB |
Output is correct |
32 |
Correct |
95 ms |
19892 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
2 ms |
604 KB |
Output is correct |
35 |
Correct |
101 ms |
20480 KB |
Output is correct |
36 |
Correct |
88 ms |
20308 KB |
Output is correct |
37 |
Correct |
92 ms |
20484 KB |
Output is correct |
38 |
Correct |
0 ms |
600 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
452 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 |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
173 ms |
92488 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
2 ms |
2136 KB |
Output is correct |
49 |
Correct |
146 ms |
93320 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
1 ms |
860 KB |
Output is correct |
54 |
Correct |
2 ms |
860 KB |
Output is correct |
55 |
Correct |
1 ms |
860 KB |
Output is correct |
56 |
Correct |
88 ms |
24052 KB |
Output is correct |
57 |
Correct |
92 ms |
24136 KB |
Output is correct |
58 |
Correct |
267 ms |
40648 KB |
Output is correct |
59 |
Correct |
108 ms |
23928 KB |
Output is correct |
60 |
Correct |
59 ms |
23628 KB |
Output is correct |
61 |
Correct |
166 ms |
60488 KB |
Output is correct |
62 |
Correct |
100 ms |
47996 KB |
Output is correct |
63 |
Correct |
2 ms |
1112 KB |
Output is correct |
64 |
Correct |
2 ms |
1628 KB |
Output is correct |
65 |
Correct |
1 ms |
792 KB |
Output is correct |
66 |
Correct |
1 ms |
888 KB |
Output is correct |
67 |
Correct |
8 ms |
2720 KB |
Output is correct |
68 |
Correct |
89 ms |
23620 KB |
Output is correct |
69 |
Correct |
96 ms |
25156 KB |
Output is correct |
70 |
Correct |
117 ms |
38468 KB |
Output is correct |
71 |
Correct |
63 ms |
23620 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
0 ms |
348 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 KB |
Output is correct |
78 |
Correct |
0 ms |
456 KB |
Output is correct |
79 |
Correct |
0 ms |
348 KB |
Output is correct |
80 |
Correct |
0 ms |
348 KB |
Output is correct |
81 |
Correct |
0 ms |
348 KB |
Output is correct |
82 |
Correct |
0 ms |
348 KB |
Output is correct |
83 |
Correct |
12 ms |
5652 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
3 ms |
2448 KB |
Output is correct |
86 |
Correct |
0 ms |
420 KB |
Output is correct |
87 |
Correct |
2 ms |
2136 KB |
Output is correct |
88 |
Correct |
1 ms |
456 KB |
Output is correct |
89 |
Correct |
1 ms |
604 KB |
Output is correct |
90 |
Correct |
1 ms |
348 KB |
Output is correct |
91 |
Correct |
3 ms |
1628 KB |
Output is correct |
92 |
Correct |
0 ms |
348 KB |
Output is correct |
93 |
Correct |
0 ms |
348 KB |
Output is correct |
94 |
Correct |
1 ms |
348 KB |
Output is correct |
95 |
Correct |
2 ms |
604 KB |
Output is correct |
96 |
Correct |
1 ms |
344 KB |
Output is correct |
97 |
Correct |
0 ms |
344 KB |
Output is correct |
98 |
Correct |
1 ms |
860 KB |
Output is correct |
99 |
Correct |
2 ms |
860 KB |
Output is correct |
100 |
Correct |
1 ms |
860 KB |
Output is correct |
101 |
Correct |
1 ms |
1116 KB |
Output is correct |
102 |
Correct |
4 ms |
1624 KB |
Output is correct |
103 |
Correct |
1 ms |
860 KB |
Output is correct |
104 |
Correct |
1 ms |
856 KB |
Output is correct |
105 |
Correct |
2 ms |
1628 KB |
Output is correct |
106 |
Correct |
20 ms |
1364 KB |
Output is correct |
107 |
Correct |
2 ms |
604 KB |
Output is correct |
108 |
Correct |
2 ms |
980 KB |
Output is correct |
109 |
Correct |
3 ms |
856 KB |
Output is correct |
110 |
Correct |
1 ms |
860 KB |
Output is correct |
111 |
Correct |
5 ms |
860 KB |
Output is correct |
112 |
Correct |
2 ms |
856 KB |
Output is correct |
113 |
Correct |
0 ms |
348 KB |
Output is correct |
114 |
Correct |
0 ms |
348 KB |
Output is correct |
115 |
Correct |
0 ms |
348 KB |
Output is correct |
116 |
Correct |
0 ms |
348 KB |
Output is correct |
117 |
Correct |
0 ms |
348 KB |
Output is correct |
118 |
Correct |
0 ms |
348 KB |
Output is correct |
119 |
Correct |
0 ms |
348 KB |
Output is correct |
120 |
Correct |
0 ms |
352 KB |
Output is correct |
121 |
Correct |
0 ms |
352 KB |
Output is correct |
122 |
Correct |
0 ms |
456 KB |
Output is correct |
123 |
Correct |
0 ms |
344 KB |
Output is correct |
124 |
Correct |
12 ms |
5656 KB |
Output is correct |
125 |
Correct |
179 ms |
92364 KB |
Output is correct |
126 |
Correct |
0 ms |
348 KB |
Output is correct |
127 |
Correct |
3 ms |
2396 KB |
Output is correct |
128 |
Correct |
210 ms |
110336 KB |
Output is correct |
129 |
Correct |
0 ms |
344 KB |
Output is correct |
130 |
Correct |
2 ms |
2404 KB |
Output is correct |
131 |
Correct |
152 ms |
93504 KB |
Output is correct |
132 |
Correct |
1 ms |
344 KB |
Output is correct |
133 |
Correct |
1 ms |
604 KB |
Output is correct |
134 |
Correct |
60 ms |
20016 KB |
Output is correct |
135 |
Correct |
0 ms |
348 KB |
Output is correct |
136 |
Correct |
2 ms |
1628 KB |
Output is correct |
137 |
Correct |
159 ms |
66744 KB |
Output is correct |
138 |
Correct |
37 ms |
18220 KB |
Output is correct |
139 |
Correct |
0 ms |
348 KB |
Output is correct |
140 |
Correct |
1 ms |
344 KB |
Output is correct |
141 |
Correct |
115 ms |
19892 KB |
Output is correct |
142 |
Correct |
98 ms |
19884 KB |
Output is correct |
143 |
Correct |
0 ms |
348 KB |
Output is correct |
144 |
Correct |
3 ms |
604 KB |
Output is correct |
145 |
Correct |
89 ms |
20304 KB |
Output is correct |
146 |
Correct |
92 ms |
20484 KB |
Output is correct |
147 |
Correct |
93 ms |
20336 KB |
Output is correct |
148 |
Correct |
0 ms |
348 KB |
Output is correct |
149 |
Correct |
0 ms |
348 KB |
Output is correct |
150 |
Correct |
1 ms |
860 KB |
Output is correct |
151 |
Correct |
2 ms |
860 KB |
Output is correct |
152 |
Correct |
1 ms |
860 KB |
Output is correct |
153 |
Correct |
85 ms |
24104 KB |
Output is correct |
154 |
Correct |
100 ms |
24164 KB |
Output is correct |
155 |
Correct |
283 ms |
40648 KB |
Output is correct |
156 |
Correct |
128 ms |
23992 KB |
Output is correct |
157 |
Correct |
60 ms |
23656 KB |
Output is correct |
158 |
Correct |
161 ms |
60492 KB |
Output is correct |
159 |
Correct |
104 ms |
48156 KB |
Output is correct |
160 |
Correct |
2 ms |
1112 KB |
Output is correct |
161 |
Correct |
2 ms |
1628 KB |
Output is correct |
162 |
Correct |
2 ms |
888 KB |
Output is correct |
163 |
Correct |
1 ms |
820 KB |
Output is correct |
164 |
Correct |
7 ms |
2652 KB |
Output is correct |
165 |
Correct |
92 ms |
23700 KB |
Output is correct |
166 |
Correct |
85 ms |
25152 KB |
Output is correct |
167 |
Correct |
120 ms |
38468 KB |
Output is correct |
168 |
Correct |
63 ms |
23620 KB |
Output is correct |
169 |
Correct |
2 ms |
1628 KB |
Output is correct |
170 |
Correct |
18 ms |
1232 KB |
Output is correct |
171 |
Correct |
2 ms |
604 KB |
Output is correct |
172 |
Correct |
2 ms |
1116 KB |
Output is correct |
173 |
Correct |
3 ms |
860 KB |
Output is correct |
174 |
Correct |
2 ms |
860 KB |
Output is correct |
175 |
Correct |
4 ms |
860 KB |
Output is correct |
176 |
Correct |
2 ms |
860 KB |
Output is correct |
177 |
Correct |
133 ms |
65600 KB |
Output is correct |
178 |
Execution timed out |
4048 ms |
187236 KB |
Time limit exceeded |
179 |
Halted |
0 ms |
0 KB |
- |