#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);
~~~~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
380 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
380 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
380 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
2 ms |
376 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
380 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
380 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
380 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
2 ms |
376 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
2 ms |
376 KB |
Output is correct |
37 |
Correct |
2 ms |
376 KB |
Output is correct |
38 |
Correct |
2 ms |
376 KB |
Output is correct |
39 |
Correct |
2 ms |
376 KB |
Output is correct |
40 |
Correct |
2 ms |
376 KB |
Output is correct |
41 |
Correct |
2 ms |
376 KB |
Output is correct |
42 |
Correct |
2 ms |
376 KB |
Output is correct |
43 |
Correct |
2 ms |
376 KB |
Output is correct |
44 |
Correct |
2 ms |
376 KB |
Output is correct |
45 |
Correct |
2 ms |
376 KB |
Output is correct |
46 |
Correct |
2 ms |
376 KB |
Output is correct |
47 |
Correct |
2 ms |
376 KB |
Output is correct |
48 |
Correct |
2 ms |
376 KB |
Output is correct |
49 |
Correct |
2 ms |
376 KB |
Output is correct |
50 |
Correct |
2 ms |
380 KB |
Output is correct |
51 |
Correct |
2 ms |
376 KB |
Output is correct |
52 |
Correct |
2 ms |
376 KB |
Output is correct |
53 |
Correct |
2 ms |
376 KB |
Output is correct |
54 |
Correct |
2 ms |
376 KB |
Output is correct |
55 |
Correct |
2 ms |
376 KB |
Output is correct |
56 |
Correct |
2 ms |
376 KB |
Output is correct |
57 |
Correct |
2 ms |
376 KB |
Output is correct |
58 |
Correct |
2 ms |
376 KB |
Output is correct |
59 |
Correct |
2 ms |
376 KB |
Output is correct |
60 |
Correct |
2 ms |
376 KB |
Output is correct |
61 |
Correct |
2 ms |
376 KB |
Output is correct |
62 |
Correct |
2 ms |
408 KB |
Output is correct |
63 |
Correct |
2 ms |
376 KB |
Output is correct |
64 |
Correct |
2 ms |
376 KB |
Output is correct |
65 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
102 ms |
20224 KB |
Output is correct |
2 |
Correct |
146 ms |
19984 KB |
Output is correct |
3 |
Correct |
248 ms |
20228 KB |
Output is correct |
4 |
Correct |
165 ms |
19248 KB |
Output is correct |
5 |
Correct |
198 ms |
15892 KB |
Output is correct |
6 |
Correct |
290 ms |
19660 KB |
Output is correct |
7 |
Correct |
269 ms |
17792 KB |
Output is correct |
8 |
Correct |
292 ms |
18300 KB |
Output is correct |
9 |
Correct |
255 ms |
16256 KB |
Output is correct |
10 |
Correct |
223 ms |
16172 KB |
Output is correct |
11 |
Correct |
112 ms |
11564 KB |
Output is correct |
12 |
Correct |
111 ms |
11428 KB |
Output is correct |
13 |
Correct |
93 ms |
11252 KB |
Output is correct |
14 |
Correct |
94 ms |
11052 KB |
Output is correct |
15 |
Correct |
78 ms |
10104 KB |
Output is correct |
16 |
Correct |
64 ms |
9948 KB |
Output is correct |
17 |
Correct |
7 ms |
4340 KB |
Output is correct |
18 |
Correct |
8 ms |
4344 KB |
Output is correct |
19 |
Correct |
8 ms |
4344 KB |
Output is correct |
20 |
Correct |
9 ms |
4292 KB |
Output is correct |
21 |
Correct |
7 ms |
4344 KB |
Output is correct |
22 |
Correct |
7 ms |
4216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
508 KB |
Output is correct |
2 |
Correct |
4 ms |
632 KB |
Output is correct |
3 |
Correct |
3 ms |
504 KB |
Output is correct |
4 |
Correct |
4 ms |
760 KB |
Output is correct |
5 |
Correct |
4 ms |
632 KB |
Output is correct |
6 |
Correct |
4 ms |
632 KB |
Output is correct |
7 |
Correct |
4 ms |
732 KB |
Output is correct |
8 |
Correct |
4 ms |
632 KB |
Output is correct |
9 |
Correct |
4 ms |
632 KB |
Output is correct |
10 |
Correct |
4 ms |
504 KB |
Output is correct |
11 |
Correct |
4 ms |
508 KB |
Output is correct |
12 |
Correct |
3 ms |
504 KB |
Output is correct |
13 |
Correct |
4 ms |
632 KB |
Output is correct |
14 |
Correct |
3 ms |
504 KB |
Output is correct |
15 |
Correct |
3 ms |
504 KB |
Output is correct |
16 |
Correct |
3 ms |
504 KB |
Output is correct |
17 |
Correct |
3 ms |
504 KB |
Output is correct |
18 |
Correct |
3 ms |
504 KB |
Output is correct |
19 |
Correct |
3 ms |
504 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
283 ms |
18424 KB |
Output is correct |
2 |
Correct |
276 ms |
18420 KB |
Output is correct |
3 |
Correct |
279 ms |
18420 KB |
Output is correct |
4 |
Correct |
286 ms |
18420 KB |
Output is correct |
5 |
Correct |
268 ms |
18424 KB |
Output is correct |
6 |
Correct |
526 ms |
31480 KB |
Output is correct |
7 |
Correct |
459 ms |
26872 KB |
Output is correct |
8 |
Correct |
440 ms |
25972 KB |
Output is correct |
9 |
Correct |
401 ms |
23732 KB |
Output is correct |
10 |
Correct |
257 ms |
18524 KB |
Output is correct |
11 |
Correct |
273 ms |
18500 KB |
Output is correct |
12 |
Correct |
239 ms |
18424 KB |
Output is correct |
13 |
Correct |
238 ms |
18472 KB |
Output is correct |
14 |
Correct |
168 ms |
17072 KB |
Output is correct |
15 |
Correct |
141 ms |
15228 KB |
Output is correct |
16 |
Correct |
79 ms |
10828 KB |
Output is correct |
17 |
Correct |
124 ms |
15932 KB |
Output is correct |
18 |
Correct |
109 ms |
17044 KB |
Output is correct |
19 |
Correct |
110 ms |
17164 KB |
Output is correct |
20 |
Correct |
115 ms |
17056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
508 KB |
Output is correct |
3 |
Correct |
4 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
3 ms |
504 KB |
Output is correct |
7 |
Correct |
3 ms |
504 KB |
Output is correct |
8 |
Correct |
3 ms |
504 KB |
Output is correct |
9 |
Correct |
3 ms |
504 KB |
Output is correct |
10 |
Correct |
3 ms |
504 KB |
Output is correct |
11 |
Correct |
3 ms |
504 KB |
Output is correct |
12 |
Correct |
4 ms |
632 KB |
Output is correct |
13 |
Correct |
4 ms |
632 KB |
Output is correct |
14 |
Correct |
4 ms |
632 KB |
Output is correct |
15 |
Correct |
4 ms |
632 KB |
Output is correct |
16 |
Correct |
3 ms |
504 KB |
Output is correct |
17 |
Correct |
3 ms |
504 KB |
Output is correct |
18 |
Correct |
4 ms |
504 KB |
Output is correct |
19 |
Correct |
3 ms |
504 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
3 ms |
504 KB |
Output is correct |
22 |
Correct |
4 ms |
504 KB |
Output is correct |
23 |
Correct |
3 ms |
504 KB |
Output is correct |
24 |
Correct |
3 ms |
476 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
277 ms |
18500 KB |
Output is correct |
2 |
Correct |
300 ms |
19300 KB |
Output is correct |
3 |
Correct |
293 ms |
17004 KB |
Output is correct |
4 |
Correct |
249 ms |
14764 KB |
Output is correct |
5 |
Correct |
197 ms |
11244 KB |
Output is correct |
6 |
Correct |
146 ms |
10636 KB |
Output is correct |
7 |
Correct |
124 ms |
10156 KB |
Output is correct |
8 |
Correct |
115 ms |
9840 KB |
Output is correct |
9 |
Correct |
110 ms |
9524 KB |
Output is correct |
10 |
Correct |
103 ms |
9464 KB |
Output is correct |
11 |
Correct |
95 ms |
9208 KB |
Output is correct |
12 |
Correct |
96 ms |
9292 KB |
Output is correct |
13 |
Correct |
88 ms |
9336 KB |
Output is correct |
14 |
Correct |
88 ms |
11896 KB |
Output is correct |
15 |
Correct |
398 ms |
24992 KB |
Output is correct |
16 |
Correct |
410 ms |
22244 KB |
Output is correct |
17 |
Correct |
348 ms |
23160 KB |
Output is correct |
18 |
Correct |
332 ms |
19452 KB |
Output is correct |
19 |
Correct |
224 ms |
14764 KB |
Output is correct |
20 |
Correct |
211 ms |
14764 KB |
Output is correct |
21 |
Correct |
211 ms |
14764 KB |
Output is correct |
22 |
Correct |
139 ms |
11968 KB |
Output is correct |
23 |
Correct |
113 ms |
11128 KB |
Output is correct |
24 |
Correct |
170 ms |
15916 KB |
Output is correct |
25 |
Correct |
161 ms |
15968 KB |
Output is correct |
26 |
Correct |
149 ms |
15464 KB |
Output is correct |
27 |
Correct |
146 ms |
13920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
380 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
380 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
380 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
2 ms |
376 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
2 ms |
376 KB |
Output is correct |
37 |
Correct |
2 ms |
376 KB |
Output is correct |
38 |
Correct |
2 ms |
376 KB |
Output is correct |
39 |
Correct |
2 ms |
376 KB |
Output is correct |
40 |
Correct |
2 ms |
376 KB |
Output is correct |
41 |
Correct |
2 ms |
376 KB |
Output is correct |
42 |
Correct |
2 ms |
376 KB |
Output is correct |
43 |
Correct |
2 ms |
376 KB |
Output is correct |
44 |
Correct |
2 ms |
376 KB |
Output is correct |
45 |
Correct |
2 ms |
376 KB |
Output is correct |
46 |
Correct |
2 ms |
376 KB |
Output is correct |
47 |
Correct |
2 ms |
376 KB |
Output is correct |
48 |
Correct |
2 ms |
376 KB |
Output is correct |
49 |
Correct |
2 ms |
376 KB |
Output is correct |
50 |
Correct |
2 ms |
380 KB |
Output is correct |
51 |
Correct |
2 ms |
376 KB |
Output is correct |
52 |
Correct |
2 ms |
376 KB |
Output is correct |
53 |
Correct |
2 ms |
376 KB |
Output is correct |
54 |
Correct |
2 ms |
376 KB |
Output is correct |
55 |
Correct |
2 ms |
376 KB |
Output is correct |
56 |
Correct |
2 ms |
376 KB |
Output is correct |
57 |
Correct |
2 ms |
376 KB |
Output is correct |
58 |
Correct |
2 ms |
376 KB |
Output is correct |
59 |
Correct |
2 ms |
376 KB |
Output is correct |
60 |
Correct |
2 ms |
376 KB |
Output is correct |
61 |
Correct |
2 ms |
376 KB |
Output is correct |
62 |
Correct |
2 ms |
408 KB |
Output is correct |
63 |
Correct |
2 ms |
376 KB |
Output is correct |
64 |
Correct |
2 ms |
376 KB |
Output is correct |
65 |
Correct |
2 ms |
376 KB |
Output is correct |
66 |
Correct |
2 ms |
376 KB |
Output is correct |
67 |
Correct |
2 ms |
504 KB |
Output is correct |
68 |
Correct |
3 ms |
504 KB |
Output is correct |
69 |
Correct |
3 ms |
504 KB |
Output is correct |
70 |
Correct |
3 ms |
504 KB |
Output is correct |
71 |
Correct |
2 ms |
508 KB |
Output is correct |
72 |
Correct |
3 ms |
504 KB |
Output is correct |
73 |
Correct |
3 ms |
504 KB |
Output is correct |
74 |
Correct |
3 ms |
504 KB |
Output is correct |
75 |
Correct |
3 ms |
504 KB |
Output is correct |
76 |
Correct |
2 ms |
376 KB |
Output is correct |
77 |
Correct |
3 ms |
504 KB |
Output is correct |
78 |
Correct |
3 ms |
504 KB |
Output is correct |
79 |
Correct |
3 ms |
508 KB |
Output is correct |
80 |
Correct |
3 ms |
504 KB |
Output is correct |
81 |
Correct |
3 ms |
504 KB |
Output is correct |
82 |
Correct |
3 ms |
504 KB |
Output is correct |
83 |
Correct |
2 ms |
504 KB |
Output is correct |
84 |
Correct |
3 ms |
504 KB |
Output is correct |
85 |
Correct |
3 ms |
508 KB |
Output is correct |
86 |
Correct |
3 ms |
508 KB |
Output is correct |
87 |
Correct |
3 ms |
504 KB |
Output is correct |
88 |
Correct |
3 ms |
504 KB |
Output is correct |
89 |
Correct |
3 ms |
504 KB |
Output is correct |
90 |
Correct |
3 ms |
504 KB |
Output is correct |
91 |
Correct |
3 ms |
504 KB |
Output is correct |
92 |
Correct |
3 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
380 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
380 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
380 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
2 ms |
376 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
2 ms |
376 KB |
Output is correct |
37 |
Correct |
2 ms |
376 KB |
Output is correct |
38 |
Correct |
2 ms |
376 KB |
Output is correct |
39 |
Correct |
2 ms |
376 KB |
Output is correct |
40 |
Correct |
2 ms |
376 KB |
Output is correct |
41 |
Correct |
2 ms |
376 KB |
Output is correct |
42 |
Correct |
2 ms |
376 KB |
Output is correct |
43 |
Correct |
2 ms |
376 KB |
Output is correct |
44 |
Correct |
2 ms |
376 KB |
Output is correct |
45 |
Correct |
2 ms |
376 KB |
Output is correct |
46 |
Correct |
2 ms |
376 KB |
Output is correct |
47 |
Correct |
2 ms |
376 KB |
Output is correct |
48 |
Correct |
2 ms |
376 KB |
Output is correct |
49 |
Correct |
2 ms |
376 KB |
Output is correct |
50 |
Correct |
2 ms |
380 KB |
Output is correct |
51 |
Correct |
2 ms |
376 KB |
Output is correct |
52 |
Correct |
2 ms |
376 KB |
Output is correct |
53 |
Correct |
2 ms |
376 KB |
Output is correct |
54 |
Correct |
2 ms |
376 KB |
Output is correct |
55 |
Correct |
2 ms |
376 KB |
Output is correct |
56 |
Correct |
2 ms |
376 KB |
Output is correct |
57 |
Correct |
2 ms |
376 KB |
Output is correct |
58 |
Correct |
2 ms |
376 KB |
Output is correct |
59 |
Correct |
2 ms |
376 KB |
Output is correct |
60 |
Correct |
2 ms |
376 KB |
Output is correct |
61 |
Correct |
2 ms |
376 KB |
Output is correct |
62 |
Correct |
2 ms |
408 KB |
Output is correct |
63 |
Correct |
2 ms |
376 KB |
Output is correct |
64 |
Correct |
2 ms |
376 KB |
Output is correct |
65 |
Correct |
2 ms |
376 KB |
Output is correct |
66 |
Correct |
102 ms |
20224 KB |
Output is correct |
67 |
Correct |
146 ms |
19984 KB |
Output is correct |
68 |
Correct |
248 ms |
20228 KB |
Output is correct |
69 |
Correct |
165 ms |
19248 KB |
Output is correct |
70 |
Correct |
198 ms |
15892 KB |
Output is correct |
71 |
Correct |
290 ms |
19660 KB |
Output is correct |
72 |
Correct |
269 ms |
17792 KB |
Output is correct |
73 |
Correct |
292 ms |
18300 KB |
Output is correct |
74 |
Correct |
255 ms |
16256 KB |
Output is correct |
75 |
Correct |
223 ms |
16172 KB |
Output is correct |
76 |
Correct |
112 ms |
11564 KB |
Output is correct |
77 |
Correct |
111 ms |
11428 KB |
Output is correct |
78 |
Correct |
93 ms |
11252 KB |
Output is correct |
79 |
Correct |
94 ms |
11052 KB |
Output is correct |
80 |
Correct |
78 ms |
10104 KB |
Output is correct |
81 |
Correct |
64 ms |
9948 KB |
Output is correct |
82 |
Correct |
7 ms |
4340 KB |
Output is correct |
83 |
Correct |
8 ms |
4344 KB |
Output is correct |
84 |
Correct |
8 ms |
4344 KB |
Output is correct |
85 |
Correct |
9 ms |
4292 KB |
Output is correct |
86 |
Correct |
7 ms |
4344 KB |
Output is correct |
87 |
Correct |
7 ms |
4216 KB |
Output is correct |
88 |
Correct |
3 ms |
508 KB |
Output is correct |
89 |
Correct |
4 ms |
632 KB |
Output is correct |
90 |
Correct |
3 ms |
504 KB |
Output is correct |
91 |
Correct |
4 ms |
760 KB |
Output is correct |
92 |
Correct |
4 ms |
632 KB |
Output is correct |
93 |
Correct |
4 ms |
632 KB |
Output is correct |
94 |
Correct |
4 ms |
732 KB |
Output is correct |
95 |
Correct |
4 ms |
632 KB |
Output is correct |
96 |
Correct |
4 ms |
632 KB |
Output is correct |
97 |
Correct |
4 ms |
504 KB |
Output is correct |
98 |
Correct |
4 ms |
508 KB |
Output is correct |
99 |
Correct |
3 ms |
504 KB |
Output is correct |
100 |
Correct |
4 ms |
632 KB |
Output is correct |
101 |
Correct |
3 ms |
504 KB |
Output is correct |
102 |
Correct |
3 ms |
504 KB |
Output is correct |
103 |
Correct |
3 ms |
504 KB |
Output is correct |
104 |
Correct |
3 ms |
504 KB |
Output is correct |
105 |
Correct |
3 ms |
504 KB |
Output is correct |
106 |
Correct |
3 ms |
504 KB |
Output is correct |
107 |
Correct |
3 ms |
504 KB |
Output is correct |
108 |
Correct |
283 ms |
18424 KB |
Output is correct |
109 |
Correct |
276 ms |
18420 KB |
Output is correct |
110 |
Correct |
279 ms |
18420 KB |
Output is correct |
111 |
Correct |
286 ms |
18420 KB |
Output is correct |
112 |
Correct |
268 ms |
18424 KB |
Output is correct |
113 |
Correct |
526 ms |
31480 KB |
Output is correct |
114 |
Correct |
459 ms |
26872 KB |
Output is correct |
115 |
Correct |
440 ms |
25972 KB |
Output is correct |
116 |
Correct |
401 ms |
23732 KB |
Output is correct |
117 |
Correct |
257 ms |
18524 KB |
Output is correct |
118 |
Correct |
273 ms |
18500 KB |
Output is correct |
119 |
Correct |
239 ms |
18424 KB |
Output is correct |
120 |
Correct |
238 ms |
18472 KB |
Output is correct |
121 |
Correct |
168 ms |
17072 KB |
Output is correct |
122 |
Correct |
141 ms |
15228 KB |
Output is correct |
123 |
Correct |
79 ms |
10828 KB |
Output is correct |
124 |
Correct |
124 ms |
15932 KB |
Output is correct |
125 |
Correct |
109 ms |
17044 KB |
Output is correct |
126 |
Correct |
110 ms |
17164 KB |
Output is correct |
127 |
Correct |
115 ms |
17056 KB |
Output is correct |
128 |
Correct |
3 ms |
504 KB |
Output is correct |
129 |
Correct |
3 ms |
508 KB |
Output is correct |
130 |
Correct |
4 ms |
504 KB |
Output is correct |
131 |
Correct |
3 ms |
504 KB |
Output is correct |
132 |
Correct |
3 ms |
504 KB |
Output is correct |
133 |
Correct |
3 ms |
504 KB |
Output is correct |
134 |
Correct |
3 ms |
504 KB |
Output is correct |
135 |
Correct |
3 ms |
504 KB |
Output is correct |
136 |
Correct |
3 ms |
504 KB |
Output is correct |
137 |
Correct |
3 ms |
504 KB |
Output is correct |
138 |
Correct |
3 ms |
504 KB |
Output is correct |
139 |
Correct |
4 ms |
632 KB |
Output is correct |
140 |
Correct |
4 ms |
632 KB |
Output is correct |
141 |
Correct |
4 ms |
632 KB |
Output is correct |
142 |
Correct |
4 ms |
632 KB |
Output is correct |
143 |
Correct |
3 ms |
504 KB |
Output is correct |
144 |
Correct |
3 ms |
504 KB |
Output is correct |
145 |
Correct |
4 ms |
504 KB |
Output is correct |
146 |
Correct |
3 ms |
504 KB |
Output is correct |
147 |
Correct |
3 ms |
504 KB |
Output is correct |
148 |
Correct |
3 ms |
504 KB |
Output is correct |
149 |
Correct |
4 ms |
504 KB |
Output is correct |
150 |
Correct |
3 ms |
504 KB |
Output is correct |
151 |
Correct |
3 ms |
476 KB |
Output is correct |
152 |
Correct |
2 ms |
376 KB |
Output is correct |
153 |
Correct |
2 ms |
376 KB |
Output is correct |
154 |
Correct |
3 ms |
376 KB |
Output is correct |
155 |
Correct |
277 ms |
18500 KB |
Output is correct |
156 |
Correct |
300 ms |
19300 KB |
Output is correct |
157 |
Correct |
293 ms |
17004 KB |
Output is correct |
158 |
Correct |
249 ms |
14764 KB |
Output is correct |
159 |
Correct |
197 ms |
11244 KB |
Output is correct |
160 |
Correct |
146 ms |
10636 KB |
Output is correct |
161 |
Correct |
124 ms |
10156 KB |
Output is correct |
162 |
Correct |
115 ms |
9840 KB |
Output is correct |
163 |
Correct |
110 ms |
9524 KB |
Output is correct |
164 |
Correct |
103 ms |
9464 KB |
Output is correct |
165 |
Correct |
95 ms |
9208 KB |
Output is correct |
166 |
Correct |
96 ms |
9292 KB |
Output is correct |
167 |
Correct |
88 ms |
9336 KB |
Output is correct |
168 |
Correct |
88 ms |
11896 KB |
Output is correct |
169 |
Correct |
398 ms |
24992 KB |
Output is correct |
170 |
Correct |
410 ms |
22244 KB |
Output is correct |
171 |
Correct |
348 ms |
23160 KB |
Output is correct |
172 |
Correct |
332 ms |
19452 KB |
Output is correct |
173 |
Correct |
224 ms |
14764 KB |
Output is correct |
174 |
Correct |
211 ms |
14764 KB |
Output is correct |
175 |
Correct |
211 ms |
14764 KB |
Output is correct |
176 |
Correct |
139 ms |
11968 KB |
Output is correct |
177 |
Correct |
113 ms |
11128 KB |
Output is correct |
178 |
Correct |
170 ms |
15916 KB |
Output is correct |
179 |
Correct |
161 ms |
15968 KB |
Output is correct |
180 |
Correct |
149 ms |
15464 KB |
Output is correct |
181 |
Correct |
146 ms |
13920 KB |
Output is correct |
182 |
Correct |
2 ms |
376 KB |
Output is correct |
183 |
Correct |
2 ms |
504 KB |
Output is correct |
184 |
Correct |
3 ms |
504 KB |
Output is correct |
185 |
Correct |
3 ms |
504 KB |
Output is correct |
186 |
Correct |
3 ms |
504 KB |
Output is correct |
187 |
Correct |
2 ms |
508 KB |
Output is correct |
188 |
Correct |
3 ms |
504 KB |
Output is correct |
189 |
Correct |
3 ms |
504 KB |
Output is correct |
190 |
Correct |
3 ms |
504 KB |
Output is correct |
191 |
Correct |
3 ms |
504 KB |
Output is correct |
192 |
Correct |
2 ms |
376 KB |
Output is correct |
193 |
Correct |
3 ms |
504 KB |
Output is correct |
194 |
Correct |
3 ms |
504 KB |
Output is correct |
195 |
Correct |
3 ms |
508 KB |
Output is correct |
196 |
Correct |
3 ms |
504 KB |
Output is correct |
197 |
Correct |
3 ms |
504 KB |
Output is correct |
198 |
Correct |
3 ms |
504 KB |
Output is correct |
199 |
Correct |
2 ms |
504 KB |
Output is correct |
200 |
Correct |
3 ms |
504 KB |
Output is correct |
201 |
Correct |
3 ms |
508 KB |
Output is correct |
202 |
Correct |
3 ms |
508 KB |
Output is correct |
203 |
Correct |
3 ms |
504 KB |
Output is correct |
204 |
Correct |
3 ms |
504 KB |
Output is correct |
205 |
Correct |
3 ms |
504 KB |
Output is correct |
206 |
Correct |
3 ms |
504 KB |
Output is correct |
207 |
Correct |
3 ms |
504 KB |
Output is correct |
208 |
Correct |
3 ms |
504 KB |
Output is correct |
209 |
Correct |
7 ms |
3960 KB |
Output is correct |
210 |
Correct |
91 ms |
10664 KB |
Output is correct |
211 |
Correct |
172 ms |
13876 KB |
Output is correct |
212 |
Correct |
136 ms |
16560 KB |
Output is correct |
213 |
Correct |
170 ms |
18308 KB |
Output is correct |
214 |
Correct |
73 ms |
11144 KB |
Output is correct |
215 |
Correct |
72 ms |
10700 KB |
Output is correct |
216 |
Correct |
181 ms |
13768 KB |
Output is correct |
217 |
Correct |
162 ms |
11908 KB |
Output is correct |
218 |
Correct |
138 ms |
9844 KB |
Output is correct |
219 |
Correct |
119 ms |
9404 KB |
Output is correct |
220 |
Correct |
108 ms |
9240 KB |
Output is correct |
221 |
Correct |
81 ms |
9080 KB |
Output is correct |
222 |
Correct |
88 ms |
10488 KB |
Output is correct |
223 |
Correct |
225 ms |
15700 KB |
Output is correct |
224 |
Correct |
212 ms |
14892 KB |
Output is correct |
225 |
Correct |
170 ms |
11376 KB |
Output is correct |
226 |
Correct |
151 ms |
11308 KB |
Output is correct |
227 |
Correct |
155 ms |
11440 KB |
Output is correct |
228 |
Correct |
122 ms |
11080 KB |
Output is correct |
229 |
Correct |
99 ms |
10288 KB |
Output is correct |
230 |
Correct |
120 ms |
11604 KB |
Output is correct |
231 |
Correct |
128 ms |
11692 KB |
Output is correct |