#include <bits/stdc++.h>
#define vi vector<int>
#define long long long
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 3e5+5;
long ans;
int n, m;
vector<vi> g, ccs;
int id[N], low[N], pre[N];
bitset<N> mark, art;
vi sz;
void find_component(int u, int p) {
static int idx = 0;
static stack<int> S;
pre[u] = low[u] = ++idx;
mark[u] = true;
int cnt = 0;
S.emplace(u);
for(auto v : g[u]) if(!mark[v]) {
++cnt;
find_component(v, u);
low[u] = min(low[u], low[v]);
if(!p && cnt > 1 || p && low[v] >= pre[u]) art[u] = true;
if(low[v] >= pre[u]) {
ccs.emplace_back(vi());
ccs.back().emplace_back(u);
while(ccs.back().back() != v) ccs.back().emplace_back(S.top()), S.pop();
}
} else if(v != p) low[u] = min(low[u], pre[v]);
}
bitset<N> idart;
void gen_bctree() {
g.emplace_back(vi());
sz.emplace_back(0);
for(int i = 1; i <= n; ++i) if(art[i]) {
idart[id[i] = g.size()] = true;
g.emplace_back(vi());
sz.emplace_back(1);
}
for(auto &cc : ccs) {
g.emplace_back(vi());
sz.emplace_back(cc.size());
for(auto v : cc) {
if(art[v]) g[id[v]].emplace_back(g.size()-1), g.back().emplace_back(id[v]);
else id[v] = g.size()-1;
}
}
}
bitset<N> chk;
int dp[N];
int find_centroid(int u, int p, int sz, pii &ret) {
int mx = 0; dp[u] = 1;
for(auto v : g[u]) if(v != p and !chk[v]) {
dp[u] += find_centroid(v, u, sz, ret);
mx = max(mx, dp[v]);
}
mx = max(mx, sz - dp[u]);
if(ret.x > mx) ret = pii(mx, u);
return dp[u];
}
int rsize[N];
long get(int u) {
return sz[u] - 2 * (idart[u] ? 0 : 1);
}
void fill_son(int u, int p, long &ret, long val, bool st, int &wanna) {
if(st) ans += rsize[u] * (ret + wanna * (val - idart[u]));
else {
ret += rsize[u] * (val - idart[u]);
wanna += rsize[u];
}
for(auto v : g[u]) if(v != p and !chk[v]) fill_son(v, u, ret, val + get(v), st, wanna);
}
void centroid_decompos(int u, int sz) {
pii ret(sz, -1);
find_centroid(u, 0, sz, ret);
chk[u = ret.y] = true;
long val = (get(u) - idart[u]) * rsize[u];
if(::sz[u] > 2) ans += (::sz[u] - 2ll) * ((rsize[u]) * (rsize[u]-1ll) / 2);
int wanna = rsize[u];
for(auto v : g[u]) if(!chk[v]) {
fill_son(v, u, val, get(v), true, wanna),
fill_son(v, u, val, get(v) + get(u), false, wanna);
}
for(auto v : g[u]) if(!chk[v]) centroid_decompos(v, dp[v] < dp[u] ? dp[v] : sz - dp[u]);
}
int main() {
scanf("%d %d", &n, &m);
g.resize(n+1);
for(int i = 0, u, v; i < m; ++i) {
scanf("%d %d", &u, &v);
g[u].emplace_back(v), g[v].emplace_back(u);
}
for(int i = 1; i <= n; ++i) if(!mark[i]) find_component(i, 0);
g.clear();
gen_bctree();
for(int i = 1; i <= n; ++i) rsize[id[i]]++;
pii temp;
for(int i = 1; i < g.size(); ++i) if(!chk[i]) centroid_decompos(i, find_centroid(i, 0, 0, temp));
printf("%lld\n", ans << 1);
}
Compilation message
count_triplets.cpp: In function 'void find_component(int, int)':
count_triplets.cpp:30:9: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if(!p && cnt > 1 || p && low[v] >= pre[u]) art[u] = true;
~~~^~~~~~~~~~
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:114:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < g.size(); ++i) if(!chk[i]) centroid_decompos(i, find_centroid(i, 0, 0, temp));
~~^~~~~~~~~~
count_triplets.cpp:103:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &n, &m);
~~~~~^~~~~~~~~~~~~~~~~
count_triplets.cpp:106:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &u, &v);
~~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 ms |
384 KB |
Output is correct |
30 |
Correct |
4 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 ms |
384 KB |
Output is correct |
30 |
Correct |
4 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
4 ms |
384 KB |
Output is correct |
38 |
Correct |
5 ms |
384 KB |
Output is correct |
39 |
Correct |
5 ms |
384 KB |
Output is correct |
40 |
Correct |
4 ms |
384 KB |
Output is correct |
41 |
Correct |
5 ms |
384 KB |
Output is correct |
42 |
Correct |
4 ms |
384 KB |
Output is correct |
43 |
Correct |
4 ms |
384 KB |
Output is correct |
44 |
Correct |
5 ms |
384 KB |
Output is correct |
45 |
Correct |
5 ms |
384 KB |
Output is correct |
46 |
Correct |
4 ms |
384 KB |
Output is correct |
47 |
Correct |
5 ms |
384 KB |
Output is correct |
48 |
Correct |
5 ms |
384 KB |
Output is correct |
49 |
Correct |
5 ms |
384 KB |
Output is correct |
50 |
Correct |
4 ms |
384 KB |
Output is correct |
51 |
Correct |
5 ms |
384 KB |
Output is correct |
52 |
Correct |
5 ms |
384 KB |
Output is correct |
53 |
Correct |
5 ms |
384 KB |
Output is correct |
54 |
Correct |
5 ms |
384 KB |
Output is correct |
55 |
Correct |
5 ms |
384 KB |
Output is correct |
56 |
Correct |
4 ms |
384 KB |
Output is correct |
57 |
Correct |
5 ms |
384 KB |
Output is correct |
58 |
Correct |
5 ms |
384 KB |
Output is correct |
59 |
Correct |
5 ms |
384 KB |
Output is correct |
60 |
Correct |
5 ms |
384 KB |
Output is correct |
61 |
Correct |
4 ms |
384 KB |
Output is correct |
62 |
Correct |
4 ms |
384 KB |
Output is correct |
63 |
Correct |
5 ms |
384 KB |
Output is correct |
64 |
Correct |
5 ms |
384 KB |
Output is correct |
65 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
19988 KB |
Output is correct |
2 |
Correct |
82 ms |
20012 KB |
Output is correct |
3 |
Correct |
179 ms |
20236 KB |
Output is correct |
4 |
Correct |
122 ms |
19248 KB |
Output is correct |
5 |
Correct |
138 ms |
15748 KB |
Output is correct |
6 |
Correct |
220 ms |
19560 KB |
Output is correct |
7 |
Correct |
189 ms |
17788 KB |
Output is correct |
8 |
Correct |
214 ms |
18328 KB |
Output is correct |
9 |
Correct |
185 ms |
16124 KB |
Output is correct |
10 |
Correct |
157 ms |
16176 KB |
Output is correct |
11 |
Correct |
95 ms |
11564 KB |
Output is correct |
12 |
Correct |
92 ms |
11564 KB |
Output is correct |
13 |
Correct |
76 ms |
11308 KB |
Output is correct |
14 |
Correct |
86 ms |
10924 KB |
Output is correct |
15 |
Correct |
60 ms |
10032 KB |
Output is correct |
16 |
Correct |
54 ms |
9900 KB |
Output is correct |
17 |
Correct |
8 ms |
4352 KB |
Output is correct |
18 |
Correct |
8 ms |
4352 KB |
Output is correct |
19 |
Correct |
8 ms |
4352 KB |
Output is correct |
20 |
Correct |
8 ms |
4352 KB |
Output is correct |
21 |
Correct |
8 ms |
4352 KB |
Output is correct |
22 |
Correct |
8 ms |
4224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
640 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
640 KB |
Output is correct |
5 |
Correct |
6 ms |
640 KB |
Output is correct |
6 |
Correct |
6 ms |
640 KB |
Output is correct |
7 |
Correct |
6 ms |
640 KB |
Output is correct |
8 |
Correct |
6 ms |
640 KB |
Output is correct |
9 |
Correct |
6 ms |
640 KB |
Output is correct |
10 |
Correct |
6 ms |
512 KB |
Output is correct |
11 |
Correct |
6 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
640 KB |
Output is correct |
13 |
Correct |
6 ms |
512 KB |
Output is correct |
14 |
Correct |
6 ms |
512 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
512 KB |
Output is correct |
17 |
Correct |
5 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
512 KB |
Output is correct |
19 |
Correct |
5 ms |
512 KB |
Output is correct |
20 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
18428 KB |
Output is correct |
2 |
Correct |
192 ms |
18428 KB |
Output is correct |
3 |
Correct |
218 ms |
18432 KB |
Output is correct |
4 |
Correct |
207 ms |
18428 KB |
Output is correct |
5 |
Correct |
188 ms |
18432 KB |
Output is correct |
6 |
Correct |
355 ms |
31612 KB |
Output is correct |
7 |
Correct |
308 ms |
26868 KB |
Output is correct |
8 |
Correct |
308 ms |
26232 KB |
Output is correct |
9 |
Correct |
299 ms |
23672 KB |
Output is correct |
10 |
Correct |
194 ms |
18424 KB |
Output is correct |
11 |
Correct |
198 ms |
18424 KB |
Output is correct |
12 |
Correct |
182 ms |
18552 KB |
Output is correct |
13 |
Correct |
199 ms |
18420 KB |
Output is correct |
14 |
Correct |
127 ms |
17148 KB |
Output is correct |
15 |
Correct |
112 ms |
15220 KB |
Output is correct |
16 |
Correct |
65 ms |
10668 KB |
Output is correct |
17 |
Correct |
77 ms |
15968 KB |
Output is correct |
18 |
Correct |
83 ms |
17048 KB |
Output is correct |
19 |
Correct |
85 ms |
17168 KB |
Output is correct |
20 |
Correct |
84 ms |
17048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
640 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
5 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
5 ms |
512 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
640 KB |
Output is correct |
13 |
Correct |
7 ms |
640 KB |
Output is correct |
14 |
Correct |
6 ms |
640 KB |
Output is correct |
15 |
Correct |
6 ms |
636 KB |
Output is correct |
16 |
Correct |
6 ms |
512 KB |
Output is correct |
17 |
Correct |
6 ms |
512 KB |
Output is correct |
18 |
Correct |
6 ms |
512 KB |
Output is correct |
19 |
Correct |
5 ms |
512 KB |
Output is correct |
20 |
Correct |
5 ms |
512 KB |
Output is correct |
21 |
Correct |
5 ms |
512 KB |
Output is correct |
22 |
Correct |
5 ms |
512 KB |
Output is correct |
23 |
Correct |
5 ms |
512 KB |
Output is correct |
24 |
Correct |
5 ms |
512 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
211 ms |
18420 KB |
Output is correct |
2 |
Correct |
214 ms |
19136 KB |
Output is correct |
3 |
Correct |
207 ms |
17020 KB |
Output is correct |
4 |
Correct |
183 ms |
14768 KB |
Output is correct |
5 |
Correct |
136 ms |
11344 KB |
Output is correct |
6 |
Correct |
109 ms |
10416 KB |
Output is correct |
7 |
Correct |
107 ms |
10160 KB |
Output is correct |
8 |
Correct |
99 ms |
9780 KB |
Output is correct |
9 |
Correct |
86 ms |
9500 KB |
Output is correct |
10 |
Correct |
81 ms |
9464 KB |
Output is correct |
11 |
Correct |
73 ms |
9208 KB |
Output is correct |
12 |
Correct |
83 ms |
9208 KB |
Output is correct |
13 |
Correct |
73 ms |
9336 KB |
Output is correct |
14 |
Correct |
82 ms |
11896 KB |
Output is correct |
15 |
Correct |
269 ms |
25000 KB |
Output is correct |
16 |
Correct |
272 ms |
22264 KB |
Output is correct |
17 |
Correct |
266 ms |
23288 KB |
Output is correct |
18 |
Correct |
238 ms |
19328 KB |
Output is correct |
19 |
Correct |
194 ms |
14892 KB |
Output is correct |
20 |
Correct |
189 ms |
14700 KB |
Output is correct |
21 |
Correct |
164 ms |
14764 KB |
Output is correct |
22 |
Correct |
108 ms |
11948 KB |
Output is correct |
23 |
Correct |
96 ms |
11052 KB |
Output is correct |
24 |
Correct |
127 ms |
15976 KB |
Output is correct |
25 |
Correct |
120 ms |
15972 KB |
Output is correct |
26 |
Correct |
117 ms |
15500 KB |
Output is correct |
27 |
Correct |
118 ms |
13844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 ms |
384 KB |
Output is correct |
30 |
Correct |
4 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
4 ms |
384 KB |
Output is correct |
38 |
Correct |
5 ms |
384 KB |
Output is correct |
39 |
Correct |
5 ms |
384 KB |
Output is correct |
40 |
Correct |
4 ms |
384 KB |
Output is correct |
41 |
Correct |
5 ms |
384 KB |
Output is correct |
42 |
Correct |
4 ms |
384 KB |
Output is correct |
43 |
Correct |
4 ms |
384 KB |
Output is correct |
44 |
Correct |
5 ms |
384 KB |
Output is correct |
45 |
Correct |
5 ms |
384 KB |
Output is correct |
46 |
Correct |
4 ms |
384 KB |
Output is correct |
47 |
Correct |
5 ms |
384 KB |
Output is correct |
48 |
Correct |
5 ms |
384 KB |
Output is correct |
49 |
Correct |
5 ms |
384 KB |
Output is correct |
50 |
Correct |
4 ms |
384 KB |
Output is correct |
51 |
Correct |
5 ms |
384 KB |
Output is correct |
52 |
Correct |
5 ms |
384 KB |
Output is correct |
53 |
Correct |
5 ms |
384 KB |
Output is correct |
54 |
Correct |
5 ms |
384 KB |
Output is correct |
55 |
Correct |
5 ms |
384 KB |
Output is correct |
56 |
Correct |
4 ms |
384 KB |
Output is correct |
57 |
Correct |
5 ms |
384 KB |
Output is correct |
58 |
Correct |
5 ms |
384 KB |
Output is correct |
59 |
Correct |
5 ms |
384 KB |
Output is correct |
60 |
Correct |
5 ms |
384 KB |
Output is correct |
61 |
Correct |
4 ms |
384 KB |
Output is correct |
62 |
Correct |
4 ms |
384 KB |
Output is correct |
63 |
Correct |
5 ms |
384 KB |
Output is correct |
64 |
Correct |
5 ms |
384 KB |
Output is correct |
65 |
Correct |
5 ms |
384 KB |
Output is correct |
66 |
Correct |
5 ms |
384 KB |
Output is correct |
67 |
Correct |
5 ms |
512 KB |
Output is correct |
68 |
Correct |
5 ms |
512 KB |
Output is correct |
69 |
Correct |
5 ms |
512 KB |
Output is correct |
70 |
Correct |
5 ms |
512 KB |
Output is correct |
71 |
Correct |
5 ms |
512 KB |
Output is correct |
72 |
Correct |
5 ms |
512 KB |
Output is correct |
73 |
Correct |
5 ms |
512 KB |
Output is correct |
74 |
Correct |
5 ms |
512 KB |
Output is correct |
75 |
Correct |
5 ms |
512 KB |
Output is correct |
76 |
Correct |
5 ms |
384 KB |
Output is correct |
77 |
Correct |
5 ms |
512 KB |
Output is correct |
78 |
Correct |
5 ms |
512 KB |
Output is correct |
79 |
Correct |
5 ms |
512 KB |
Output is correct |
80 |
Correct |
5 ms |
512 KB |
Output is correct |
81 |
Correct |
5 ms |
512 KB |
Output is correct |
82 |
Correct |
5 ms |
512 KB |
Output is correct |
83 |
Correct |
5 ms |
512 KB |
Output is correct |
84 |
Correct |
5 ms |
512 KB |
Output is correct |
85 |
Correct |
6 ms |
512 KB |
Output is correct |
86 |
Correct |
6 ms |
512 KB |
Output is correct |
87 |
Correct |
5 ms |
512 KB |
Output is correct |
88 |
Correct |
5 ms |
512 KB |
Output is correct |
89 |
Correct |
5 ms |
512 KB |
Output is correct |
90 |
Correct |
6 ms |
512 KB |
Output is correct |
91 |
Correct |
5 ms |
512 KB |
Output is correct |
92 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 ms |
384 KB |
Output is correct |
30 |
Correct |
4 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
4 ms |
384 KB |
Output is correct |
38 |
Correct |
5 ms |
384 KB |
Output is correct |
39 |
Correct |
5 ms |
384 KB |
Output is correct |
40 |
Correct |
4 ms |
384 KB |
Output is correct |
41 |
Correct |
5 ms |
384 KB |
Output is correct |
42 |
Correct |
4 ms |
384 KB |
Output is correct |
43 |
Correct |
4 ms |
384 KB |
Output is correct |
44 |
Correct |
5 ms |
384 KB |
Output is correct |
45 |
Correct |
5 ms |
384 KB |
Output is correct |
46 |
Correct |
4 ms |
384 KB |
Output is correct |
47 |
Correct |
5 ms |
384 KB |
Output is correct |
48 |
Correct |
5 ms |
384 KB |
Output is correct |
49 |
Correct |
5 ms |
384 KB |
Output is correct |
50 |
Correct |
4 ms |
384 KB |
Output is correct |
51 |
Correct |
5 ms |
384 KB |
Output is correct |
52 |
Correct |
5 ms |
384 KB |
Output is correct |
53 |
Correct |
5 ms |
384 KB |
Output is correct |
54 |
Correct |
5 ms |
384 KB |
Output is correct |
55 |
Correct |
5 ms |
384 KB |
Output is correct |
56 |
Correct |
4 ms |
384 KB |
Output is correct |
57 |
Correct |
5 ms |
384 KB |
Output is correct |
58 |
Correct |
5 ms |
384 KB |
Output is correct |
59 |
Correct |
5 ms |
384 KB |
Output is correct |
60 |
Correct |
5 ms |
384 KB |
Output is correct |
61 |
Correct |
4 ms |
384 KB |
Output is correct |
62 |
Correct |
4 ms |
384 KB |
Output is correct |
63 |
Correct |
5 ms |
384 KB |
Output is correct |
64 |
Correct |
5 ms |
384 KB |
Output is correct |
65 |
Correct |
5 ms |
384 KB |
Output is correct |
66 |
Correct |
97 ms |
19988 KB |
Output is correct |
67 |
Correct |
82 ms |
20012 KB |
Output is correct |
68 |
Correct |
179 ms |
20236 KB |
Output is correct |
69 |
Correct |
122 ms |
19248 KB |
Output is correct |
70 |
Correct |
138 ms |
15748 KB |
Output is correct |
71 |
Correct |
220 ms |
19560 KB |
Output is correct |
72 |
Correct |
189 ms |
17788 KB |
Output is correct |
73 |
Correct |
214 ms |
18328 KB |
Output is correct |
74 |
Correct |
185 ms |
16124 KB |
Output is correct |
75 |
Correct |
157 ms |
16176 KB |
Output is correct |
76 |
Correct |
95 ms |
11564 KB |
Output is correct |
77 |
Correct |
92 ms |
11564 KB |
Output is correct |
78 |
Correct |
76 ms |
11308 KB |
Output is correct |
79 |
Correct |
86 ms |
10924 KB |
Output is correct |
80 |
Correct |
60 ms |
10032 KB |
Output is correct |
81 |
Correct |
54 ms |
9900 KB |
Output is correct |
82 |
Correct |
8 ms |
4352 KB |
Output is correct |
83 |
Correct |
8 ms |
4352 KB |
Output is correct |
84 |
Correct |
8 ms |
4352 KB |
Output is correct |
85 |
Correct |
8 ms |
4352 KB |
Output is correct |
86 |
Correct |
8 ms |
4352 KB |
Output is correct |
87 |
Correct |
8 ms |
4224 KB |
Output is correct |
88 |
Correct |
6 ms |
512 KB |
Output is correct |
89 |
Correct |
6 ms |
640 KB |
Output is correct |
90 |
Correct |
6 ms |
512 KB |
Output is correct |
91 |
Correct |
6 ms |
640 KB |
Output is correct |
92 |
Correct |
6 ms |
640 KB |
Output is correct |
93 |
Correct |
6 ms |
640 KB |
Output is correct |
94 |
Correct |
6 ms |
640 KB |
Output is correct |
95 |
Correct |
6 ms |
640 KB |
Output is correct |
96 |
Correct |
6 ms |
640 KB |
Output is correct |
97 |
Correct |
6 ms |
512 KB |
Output is correct |
98 |
Correct |
6 ms |
512 KB |
Output is correct |
99 |
Correct |
6 ms |
640 KB |
Output is correct |
100 |
Correct |
6 ms |
512 KB |
Output is correct |
101 |
Correct |
6 ms |
512 KB |
Output is correct |
102 |
Correct |
5 ms |
512 KB |
Output is correct |
103 |
Correct |
5 ms |
512 KB |
Output is correct |
104 |
Correct |
5 ms |
512 KB |
Output is correct |
105 |
Correct |
5 ms |
512 KB |
Output is correct |
106 |
Correct |
5 ms |
512 KB |
Output is correct |
107 |
Correct |
5 ms |
512 KB |
Output is correct |
108 |
Correct |
196 ms |
18428 KB |
Output is correct |
109 |
Correct |
192 ms |
18428 KB |
Output is correct |
110 |
Correct |
218 ms |
18432 KB |
Output is correct |
111 |
Correct |
207 ms |
18428 KB |
Output is correct |
112 |
Correct |
188 ms |
18432 KB |
Output is correct |
113 |
Correct |
355 ms |
31612 KB |
Output is correct |
114 |
Correct |
308 ms |
26868 KB |
Output is correct |
115 |
Correct |
308 ms |
26232 KB |
Output is correct |
116 |
Correct |
299 ms |
23672 KB |
Output is correct |
117 |
Correct |
194 ms |
18424 KB |
Output is correct |
118 |
Correct |
198 ms |
18424 KB |
Output is correct |
119 |
Correct |
182 ms |
18552 KB |
Output is correct |
120 |
Correct |
199 ms |
18420 KB |
Output is correct |
121 |
Correct |
127 ms |
17148 KB |
Output is correct |
122 |
Correct |
112 ms |
15220 KB |
Output is correct |
123 |
Correct |
65 ms |
10668 KB |
Output is correct |
124 |
Correct |
77 ms |
15968 KB |
Output is correct |
125 |
Correct |
83 ms |
17048 KB |
Output is correct |
126 |
Correct |
85 ms |
17168 KB |
Output is correct |
127 |
Correct |
84 ms |
17048 KB |
Output is correct |
128 |
Correct |
6 ms |
512 KB |
Output is correct |
129 |
Correct |
6 ms |
640 KB |
Output is correct |
130 |
Correct |
6 ms |
512 KB |
Output is correct |
131 |
Correct |
6 ms |
512 KB |
Output is correct |
132 |
Correct |
5 ms |
512 KB |
Output is correct |
133 |
Correct |
5 ms |
512 KB |
Output is correct |
134 |
Correct |
5 ms |
512 KB |
Output is correct |
135 |
Correct |
5 ms |
512 KB |
Output is correct |
136 |
Correct |
5 ms |
512 KB |
Output is correct |
137 |
Correct |
5 ms |
512 KB |
Output is correct |
138 |
Correct |
5 ms |
512 KB |
Output is correct |
139 |
Correct |
6 ms |
640 KB |
Output is correct |
140 |
Correct |
7 ms |
640 KB |
Output is correct |
141 |
Correct |
6 ms |
640 KB |
Output is correct |
142 |
Correct |
6 ms |
636 KB |
Output is correct |
143 |
Correct |
6 ms |
512 KB |
Output is correct |
144 |
Correct |
6 ms |
512 KB |
Output is correct |
145 |
Correct |
6 ms |
512 KB |
Output is correct |
146 |
Correct |
5 ms |
512 KB |
Output is correct |
147 |
Correct |
5 ms |
512 KB |
Output is correct |
148 |
Correct |
5 ms |
512 KB |
Output is correct |
149 |
Correct |
5 ms |
512 KB |
Output is correct |
150 |
Correct |
5 ms |
512 KB |
Output is correct |
151 |
Correct |
5 ms |
512 KB |
Output is correct |
152 |
Correct |
5 ms |
384 KB |
Output is correct |
153 |
Correct |
5 ms |
384 KB |
Output is correct |
154 |
Correct |
5 ms |
384 KB |
Output is correct |
155 |
Correct |
211 ms |
18420 KB |
Output is correct |
156 |
Correct |
214 ms |
19136 KB |
Output is correct |
157 |
Correct |
207 ms |
17020 KB |
Output is correct |
158 |
Correct |
183 ms |
14768 KB |
Output is correct |
159 |
Correct |
136 ms |
11344 KB |
Output is correct |
160 |
Correct |
109 ms |
10416 KB |
Output is correct |
161 |
Correct |
107 ms |
10160 KB |
Output is correct |
162 |
Correct |
99 ms |
9780 KB |
Output is correct |
163 |
Correct |
86 ms |
9500 KB |
Output is correct |
164 |
Correct |
81 ms |
9464 KB |
Output is correct |
165 |
Correct |
73 ms |
9208 KB |
Output is correct |
166 |
Correct |
83 ms |
9208 KB |
Output is correct |
167 |
Correct |
73 ms |
9336 KB |
Output is correct |
168 |
Correct |
82 ms |
11896 KB |
Output is correct |
169 |
Correct |
269 ms |
25000 KB |
Output is correct |
170 |
Correct |
272 ms |
22264 KB |
Output is correct |
171 |
Correct |
266 ms |
23288 KB |
Output is correct |
172 |
Correct |
238 ms |
19328 KB |
Output is correct |
173 |
Correct |
194 ms |
14892 KB |
Output is correct |
174 |
Correct |
189 ms |
14700 KB |
Output is correct |
175 |
Correct |
164 ms |
14764 KB |
Output is correct |
176 |
Correct |
108 ms |
11948 KB |
Output is correct |
177 |
Correct |
96 ms |
11052 KB |
Output is correct |
178 |
Correct |
127 ms |
15976 KB |
Output is correct |
179 |
Correct |
120 ms |
15972 KB |
Output is correct |
180 |
Correct |
117 ms |
15500 KB |
Output is correct |
181 |
Correct |
118 ms |
13844 KB |
Output is correct |
182 |
Correct |
5 ms |
384 KB |
Output is correct |
183 |
Correct |
5 ms |
512 KB |
Output is correct |
184 |
Correct |
5 ms |
512 KB |
Output is correct |
185 |
Correct |
5 ms |
512 KB |
Output is correct |
186 |
Correct |
5 ms |
512 KB |
Output is correct |
187 |
Correct |
5 ms |
512 KB |
Output is correct |
188 |
Correct |
5 ms |
512 KB |
Output is correct |
189 |
Correct |
5 ms |
512 KB |
Output is correct |
190 |
Correct |
5 ms |
512 KB |
Output is correct |
191 |
Correct |
5 ms |
512 KB |
Output is correct |
192 |
Correct |
5 ms |
384 KB |
Output is correct |
193 |
Correct |
5 ms |
512 KB |
Output is correct |
194 |
Correct |
5 ms |
512 KB |
Output is correct |
195 |
Correct |
5 ms |
512 KB |
Output is correct |
196 |
Correct |
5 ms |
512 KB |
Output is correct |
197 |
Correct |
5 ms |
512 KB |
Output is correct |
198 |
Correct |
5 ms |
512 KB |
Output is correct |
199 |
Correct |
5 ms |
512 KB |
Output is correct |
200 |
Correct |
5 ms |
512 KB |
Output is correct |
201 |
Correct |
6 ms |
512 KB |
Output is correct |
202 |
Correct |
6 ms |
512 KB |
Output is correct |
203 |
Correct |
5 ms |
512 KB |
Output is correct |
204 |
Correct |
5 ms |
512 KB |
Output is correct |
205 |
Correct |
5 ms |
512 KB |
Output is correct |
206 |
Correct |
6 ms |
512 KB |
Output is correct |
207 |
Correct |
5 ms |
512 KB |
Output is correct |
208 |
Correct |
5 ms |
512 KB |
Output is correct |
209 |
Correct |
8 ms |
3968 KB |
Output is correct |
210 |
Correct |
78 ms |
10540 KB |
Output is correct |
211 |
Correct |
101 ms |
13844 KB |
Output is correct |
212 |
Correct |
129 ms |
16572 KB |
Output is correct |
213 |
Correct |
135 ms |
18208 KB |
Output is correct |
214 |
Correct |
77 ms |
11180 KB |
Output is correct |
215 |
Correct |
72 ms |
10804 KB |
Output is correct |
216 |
Correct |
165 ms |
13740 KB |
Output is correct |
217 |
Correct |
139 ms |
12076 KB |
Output is correct |
218 |
Correct |
100 ms |
9836 KB |
Output is correct |
219 |
Correct |
82 ms |
9336 KB |
Output is correct |
220 |
Correct |
87 ms |
9336 KB |
Output is correct |
221 |
Correct |
75 ms |
9208 KB |
Output is correct |
222 |
Correct |
72 ms |
10492 KB |
Output is correct |
223 |
Correct |
165 ms |
15636 KB |
Output is correct |
224 |
Correct |
194 ms |
14892 KB |
Output is correct |
225 |
Correct |
140 ms |
11308 KB |
Output is correct |
226 |
Correct |
127 ms |
11308 KB |
Output is correct |
227 |
Correct |
149 ms |
11372 KB |
Output is correct |
228 |
Correct |
106 ms |
10848 KB |
Output is correct |
229 |
Correct |
81 ms |
10288 KB |
Output is correct |
230 |
Correct |
105 ms |
11528 KB |
Output is correct |
231 |
Correct |
99 ms |
11692 KB |
Output is correct |