#include <bits/stdc++.h>
using namespace std;
namespace {
template <typename Fun>
struct YCombinator {
template <typename T>
YCombinator(T &&_fun) : fun(forward<T>(_fun)) {}
template <typename... Args>
decltype(auto) operator()(Args &&...args) {
return fun(ref(*this), forward<Args>(args)...);
}
private:
Fun fun;
};
template <typename T>
YCombinator(T &&) -> YCombinator<decay_t<T>>;
struct DSU {
DSU(int n) : e(n, -1) {}
int find(int x) {
return e[x] < 0 ? x : e[x] = find(e[x]);
}
bool same(int x, int y) {
return find(x) == find(y);
}
bool unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y) {
return false;
}
if (e[x] > e[y]) {
swap(x, y);
}
e[x] += e[y];
e[y] = x;
return true;
}
int size(int x) {
return -e[find(x)];
}
int size() const {
return (int)e.size();
}
private:
vector<int> e;
};
pair<vector<vector<int>>, vector<int>> biconnected_components(int n, const auto &edges) {
vector<vector<int>> adj(n);
for (auto [u, v] : edges) {
adj[u].push_back(v);
adj[v].push_back(u);
}
vector<int> articulation_points;
vector<vector<int>> components;
{
vector<int> tin(n, -1), low(n);
stack<int> st;
int timer = 0;
auto dfs = [&](auto self, int u, int p) -> void {
low[u] = tin[u] = timer++;
st.push(u);
bool ap = false;
for (int v : adj[u]) {
if (tin[v] == -1) {
self(self, v, u);
low[u] = min(low[u], low[v]);
if (low[v] == tin[u]) {
if (p != -1 || tin[v] > tin[u] + 1) {
ap = true;
}
vector<int> &comp = components.emplace_back();
comp.push_back(u);
while (comp.back() != v) {
comp.push_back(st.top());
st.pop();
}
}
} else {
low[u] = min(low[u], tin[v]);
}
}
if (ap) {
articulation_points.push_back(u);
}
};
for (int u = 0; u < n; u++) {
if (tin[u] == -1) {
dfs(dfs, u, -1);
}
}
}
return pair(components, articulation_points);
}
} // namespace
void solve() {
int n, m;
cin >> n >> m;
vector<array<int, 2>> edges(m);
for (auto &[u, v] : edges) {
cin >> u >> v;
--u;
--v;
}
auto [bcc, art] = biconnected_components(n, edges);
int art_sz = (int)art.size(), bcc_sz = (int)bcc.size();
int l = art_sz + bcc_sz;
vector id(n, -1);
vector<vector<int>> bc_tree(l);
DSU dsu(l);
vector<int> sub(l);
for (int i = 0; i < art_sz; i++) {
id[art[i]] = i;
sub[i]++;
}
for (int i = 0; i < bcc_sz; i++) {
int j = art_sz + i;
for (int u : bcc[i]) {
if (id[u] == -1) {
id[u] = j;
sub[j]++;
} else {
bc_tree[id[u]].push_back(j);
bc_tree[j].push_back(id[u]);
dsu.unite(id[u], j);
}
}
}
YCombinator dfs = [&](auto self, int i, int p) -> int {
for (int j : bc_tree[i]) {
if (j != p) {
sub[i] += self(j, i);
}
}
return sub[i];
};
long ans = 0;
for (int i = 0; i < l; i++) {
if (dsu.find(i) == i) {
int k = dfs(i, -1);
ans += (long)k * (k - 1) * (k - 2);
}
}
for (int u : art) {
int i = id[u];
int k = sub[dsu.find(i)];
for (int j : bc_tree[i]) {
int x = (int)bcc[j - art_sz].size() - 1, y = (sub[i] > sub[j] ? k - sub[j] : sub[i]);
ans -= (long)x * y * (y - 1);
}
}
cout << ans << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Compilation message
count_triplets.cpp:61:76: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
61 | pair<vector<vector<int>>, vector<int>> biconnected_components(int n, const auto &edges) {
| ^~~~
# |
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 |
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 |
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 |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
448 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
392 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
448 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
604 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 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 |
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 |
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 |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
448 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
392 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
448 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
604 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 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 |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
348 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 |
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 |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
448 KB |
Output is correct |
48 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 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 |
456 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
452 KB |
Output is correct |
61 |
Correct |
0 ms |
452 KB |
Output is correct |
62 |
Correct |
1 ms |
344 KB |
Output is correct |
63 |
Correct |
0 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
25244 KB |
Output is correct |
2 |
Correct |
43 ms |
25296 KB |
Output is correct |
3 |
Correct |
66 ms |
21884 KB |
Output is correct |
4 |
Correct |
57 ms |
23120 KB |
Output is correct |
5 |
Correct |
56 ms |
17496 KB |
Output is correct |
6 |
Correct |
56 ms |
19824 KB |
Output is correct |
7 |
Correct |
65 ms |
18240 KB |
Output is correct |
8 |
Correct |
86 ms |
19648 KB |
Output is correct |
9 |
Correct |
52 ms |
16872 KB |
Output is correct |
10 |
Correct |
52 ms |
17028 KB |
Output is correct |
11 |
Correct |
43 ms |
13184 KB |
Output is correct |
12 |
Correct |
47 ms |
13048 KB |
Output is correct |
13 |
Correct |
41 ms |
12800 KB |
Output is correct |
14 |
Correct |
42 ms |
12424 KB |
Output is correct |
15 |
Correct |
35 ms |
11008 KB |
Output is correct |
16 |
Correct |
39 ms |
10744 KB |
Output is correct |
17 |
Correct |
3 ms |
4128 KB |
Output is correct |
18 |
Correct |
3 ms |
3932 KB |
Output is correct |
19 |
Correct |
2 ms |
3932 KB |
Output is correct |
20 |
Correct |
3 ms |
3932 KB |
Output is correct |
21 |
Correct |
3 ms |
3932 KB |
Output is correct |
22 |
Correct |
3 ms |
3976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
608 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
1 ms |
472 KB |
Output is correct |
16 |
Correct |
1 ms |
464 KB |
Output is correct |
17 |
Correct |
1 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
66 ms |
19188 KB |
Output is correct |
2 |
Correct |
65 ms |
19308 KB |
Output is correct |
3 |
Correct |
81 ms |
19312 KB |
Output is correct |
4 |
Correct |
75 ms |
19952 KB |
Output is correct |
5 |
Correct |
75 ms |
19700 KB |
Output is correct |
6 |
Correct |
91 ms |
29860 KB |
Output is correct |
7 |
Correct |
78 ms |
25236 KB |
Output is correct |
8 |
Correct |
82 ms |
23664 KB |
Output is correct |
9 |
Correct |
82 ms |
22116 KB |
Output is correct |
10 |
Correct |
66 ms |
19448 KB |
Output is correct |
11 |
Correct |
65 ms |
19184 KB |
Output is correct |
12 |
Correct |
64 ms |
19408 KB |
Output is correct |
13 |
Correct |
71 ms |
19296 KB |
Output is correct |
14 |
Correct |
57 ms |
17904 KB |
Output is correct |
15 |
Correct |
69 ms |
17436 KB |
Output is correct |
16 |
Correct |
31 ms |
11776 KB |
Output is correct |
17 |
Correct |
49 ms |
19116 KB |
Output is correct |
18 |
Correct |
46 ms |
19176 KB |
Output is correct |
19 |
Correct |
45 ms |
19300 KB |
Output is correct |
20 |
Correct |
49 ms |
19808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
404 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
1 ms |
604 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
1 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
452 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
464 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
856 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
19364 KB |
Output is correct |
2 |
Correct |
74 ms |
19304 KB |
Output is correct |
3 |
Correct |
69 ms |
17904 KB |
Output is correct |
4 |
Correct |
65 ms |
15252 KB |
Output is correct |
5 |
Correct |
46 ms |
12532 KB |
Output is correct |
6 |
Correct |
47 ms |
11516 KB |
Output is correct |
7 |
Correct |
45 ms |
11052 KB |
Output is correct |
8 |
Correct |
38 ms |
10216 KB |
Output is correct |
9 |
Correct |
35 ms |
10052 KB |
Output is correct |
10 |
Correct |
47 ms |
9624 KB |
Output is correct |
11 |
Correct |
34 ms |
9500 KB |
Output is correct |
12 |
Correct |
34 ms |
9812 KB |
Output is correct |
13 |
Correct |
32 ms |
9828 KB |
Output is correct |
14 |
Correct |
36 ms |
13396 KB |
Output is correct |
15 |
Correct |
69 ms |
25324 KB |
Output is correct |
16 |
Correct |
68 ms |
22252 KB |
Output is correct |
17 |
Correct |
70 ms |
22516 KB |
Output is correct |
18 |
Correct |
74 ms |
21652 KB |
Output is correct |
19 |
Correct |
70 ms |
15352 KB |
Output is correct |
20 |
Correct |
60 ms |
15348 KB |
Output is correct |
21 |
Correct |
58 ms |
15212 KB |
Output is correct |
22 |
Correct |
50 ms |
13904 KB |
Output is correct |
23 |
Correct |
47 ms |
12404 KB |
Output is correct |
24 |
Correct |
59 ms |
18672 KB |
Output is correct |
25 |
Correct |
56 ms |
17872 KB |
Output is correct |
26 |
Correct |
53 ms |
17092 KB |
Output is correct |
27 |
Correct |
67 ms |
16268 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 |
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 |
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 |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
448 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
392 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
448 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
604 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 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 |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
348 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 |
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 |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
448 KB |
Output is correct |
48 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 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 |
456 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
452 KB |
Output is correct |
61 |
Correct |
0 ms |
452 KB |
Output is correct |
62 |
Correct |
1 ms |
344 KB |
Output is correct |
63 |
Correct |
0 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
460 KB |
Output is correct |
68 |
Correct |
1 ms |
604 KB |
Output is correct |
69 |
Correct |
1 ms |
604 KB |
Output is correct |
70 |
Correct |
1 ms |
464 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
344 KB |
Output is correct |
73 |
Correct |
1 ms |
348 KB |
Output is correct |
74 |
Correct |
1 ms |
456 KB |
Output is correct |
75 |
Correct |
1 ms |
344 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
1 ms |
604 KB |
Output is correct |
78 |
Correct |
1 ms |
348 KB |
Output is correct |
79 |
Correct |
1 ms |
348 KB |
Output is correct |
80 |
Correct |
1 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
464 KB |
Output is correct |
82 |
Correct |
1 ms |
600 KB |
Output is correct |
83 |
Correct |
1 ms |
600 KB |
Output is correct |
84 |
Correct |
1 ms |
600 KB |
Output is correct |
85 |
Correct |
1 ms |
600 KB |
Output is correct |
86 |
Correct |
1 ms |
344 KB |
Output is correct |
87 |
Correct |
1 ms |
348 KB |
Output is correct |
88 |
Correct |
1 ms |
348 KB |
Output is correct |
89 |
Correct |
1 ms |
348 KB |
Output is correct |
90 |
Correct |
1 ms |
348 KB |
Output is correct |
91 |
Correct |
1 ms |
348 KB |
Output is correct |
92 |
Correct |
1 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 |
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 |
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 |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
448 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
392 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
448 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 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 |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
604 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 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 |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
348 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 |
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 |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
448 KB |
Output is correct |
48 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 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 |
456 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
452 KB |
Output is correct |
61 |
Correct |
0 ms |
452 KB |
Output is correct |
62 |
Correct |
1 ms |
344 KB |
Output is correct |
63 |
Correct |
0 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
43 ms |
25244 KB |
Output is correct |
67 |
Correct |
43 ms |
25296 KB |
Output is correct |
68 |
Correct |
66 ms |
21884 KB |
Output is correct |
69 |
Correct |
57 ms |
23120 KB |
Output is correct |
70 |
Correct |
56 ms |
17496 KB |
Output is correct |
71 |
Correct |
56 ms |
19824 KB |
Output is correct |
72 |
Correct |
65 ms |
18240 KB |
Output is correct |
73 |
Correct |
86 ms |
19648 KB |
Output is correct |
74 |
Correct |
52 ms |
16872 KB |
Output is correct |
75 |
Correct |
52 ms |
17028 KB |
Output is correct |
76 |
Correct |
43 ms |
13184 KB |
Output is correct |
77 |
Correct |
47 ms |
13048 KB |
Output is correct |
78 |
Correct |
41 ms |
12800 KB |
Output is correct |
79 |
Correct |
42 ms |
12424 KB |
Output is correct |
80 |
Correct |
35 ms |
11008 KB |
Output is correct |
81 |
Correct |
39 ms |
10744 KB |
Output is correct |
82 |
Correct |
3 ms |
4128 KB |
Output is correct |
83 |
Correct |
3 ms |
3932 KB |
Output is correct |
84 |
Correct |
2 ms |
3932 KB |
Output is correct |
85 |
Correct |
3 ms |
3932 KB |
Output is correct |
86 |
Correct |
3 ms |
3932 KB |
Output is correct |
87 |
Correct |
3 ms |
3976 KB |
Output is correct |
88 |
Correct |
2 ms |
604 KB |
Output is correct |
89 |
Correct |
1 ms |
604 KB |
Output is correct |
90 |
Correct |
1 ms |
604 KB |
Output is correct |
91 |
Correct |
1 ms |
860 KB |
Output is correct |
92 |
Correct |
1 ms |
604 KB |
Output is correct |
93 |
Correct |
1 ms |
604 KB |
Output is correct |
94 |
Correct |
1 ms |
600 KB |
Output is correct |
95 |
Correct |
1 ms |
604 KB |
Output is correct |
96 |
Correct |
1 ms |
604 KB |
Output is correct |
97 |
Correct |
1 ms |
604 KB |
Output is correct |
98 |
Correct |
1 ms |
604 KB |
Output is correct |
99 |
Correct |
1 ms |
604 KB |
Output is correct |
100 |
Correct |
1 ms |
608 KB |
Output is correct |
101 |
Correct |
1 ms |
460 KB |
Output is correct |
102 |
Correct |
1 ms |
472 KB |
Output is correct |
103 |
Correct |
1 ms |
464 KB |
Output is correct |
104 |
Correct |
1 ms |
604 KB |
Output is correct |
105 |
Correct |
1 ms |
604 KB |
Output is correct |
106 |
Correct |
1 ms |
604 KB |
Output is correct |
107 |
Correct |
1 ms |
460 KB |
Output is correct |
108 |
Correct |
66 ms |
19188 KB |
Output is correct |
109 |
Correct |
65 ms |
19308 KB |
Output is correct |
110 |
Correct |
81 ms |
19312 KB |
Output is correct |
111 |
Correct |
75 ms |
19952 KB |
Output is correct |
112 |
Correct |
75 ms |
19700 KB |
Output is correct |
113 |
Correct |
91 ms |
29860 KB |
Output is correct |
114 |
Correct |
78 ms |
25236 KB |
Output is correct |
115 |
Correct |
82 ms |
23664 KB |
Output is correct |
116 |
Correct |
82 ms |
22116 KB |
Output is correct |
117 |
Correct |
66 ms |
19448 KB |
Output is correct |
118 |
Correct |
65 ms |
19184 KB |
Output is correct |
119 |
Correct |
64 ms |
19408 KB |
Output is correct |
120 |
Correct |
71 ms |
19296 KB |
Output is correct |
121 |
Correct |
57 ms |
17904 KB |
Output is correct |
122 |
Correct |
69 ms |
17436 KB |
Output is correct |
123 |
Correct |
31 ms |
11776 KB |
Output is correct |
124 |
Correct |
49 ms |
19116 KB |
Output is correct |
125 |
Correct |
46 ms |
19176 KB |
Output is correct |
126 |
Correct |
45 ms |
19300 KB |
Output is correct |
127 |
Correct |
49 ms |
19808 KB |
Output is correct |
128 |
Correct |
1 ms |
444 KB |
Output is correct |
129 |
Correct |
1 ms |
460 KB |
Output is correct |
130 |
Correct |
1 ms |
604 KB |
Output is correct |
131 |
Correct |
1 ms |
404 KB |
Output is correct |
132 |
Correct |
1 ms |
348 KB |
Output is correct |
133 |
Correct |
1 ms |
348 KB |
Output is correct |
134 |
Correct |
1 ms |
348 KB |
Output is correct |
135 |
Correct |
1 ms |
348 KB |
Output is correct |
136 |
Correct |
1 ms |
348 KB |
Output is correct |
137 |
Correct |
1 ms |
348 KB |
Output is correct |
138 |
Correct |
1 ms |
348 KB |
Output is correct |
139 |
Correct |
1 ms |
604 KB |
Output is correct |
140 |
Correct |
1 ms |
604 KB |
Output is correct |
141 |
Correct |
1 ms |
604 KB |
Output is correct |
142 |
Correct |
1 ms |
604 KB |
Output is correct |
143 |
Correct |
1 ms |
604 KB |
Output is correct |
144 |
Correct |
1 ms |
604 KB |
Output is correct |
145 |
Correct |
1 ms |
452 KB |
Output is correct |
146 |
Correct |
1 ms |
348 KB |
Output is correct |
147 |
Correct |
1 ms |
464 KB |
Output is correct |
148 |
Correct |
1 ms |
604 KB |
Output is correct |
149 |
Correct |
1 ms |
604 KB |
Output is correct |
150 |
Correct |
1 ms |
856 KB |
Output is correct |
151 |
Correct |
1 ms |
604 KB |
Output is correct |
152 |
Correct |
1 ms |
348 KB |
Output is correct |
153 |
Correct |
0 ms |
348 KB |
Output is correct |
154 |
Correct |
1 ms |
348 KB |
Output is correct |
155 |
Correct |
84 ms |
19364 KB |
Output is correct |
156 |
Correct |
74 ms |
19304 KB |
Output is correct |
157 |
Correct |
69 ms |
17904 KB |
Output is correct |
158 |
Correct |
65 ms |
15252 KB |
Output is correct |
159 |
Correct |
46 ms |
12532 KB |
Output is correct |
160 |
Correct |
47 ms |
11516 KB |
Output is correct |
161 |
Correct |
45 ms |
11052 KB |
Output is correct |
162 |
Correct |
38 ms |
10216 KB |
Output is correct |
163 |
Correct |
35 ms |
10052 KB |
Output is correct |
164 |
Correct |
47 ms |
9624 KB |
Output is correct |
165 |
Correct |
34 ms |
9500 KB |
Output is correct |
166 |
Correct |
34 ms |
9812 KB |
Output is correct |
167 |
Correct |
32 ms |
9828 KB |
Output is correct |
168 |
Correct |
36 ms |
13396 KB |
Output is correct |
169 |
Correct |
69 ms |
25324 KB |
Output is correct |
170 |
Correct |
68 ms |
22252 KB |
Output is correct |
171 |
Correct |
70 ms |
22516 KB |
Output is correct |
172 |
Correct |
74 ms |
21652 KB |
Output is correct |
173 |
Correct |
70 ms |
15352 KB |
Output is correct |
174 |
Correct |
60 ms |
15348 KB |
Output is correct |
175 |
Correct |
58 ms |
15212 KB |
Output is correct |
176 |
Correct |
50 ms |
13904 KB |
Output is correct |
177 |
Correct |
47 ms |
12404 KB |
Output is correct |
178 |
Correct |
59 ms |
18672 KB |
Output is correct |
179 |
Correct |
56 ms |
17872 KB |
Output is correct |
180 |
Correct |
53 ms |
17092 KB |
Output is correct |
181 |
Correct |
67 ms |
16268 KB |
Output is correct |
182 |
Correct |
1 ms |
348 KB |
Output is correct |
183 |
Correct |
1 ms |
460 KB |
Output is correct |
184 |
Correct |
1 ms |
604 KB |
Output is correct |
185 |
Correct |
1 ms |
604 KB |
Output is correct |
186 |
Correct |
1 ms |
464 KB |
Output is correct |
187 |
Correct |
1 ms |
348 KB |
Output is correct |
188 |
Correct |
1 ms |
344 KB |
Output is correct |
189 |
Correct |
1 ms |
348 KB |
Output is correct |
190 |
Correct |
1 ms |
456 KB |
Output is correct |
191 |
Correct |
1 ms |
344 KB |
Output is correct |
192 |
Correct |
0 ms |
348 KB |
Output is correct |
193 |
Correct |
1 ms |
604 KB |
Output is correct |
194 |
Correct |
1 ms |
348 KB |
Output is correct |
195 |
Correct |
1 ms |
348 KB |
Output is correct |
196 |
Correct |
1 ms |
348 KB |
Output is correct |
197 |
Correct |
1 ms |
464 KB |
Output is correct |
198 |
Correct |
1 ms |
600 KB |
Output is correct |
199 |
Correct |
1 ms |
600 KB |
Output is correct |
200 |
Correct |
1 ms |
600 KB |
Output is correct |
201 |
Correct |
1 ms |
600 KB |
Output is correct |
202 |
Correct |
1 ms |
344 KB |
Output is correct |
203 |
Correct |
1 ms |
348 KB |
Output is correct |
204 |
Correct |
1 ms |
348 KB |
Output is correct |
205 |
Correct |
1 ms |
348 KB |
Output is correct |
206 |
Correct |
1 ms |
348 KB |
Output is correct |
207 |
Correct |
1 ms |
348 KB |
Output is correct |
208 |
Correct |
1 ms |
348 KB |
Output is correct |
209 |
Correct |
3 ms |
3932 KB |
Output is correct |
210 |
Correct |
34 ms |
11388 KB |
Output is correct |
211 |
Correct |
55 ms |
16184 KB |
Output is correct |
212 |
Correct |
60 ms |
19188 KB |
Output is correct |
213 |
Correct |
74 ms |
22412 KB |
Output is correct |
214 |
Correct |
43 ms |
12688 KB |
Output is correct |
215 |
Correct |
41 ms |
11776 KB |
Output is correct |
216 |
Correct |
73 ms |
17404 KB |
Output is correct |
217 |
Correct |
60 ms |
13276 KB |
Output is correct |
218 |
Correct |
39 ms |
10336 KB |
Output is correct |
219 |
Correct |
36 ms |
9552 KB |
Output is correct |
220 |
Correct |
35 ms |
9552 KB |
Output is correct |
221 |
Correct |
31 ms |
9560 KB |
Output is correct |
222 |
Correct |
33 ms |
11652 KB |
Output is correct |
223 |
Correct |
80 ms |
17636 KB |
Output is correct |
224 |
Correct |
57 ms |
16344 KB |
Output is correct |
225 |
Correct |
52 ms |
12796 KB |
Output is correct |
226 |
Correct |
49 ms |
12612 KB |
Output is correct |
227 |
Correct |
61 ms |
12784 KB |
Output is correct |
228 |
Correct |
45 ms |
11896 KB |
Output is correct |
229 |
Correct |
39 ms |
11156 KB |
Output is correct |
230 |
Correct |
49 ms |
13300 KB |
Output is correct |
231 |
Correct |
51 ms |
13304 KB |
Output is correct |