#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 3e5 + 10;
//#define debug(...) fprintf(stderr, __VA_ARGS__)
#define debug(...)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))
void setmin (int &a, int b) {
if (a > b) {
a = b;
}
}
int N, M;
vector<int> adj[MAXN];
int par[MAXN], num[MAXN], low[MAXN];
vector<pii> stk;
vector<vector<pii>> vbcc;
void dfs (int x, bool isroot = false) {
static int cur = 0;
num[x] = low[x] = cur++;
int nchild = 0;
for (int y : adj[x]) {
if (y != par[x]) {
if (num[y] == -1) {
nchild++;
par[y] = x;
stk.push_back({x, y});
dfs(y);
setmin(low[x], low[y]);
if (isroot ? (nchild > 1) : (num[x] <= low[y])) {
//then it is bcc
debug("IS BCC:");
vector<pii> v;
pii bck;
do {
bck = stk.back();
stk.pop_back();
v.push_back(bck);
debug(" (%d, %d)", bck.fi, bck.se);
} while (bck != pii(x, y));
debug("\n");
vbcc.push_back(v);
}
} else if (num[x] > num[y]) {
//if you go to higher edge
setmin(low[x], num[y]);
stk.push_back({x, y});
}
}
}
}
int C; //B = # of BCCs
int szcmp[MAXN];
vector<int> cadj[MAXN];
void find_bcc() {
for (int i = 0; i < N; i++) {
num[i] = -1;
}
for (int i = 0; i < N; i++) {
if (num[i] == -1) {
dfs(i, true);
if (!stk.empty()) {
vbcc.push_back(stk);
stk.clear();
}
}
}
for (vector<pii> v : vbcc) {
set<int> verts;
debug("BCC:");
for (pii p : v) {
verts.insert(p.fi);
verts.insert(p.se);
debug(" (%d, %d)", p.fi, p.se);
}
debug("\n");
int y = N + C;
szcmp[y] = verts.size();
for (int x : verts) {
cadj[x].push_back(y);
cadj[y].push_back(x);
debug("cadj %d %d\n", x, y);
}
C++;
}
}
ll ans;
int croot, csize;
int sub[MAXN];
bool vis[MAXN];
void dfs1 (int x, int p) {
vis[x] = true;
sub[x] = (x < N);
for (int y : cadj[x]) {
if (y != p) {
dfs1(y, x);
sub[x] += sub[y];
}
}
}
void dfs2 (int x, int p) {
if (x < N) {
for (int y : cadj[x]) {
int s = (y == p ? sub[x] : csize - sub[y]);
ans -= ll(szcmp[y] - 1) * s * (s - 1);
debug("ans -= %d * %d * %d\n", szcmp[y] - 1, s, s - 1);
}
}
for (int y : cadj[x]) {
if (y != p) {
dfs2(y, x);
}
}
}
void compute() {
for (croot = 0; croot < N; croot++) {
if (vis[croot]) {
continue;
}
dfs1(croot, -1);
csize = sub[croot];
ans += csize * ll(csize - 1) * (csize - 2);
debug("ans += %d * %d * %d\n", csize, csize - 1, csize - 2);
dfs2(croot, -1);
}
}
int main() {
scanf("%d %d", &N, &M);
for (int i = 0; i < M; i++) {
int a, b;
scanf("%d %d", &a, &b);
a--;
b--;
adj[a].push_back(b);
adj[b].push_back(a);
}
find_bcc();
compute();
printf("%lld\n", ans);
}
Compilation message
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:151: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:154:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &a, &b);
~~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
14456 KB |
Output is correct |
2 |
Correct |
16 ms |
14568 KB |
Output is correct |
3 |
Correct |
16 ms |
14680 KB |
Output is correct |
4 |
Correct |
14 ms |
14680 KB |
Output is correct |
5 |
Correct |
18 ms |
14716 KB |
Output is correct |
6 |
Correct |
17 ms |
14780 KB |
Output is correct |
7 |
Correct |
17 ms |
14780 KB |
Output is correct |
8 |
Correct |
15 ms |
14788 KB |
Output is correct |
9 |
Correct |
15 ms |
14824 KB |
Output is correct |
10 |
Correct |
17 ms |
14832 KB |
Output is correct |
11 |
Correct |
16 ms |
14916 KB |
Output is correct |
12 |
Correct |
18 ms |
14916 KB |
Output is correct |
13 |
Correct |
15 ms |
14916 KB |
Output is correct |
14 |
Correct |
15 ms |
14972 KB |
Output is correct |
15 |
Correct |
14 ms |
14972 KB |
Output is correct |
16 |
Correct |
15 ms |
14972 KB |
Output is correct |
17 |
Correct |
16 ms |
14972 KB |
Output is correct |
18 |
Correct |
16 ms |
14972 KB |
Output is correct |
19 |
Correct |
17 ms |
14972 KB |
Output is correct |
20 |
Correct |
17 ms |
14972 KB |
Output is correct |
21 |
Correct |
15 ms |
14972 KB |
Output is correct |
22 |
Correct |
18 ms |
15004 KB |
Output is correct |
23 |
Correct |
16 ms |
15004 KB |
Output is correct |
24 |
Correct |
17 ms |
15004 KB |
Output is correct |
25 |
Correct |
14 ms |
15004 KB |
Output is correct |
26 |
Correct |
17 ms |
15004 KB |
Output is correct |
27 |
Correct |
15 ms |
15004 KB |
Output is correct |
28 |
Correct |
17 ms |
15004 KB |
Output is correct |
29 |
Correct |
14 ms |
15032 KB |
Output is correct |
30 |
Correct |
18 ms |
15032 KB |
Output is correct |
31 |
Correct |
16 ms |
15032 KB |
Output is correct |
32 |
Correct |
16 ms |
15032 KB |
Output is correct |
33 |
Correct |
15 ms |
15032 KB |
Output is correct |
34 |
Correct |
18 ms |
15032 KB |
Output is correct |
35 |
Correct |
18 ms |
15032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
14456 KB |
Output is correct |
2 |
Correct |
16 ms |
14568 KB |
Output is correct |
3 |
Correct |
16 ms |
14680 KB |
Output is correct |
4 |
Correct |
14 ms |
14680 KB |
Output is correct |
5 |
Correct |
18 ms |
14716 KB |
Output is correct |
6 |
Correct |
17 ms |
14780 KB |
Output is correct |
7 |
Correct |
17 ms |
14780 KB |
Output is correct |
8 |
Correct |
15 ms |
14788 KB |
Output is correct |
9 |
Correct |
15 ms |
14824 KB |
Output is correct |
10 |
Correct |
17 ms |
14832 KB |
Output is correct |
11 |
Correct |
16 ms |
14916 KB |
Output is correct |
12 |
Correct |
18 ms |
14916 KB |
Output is correct |
13 |
Correct |
15 ms |
14916 KB |
Output is correct |
14 |
Correct |
15 ms |
14972 KB |
Output is correct |
15 |
Correct |
14 ms |
14972 KB |
Output is correct |
16 |
Correct |
15 ms |
14972 KB |
Output is correct |
17 |
Correct |
16 ms |
14972 KB |
Output is correct |
18 |
Correct |
16 ms |
14972 KB |
Output is correct |
19 |
Correct |
17 ms |
14972 KB |
Output is correct |
20 |
Correct |
17 ms |
14972 KB |
Output is correct |
21 |
Correct |
15 ms |
14972 KB |
Output is correct |
22 |
Correct |
18 ms |
15004 KB |
Output is correct |
23 |
Correct |
16 ms |
15004 KB |
Output is correct |
24 |
Correct |
17 ms |
15004 KB |
Output is correct |
25 |
Correct |
14 ms |
15004 KB |
Output is correct |
26 |
Correct |
17 ms |
15004 KB |
Output is correct |
27 |
Correct |
15 ms |
15004 KB |
Output is correct |
28 |
Correct |
17 ms |
15004 KB |
Output is correct |
29 |
Correct |
14 ms |
15032 KB |
Output is correct |
30 |
Correct |
18 ms |
15032 KB |
Output is correct |
31 |
Correct |
16 ms |
15032 KB |
Output is correct |
32 |
Correct |
16 ms |
15032 KB |
Output is correct |
33 |
Correct |
15 ms |
15032 KB |
Output is correct |
34 |
Correct |
18 ms |
15032 KB |
Output is correct |
35 |
Correct |
18 ms |
15032 KB |
Output is correct |
36 |
Correct |
15 ms |
15032 KB |
Output is correct |
37 |
Correct |
17 ms |
15032 KB |
Output is correct |
38 |
Correct |
17 ms |
15032 KB |
Output is correct |
39 |
Correct |
14 ms |
15032 KB |
Output is correct |
40 |
Correct |
16 ms |
15076 KB |
Output is correct |
41 |
Correct |
16 ms |
15076 KB |
Output is correct |
42 |
Correct |
17 ms |
15076 KB |
Output is correct |
43 |
Correct |
17 ms |
15076 KB |
Output is correct |
44 |
Correct |
15 ms |
15076 KB |
Output is correct |
45 |
Correct |
15 ms |
15076 KB |
Output is correct |
46 |
Correct |
14 ms |
15076 KB |
Output is correct |
47 |
Correct |
18 ms |
15076 KB |
Output is correct |
48 |
Correct |
18 ms |
15076 KB |
Output is correct |
49 |
Correct |
15 ms |
15244 KB |
Output is correct |
50 |
Correct |
16 ms |
15244 KB |
Output is correct |
51 |
Correct |
18 ms |
15244 KB |
Output is correct |
52 |
Correct |
15 ms |
15244 KB |
Output is correct |
53 |
Correct |
17 ms |
15244 KB |
Output is correct |
54 |
Correct |
16 ms |
15244 KB |
Output is correct |
55 |
Correct |
20 ms |
15244 KB |
Output is correct |
56 |
Correct |
21 ms |
15244 KB |
Output is correct |
57 |
Correct |
17 ms |
15244 KB |
Output is correct |
58 |
Correct |
16 ms |
15244 KB |
Output is correct |
59 |
Correct |
19 ms |
15244 KB |
Output is correct |
60 |
Correct |
17 ms |
15244 KB |
Output is correct |
61 |
Correct |
18 ms |
15244 KB |
Output is correct |
62 |
Correct |
16 ms |
15244 KB |
Output is correct |
63 |
Correct |
19 ms |
15244 KB |
Output is correct |
64 |
Correct |
17 ms |
15244 KB |
Output is correct |
65 |
Correct |
19 ms |
15244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
316 ms |
43764 KB |
Output is correct |
2 |
Correct |
315 ms |
45160 KB |
Output is correct |
3 |
Correct |
258 ms |
45160 KB |
Output is correct |
4 |
Correct |
235 ms |
45160 KB |
Output is correct |
5 |
Correct |
271 ms |
45160 KB |
Output is correct |
6 |
Correct |
369 ms |
45160 KB |
Output is correct |
7 |
Correct |
271 ms |
45160 KB |
Output is correct |
8 |
Correct |
320 ms |
45160 KB |
Output is correct |
9 |
Correct |
325 ms |
45160 KB |
Output is correct |
10 |
Correct |
228 ms |
45160 KB |
Output is correct |
11 |
Correct |
184 ms |
45160 KB |
Output is correct |
12 |
Correct |
176 ms |
45160 KB |
Output is correct |
13 |
Correct |
196 ms |
45160 KB |
Output is correct |
14 |
Correct |
173 ms |
45160 KB |
Output is correct |
15 |
Correct |
122 ms |
45160 KB |
Output is correct |
16 |
Correct |
132 ms |
45160 KB |
Output is correct |
17 |
Correct |
25 ms |
45160 KB |
Output is correct |
18 |
Correct |
19 ms |
45160 KB |
Output is correct |
19 |
Correct |
19 ms |
45160 KB |
Output is correct |
20 |
Correct |
22 ms |
45160 KB |
Output is correct |
21 |
Correct |
23 ms |
45160 KB |
Output is correct |
22 |
Correct |
22 ms |
45160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
45160 KB |
Output is correct |
2 |
Correct |
19 ms |
45160 KB |
Output is correct |
3 |
Correct |
19 ms |
45160 KB |
Output is correct |
4 |
Correct |
18 ms |
45160 KB |
Output is correct |
5 |
Correct |
16 ms |
45160 KB |
Output is correct |
6 |
Correct |
21 ms |
45160 KB |
Output is correct |
7 |
Correct |
21 ms |
45160 KB |
Output is correct |
8 |
Correct |
18 ms |
45160 KB |
Output is correct |
9 |
Correct |
20 ms |
45160 KB |
Output is correct |
10 |
Correct |
17 ms |
45160 KB |
Output is correct |
11 |
Correct |
19 ms |
45160 KB |
Output is correct |
12 |
Correct |
19 ms |
45160 KB |
Output is correct |
13 |
Correct |
18 ms |
45160 KB |
Output is correct |
14 |
Correct |
18 ms |
45160 KB |
Output is correct |
15 |
Correct |
21 ms |
45160 KB |
Output is correct |
16 |
Correct |
19 ms |
45160 KB |
Output is correct |
17 |
Correct |
17 ms |
45160 KB |
Output is correct |
18 |
Correct |
16 ms |
45160 KB |
Output is correct |
19 |
Correct |
19 ms |
45160 KB |
Output is correct |
20 |
Correct |
18 ms |
45160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
52260 KB |
Output is correct |
2 |
Correct |
254 ms |
53508 KB |
Output is correct |
3 |
Correct |
285 ms |
54764 KB |
Output is correct |
4 |
Correct |
299 ms |
56004 KB |
Output is correct |
5 |
Correct |
293 ms |
57408 KB |
Output is correct |
6 |
Correct |
354 ms |
65704 KB |
Output is correct |
7 |
Correct |
279 ms |
65704 KB |
Output is correct |
8 |
Correct |
278 ms |
65704 KB |
Output is correct |
9 |
Correct |
357 ms |
65704 KB |
Output is correct |
10 |
Correct |
245 ms |
65704 KB |
Output is correct |
11 |
Correct |
271 ms |
65704 KB |
Output is correct |
12 |
Correct |
287 ms |
66172 KB |
Output is correct |
13 |
Correct |
276 ms |
67356 KB |
Output is correct |
14 |
Correct |
219 ms |
67428 KB |
Output is correct |
15 |
Correct |
282 ms |
67428 KB |
Output is correct |
16 |
Correct |
134 ms |
67428 KB |
Output is correct |
17 |
Correct |
193 ms |
71872 KB |
Output is correct |
18 |
Correct |
243 ms |
73144 KB |
Output is correct |
19 |
Correct |
259 ms |
74620 KB |
Output is correct |
20 |
Correct |
233 ms |
75740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
75740 KB |
Output is correct |
2 |
Correct |
20 ms |
75740 KB |
Output is correct |
3 |
Correct |
19 ms |
75740 KB |
Output is correct |
4 |
Correct |
19 ms |
75740 KB |
Output is correct |
5 |
Correct |
18 ms |
75740 KB |
Output is correct |
6 |
Correct |
16 ms |
75740 KB |
Output is correct |
7 |
Correct |
17 ms |
75740 KB |
Output is correct |
8 |
Correct |
19 ms |
75740 KB |
Output is correct |
9 |
Correct |
21 ms |
75740 KB |
Output is correct |
10 |
Correct |
18 ms |
75740 KB |
Output is correct |
11 |
Correct |
16 ms |
75740 KB |
Output is correct |
12 |
Correct |
19 ms |
75740 KB |
Output is correct |
13 |
Correct |
18 ms |
75740 KB |
Output is correct |
14 |
Correct |
20 ms |
75740 KB |
Output is correct |
15 |
Correct |
18 ms |
75740 KB |
Output is correct |
16 |
Correct |
23 ms |
75740 KB |
Output is correct |
17 |
Correct |
18 ms |
75740 KB |
Output is correct |
18 |
Correct |
17 ms |
75740 KB |
Output is correct |
19 |
Correct |
17 ms |
75740 KB |
Output is correct |
20 |
Correct |
17 ms |
75740 KB |
Output is correct |
21 |
Correct |
18 ms |
75740 KB |
Output is correct |
22 |
Correct |
19 ms |
75740 KB |
Output is correct |
23 |
Correct |
18 ms |
75740 KB |
Output is correct |
24 |
Correct |
18 ms |
75740 KB |
Output is correct |
25 |
Correct |
21 ms |
75740 KB |
Output is correct |
26 |
Correct |
18 ms |
75740 KB |
Output is correct |
27 |
Correct |
18 ms |
75740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
310 ms |
76744 KB |
Output is correct |
2 |
Correct |
258 ms |
77768 KB |
Output is correct |
3 |
Correct |
268 ms |
77832 KB |
Output is correct |
4 |
Correct |
299 ms |
77832 KB |
Output is correct |
5 |
Correct |
222 ms |
77832 KB |
Output is correct |
6 |
Correct |
228 ms |
77832 KB |
Output is correct |
7 |
Correct |
279 ms |
78332 KB |
Output is correct |
8 |
Correct |
250 ms |
79040 KB |
Output is correct |
9 |
Correct |
223 ms |
80236 KB |
Output is correct |
10 |
Correct |
207 ms |
81348 KB |
Output is correct |
11 |
Correct |
267 ms |
82396 KB |
Output is correct |
12 |
Correct |
208 ms |
83800 KB |
Output is correct |
13 |
Correct |
224 ms |
85072 KB |
Output is correct |
14 |
Correct |
239 ms |
89792 KB |
Output is correct |
15 |
Correct |
349 ms |
99280 KB |
Output is correct |
16 |
Correct |
286 ms |
99280 KB |
Output is correct |
17 |
Correct |
268 ms |
100856 KB |
Output is correct |
18 |
Correct |
324 ms |
100856 KB |
Output is correct |
19 |
Correct |
274 ms |
100856 KB |
Output is correct |
20 |
Correct |
347 ms |
100856 KB |
Output is correct |
21 |
Correct |
249 ms |
100916 KB |
Output is correct |
22 |
Correct |
254 ms |
101304 KB |
Output is correct |
23 |
Correct |
189 ms |
101396 KB |
Output is correct |
24 |
Correct |
289 ms |
107256 KB |
Output is correct |
25 |
Correct |
310 ms |
108776 KB |
Output is correct |
26 |
Correct |
378 ms |
109080 KB |
Output is correct |
27 |
Correct |
308 ms |
110540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
14456 KB |
Output is correct |
2 |
Correct |
16 ms |
14568 KB |
Output is correct |
3 |
Correct |
16 ms |
14680 KB |
Output is correct |
4 |
Correct |
14 ms |
14680 KB |
Output is correct |
5 |
Correct |
18 ms |
14716 KB |
Output is correct |
6 |
Correct |
17 ms |
14780 KB |
Output is correct |
7 |
Correct |
17 ms |
14780 KB |
Output is correct |
8 |
Correct |
15 ms |
14788 KB |
Output is correct |
9 |
Correct |
15 ms |
14824 KB |
Output is correct |
10 |
Correct |
17 ms |
14832 KB |
Output is correct |
11 |
Correct |
16 ms |
14916 KB |
Output is correct |
12 |
Correct |
18 ms |
14916 KB |
Output is correct |
13 |
Correct |
15 ms |
14916 KB |
Output is correct |
14 |
Correct |
15 ms |
14972 KB |
Output is correct |
15 |
Correct |
14 ms |
14972 KB |
Output is correct |
16 |
Correct |
15 ms |
14972 KB |
Output is correct |
17 |
Correct |
16 ms |
14972 KB |
Output is correct |
18 |
Correct |
16 ms |
14972 KB |
Output is correct |
19 |
Correct |
17 ms |
14972 KB |
Output is correct |
20 |
Correct |
17 ms |
14972 KB |
Output is correct |
21 |
Correct |
15 ms |
14972 KB |
Output is correct |
22 |
Correct |
18 ms |
15004 KB |
Output is correct |
23 |
Correct |
16 ms |
15004 KB |
Output is correct |
24 |
Correct |
17 ms |
15004 KB |
Output is correct |
25 |
Correct |
14 ms |
15004 KB |
Output is correct |
26 |
Correct |
17 ms |
15004 KB |
Output is correct |
27 |
Correct |
15 ms |
15004 KB |
Output is correct |
28 |
Correct |
17 ms |
15004 KB |
Output is correct |
29 |
Correct |
14 ms |
15032 KB |
Output is correct |
30 |
Correct |
18 ms |
15032 KB |
Output is correct |
31 |
Correct |
16 ms |
15032 KB |
Output is correct |
32 |
Correct |
16 ms |
15032 KB |
Output is correct |
33 |
Correct |
15 ms |
15032 KB |
Output is correct |
34 |
Correct |
18 ms |
15032 KB |
Output is correct |
35 |
Correct |
18 ms |
15032 KB |
Output is correct |
36 |
Correct |
15 ms |
15032 KB |
Output is correct |
37 |
Correct |
17 ms |
15032 KB |
Output is correct |
38 |
Correct |
17 ms |
15032 KB |
Output is correct |
39 |
Correct |
14 ms |
15032 KB |
Output is correct |
40 |
Correct |
16 ms |
15076 KB |
Output is correct |
41 |
Correct |
16 ms |
15076 KB |
Output is correct |
42 |
Correct |
17 ms |
15076 KB |
Output is correct |
43 |
Correct |
17 ms |
15076 KB |
Output is correct |
44 |
Correct |
15 ms |
15076 KB |
Output is correct |
45 |
Correct |
15 ms |
15076 KB |
Output is correct |
46 |
Correct |
14 ms |
15076 KB |
Output is correct |
47 |
Correct |
18 ms |
15076 KB |
Output is correct |
48 |
Correct |
18 ms |
15076 KB |
Output is correct |
49 |
Correct |
15 ms |
15244 KB |
Output is correct |
50 |
Correct |
16 ms |
15244 KB |
Output is correct |
51 |
Correct |
18 ms |
15244 KB |
Output is correct |
52 |
Correct |
15 ms |
15244 KB |
Output is correct |
53 |
Correct |
17 ms |
15244 KB |
Output is correct |
54 |
Correct |
16 ms |
15244 KB |
Output is correct |
55 |
Correct |
20 ms |
15244 KB |
Output is correct |
56 |
Correct |
21 ms |
15244 KB |
Output is correct |
57 |
Correct |
17 ms |
15244 KB |
Output is correct |
58 |
Correct |
16 ms |
15244 KB |
Output is correct |
59 |
Correct |
19 ms |
15244 KB |
Output is correct |
60 |
Correct |
17 ms |
15244 KB |
Output is correct |
61 |
Correct |
18 ms |
15244 KB |
Output is correct |
62 |
Correct |
16 ms |
15244 KB |
Output is correct |
63 |
Correct |
19 ms |
15244 KB |
Output is correct |
64 |
Correct |
17 ms |
15244 KB |
Output is correct |
65 |
Correct |
19 ms |
15244 KB |
Output is correct |
66 |
Correct |
18 ms |
110540 KB |
Output is correct |
67 |
Correct |
16 ms |
110540 KB |
Output is correct |
68 |
Correct |
17 ms |
110540 KB |
Output is correct |
69 |
Correct |
20 ms |
110540 KB |
Output is correct |
70 |
Correct |
17 ms |
110540 KB |
Output is correct |
71 |
Correct |
18 ms |
110540 KB |
Output is correct |
72 |
Correct |
20 ms |
110540 KB |
Output is correct |
73 |
Correct |
19 ms |
110540 KB |
Output is correct |
74 |
Correct |
19 ms |
110540 KB |
Output is correct |
75 |
Correct |
17 ms |
110540 KB |
Output is correct |
76 |
Correct |
16 ms |
110540 KB |
Output is correct |
77 |
Correct |
17 ms |
110540 KB |
Output is correct |
78 |
Correct |
21 ms |
110540 KB |
Output is correct |
79 |
Correct |
18 ms |
110540 KB |
Output is correct |
80 |
Correct |
17 ms |
110540 KB |
Output is correct |
81 |
Correct |
19 ms |
110540 KB |
Output is correct |
82 |
Correct |
19 ms |
110540 KB |
Output is correct |
83 |
Correct |
20 ms |
110540 KB |
Output is correct |
84 |
Correct |
19 ms |
110540 KB |
Output is correct |
85 |
Correct |
19 ms |
110540 KB |
Output is correct |
86 |
Correct |
18 ms |
110540 KB |
Output is correct |
87 |
Correct |
19 ms |
110540 KB |
Output is correct |
88 |
Correct |
18 ms |
110540 KB |
Output is correct |
89 |
Correct |
19 ms |
110540 KB |
Output is correct |
90 |
Correct |
19 ms |
110540 KB |
Output is correct |
91 |
Correct |
20 ms |
110540 KB |
Output is correct |
92 |
Correct |
18 ms |
110540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
14456 KB |
Output is correct |
2 |
Correct |
16 ms |
14568 KB |
Output is correct |
3 |
Correct |
16 ms |
14680 KB |
Output is correct |
4 |
Correct |
14 ms |
14680 KB |
Output is correct |
5 |
Correct |
18 ms |
14716 KB |
Output is correct |
6 |
Correct |
17 ms |
14780 KB |
Output is correct |
7 |
Correct |
17 ms |
14780 KB |
Output is correct |
8 |
Correct |
15 ms |
14788 KB |
Output is correct |
9 |
Correct |
15 ms |
14824 KB |
Output is correct |
10 |
Correct |
17 ms |
14832 KB |
Output is correct |
11 |
Correct |
16 ms |
14916 KB |
Output is correct |
12 |
Correct |
18 ms |
14916 KB |
Output is correct |
13 |
Correct |
15 ms |
14916 KB |
Output is correct |
14 |
Correct |
15 ms |
14972 KB |
Output is correct |
15 |
Correct |
14 ms |
14972 KB |
Output is correct |
16 |
Correct |
15 ms |
14972 KB |
Output is correct |
17 |
Correct |
16 ms |
14972 KB |
Output is correct |
18 |
Correct |
16 ms |
14972 KB |
Output is correct |
19 |
Correct |
17 ms |
14972 KB |
Output is correct |
20 |
Correct |
17 ms |
14972 KB |
Output is correct |
21 |
Correct |
15 ms |
14972 KB |
Output is correct |
22 |
Correct |
18 ms |
15004 KB |
Output is correct |
23 |
Correct |
16 ms |
15004 KB |
Output is correct |
24 |
Correct |
17 ms |
15004 KB |
Output is correct |
25 |
Correct |
14 ms |
15004 KB |
Output is correct |
26 |
Correct |
17 ms |
15004 KB |
Output is correct |
27 |
Correct |
15 ms |
15004 KB |
Output is correct |
28 |
Correct |
17 ms |
15004 KB |
Output is correct |
29 |
Correct |
14 ms |
15032 KB |
Output is correct |
30 |
Correct |
18 ms |
15032 KB |
Output is correct |
31 |
Correct |
16 ms |
15032 KB |
Output is correct |
32 |
Correct |
16 ms |
15032 KB |
Output is correct |
33 |
Correct |
15 ms |
15032 KB |
Output is correct |
34 |
Correct |
18 ms |
15032 KB |
Output is correct |
35 |
Correct |
18 ms |
15032 KB |
Output is correct |
36 |
Correct |
15 ms |
15032 KB |
Output is correct |
37 |
Correct |
17 ms |
15032 KB |
Output is correct |
38 |
Correct |
17 ms |
15032 KB |
Output is correct |
39 |
Correct |
14 ms |
15032 KB |
Output is correct |
40 |
Correct |
16 ms |
15076 KB |
Output is correct |
41 |
Correct |
16 ms |
15076 KB |
Output is correct |
42 |
Correct |
17 ms |
15076 KB |
Output is correct |
43 |
Correct |
17 ms |
15076 KB |
Output is correct |
44 |
Correct |
15 ms |
15076 KB |
Output is correct |
45 |
Correct |
15 ms |
15076 KB |
Output is correct |
46 |
Correct |
14 ms |
15076 KB |
Output is correct |
47 |
Correct |
18 ms |
15076 KB |
Output is correct |
48 |
Correct |
18 ms |
15076 KB |
Output is correct |
49 |
Correct |
15 ms |
15244 KB |
Output is correct |
50 |
Correct |
16 ms |
15244 KB |
Output is correct |
51 |
Correct |
18 ms |
15244 KB |
Output is correct |
52 |
Correct |
15 ms |
15244 KB |
Output is correct |
53 |
Correct |
17 ms |
15244 KB |
Output is correct |
54 |
Correct |
16 ms |
15244 KB |
Output is correct |
55 |
Correct |
20 ms |
15244 KB |
Output is correct |
56 |
Correct |
21 ms |
15244 KB |
Output is correct |
57 |
Correct |
17 ms |
15244 KB |
Output is correct |
58 |
Correct |
16 ms |
15244 KB |
Output is correct |
59 |
Correct |
19 ms |
15244 KB |
Output is correct |
60 |
Correct |
17 ms |
15244 KB |
Output is correct |
61 |
Correct |
18 ms |
15244 KB |
Output is correct |
62 |
Correct |
16 ms |
15244 KB |
Output is correct |
63 |
Correct |
19 ms |
15244 KB |
Output is correct |
64 |
Correct |
17 ms |
15244 KB |
Output is correct |
65 |
Correct |
19 ms |
15244 KB |
Output is correct |
66 |
Correct |
316 ms |
43764 KB |
Output is correct |
67 |
Correct |
315 ms |
45160 KB |
Output is correct |
68 |
Correct |
258 ms |
45160 KB |
Output is correct |
69 |
Correct |
235 ms |
45160 KB |
Output is correct |
70 |
Correct |
271 ms |
45160 KB |
Output is correct |
71 |
Correct |
369 ms |
45160 KB |
Output is correct |
72 |
Correct |
271 ms |
45160 KB |
Output is correct |
73 |
Correct |
320 ms |
45160 KB |
Output is correct |
74 |
Correct |
325 ms |
45160 KB |
Output is correct |
75 |
Correct |
228 ms |
45160 KB |
Output is correct |
76 |
Correct |
184 ms |
45160 KB |
Output is correct |
77 |
Correct |
176 ms |
45160 KB |
Output is correct |
78 |
Correct |
196 ms |
45160 KB |
Output is correct |
79 |
Correct |
173 ms |
45160 KB |
Output is correct |
80 |
Correct |
122 ms |
45160 KB |
Output is correct |
81 |
Correct |
132 ms |
45160 KB |
Output is correct |
82 |
Correct |
25 ms |
45160 KB |
Output is correct |
83 |
Correct |
19 ms |
45160 KB |
Output is correct |
84 |
Correct |
19 ms |
45160 KB |
Output is correct |
85 |
Correct |
22 ms |
45160 KB |
Output is correct |
86 |
Correct |
23 ms |
45160 KB |
Output is correct |
87 |
Correct |
22 ms |
45160 KB |
Output is correct |
88 |
Correct |
20 ms |
45160 KB |
Output is correct |
89 |
Correct |
19 ms |
45160 KB |
Output is correct |
90 |
Correct |
19 ms |
45160 KB |
Output is correct |
91 |
Correct |
18 ms |
45160 KB |
Output is correct |
92 |
Correct |
16 ms |
45160 KB |
Output is correct |
93 |
Correct |
21 ms |
45160 KB |
Output is correct |
94 |
Correct |
21 ms |
45160 KB |
Output is correct |
95 |
Correct |
18 ms |
45160 KB |
Output is correct |
96 |
Correct |
20 ms |
45160 KB |
Output is correct |
97 |
Correct |
17 ms |
45160 KB |
Output is correct |
98 |
Correct |
19 ms |
45160 KB |
Output is correct |
99 |
Correct |
19 ms |
45160 KB |
Output is correct |
100 |
Correct |
18 ms |
45160 KB |
Output is correct |
101 |
Correct |
18 ms |
45160 KB |
Output is correct |
102 |
Correct |
21 ms |
45160 KB |
Output is correct |
103 |
Correct |
19 ms |
45160 KB |
Output is correct |
104 |
Correct |
17 ms |
45160 KB |
Output is correct |
105 |
Correct |
16 ms |
45160 KB |
Output is correct |
106 |
Correct |
19 ms |
45160 KB |
Output is correct |
107 |
Correct |
18 ms |
45160 KB |
Output is correct |
108 |
Correct |
245 ms |
52260 KB |
Output is correct |
109 |
Correct |
254 ms |
53508 KB |
Output is correct |
110 |
Correct |
285 ms |
54764 KB |
Output is correct |
111 |
Correct |
299 ms |
56004 KB |
Output is correct |
112 |
Correct |
293 ms |
57408 KB |
Output is correct |
113 |
Correct |
354 ms |
65704 KB |
Output is correct |
114 |
Correct |
279 ms |
65704 KB |
Output is correct |
115 |
Correct |
278 ms |
65704 KB |
Output is correct |
116 |
Correct |
357 ms |
65704 KB |
Output is correct |
117 |
Correct |
245 ms |
65704 KB |
Output is correct |
118 |
Correct |
271 ms |
65704 KB |
Output is correct |
119 |
Correct |
287 ms |
66172 KB |
Output is correct |
120 |
Correct |
276 ms |
67356 KB |
Output is correct |
121 |
Correct |
219 ms |
67428 KB |
Output is correct |
122 |
Correct |
282 ms |
67428 KB |
Output is correct |
123 |
Correct |
134 ms |
67428 KB |
Output is correct |
124 |
Correct |
193 ms |
71872 KB |
Output is correct |
125 |
Correct |
243 ms |
73144 KB |
Output is correct |
126 |
Correct |
259 ms |
74620 KB |
Output is correct |
127 |
Correct |
233 ms |
75740 KB |
Output is correct |
128 |
Correct |
18 ms |
75740 KB |
Output is correct |
129 |
Correct |
20 ms |
75740 KB |
Output is correct |
130 |
Correct |
19 ms |
75740 KB |
Output is correct |
131 |
Correct |
19 ms |
75740 KB |
Output is correct |
132 |
Correct |
18 ms |
75740 KB |
Output is correct |
133 |
Correct |
16 ms |
75740 KB |
Output is correct |
134 |
Correct |
17 ms |
75740 KB |
Output is correct |
135 |
Correct |
19 ms |
75740 KB |
Output is correct |
136 |
Correct |
21 ms |
75740 KB |
Output is correct |
137 |
Correct |
18 ms |
75740 KB |
Output is correct |
138 |
Correct |
16 ms |
75740 KB |
Output is correct |
139 |
Correct |
19 ms |
75740 KB |
Output is correct |
140 |
Correct |
18 ms |
75740 KB |
Output is correct |
141 |
Correct |
20 ms |
75740 KB |
Output is correct |
142 |
Correct |
18 ms |
75740 KB |
Output is correct |
143 |
Correct |
23 ms |
75740 KB |
Output is correct |
144 |
Correct |
18 ms |
75740 KB |
Output is correct |
145 |
Correct |
17 ms |
75740 KB |
Output is correct |
146 |
Correct |
17 ms |
75740 KB |
Output is correct |
147 |
Correct |
17 ms |
75740 KB |
Output is correct |
148 |
Correct |
18 ms |
75740 KB |
Output is correct |
149 |
Correct |
19 ms |
75740 KB |
Output is correct |
150 |
Correct |
18 ms |
75740 KB |
Output is correct |
151 |
Correct |
18 ms |
75740 KB |
Output is correct |
152 |
Correct |
21 ms |
75740 KB |
Output is correct |
153 |
Correct |
18 ms |
75740 KB |
Output is correct |
154 |
Correct |
18 ms |
75740 KB |
Output is correct |
155 |
Correct |
310 ms |
76744 KB |
Output is correct |
156 |
Correct |
258 ms |
77768 KB |
Output is correct |
157 |
Correct |
268 ms |
77832 KB |
Output is correct |
158 |
Correct |
299 ms |
77832 KB |
Output is correct |
159 |
Correct |
222 ms |
77832 KB |
Output is correct |
160 |
Correct |
228 ms |
77832 KB |
Output is correct |
161 |
Correct |
279 ms |
78332 KB |
Output is correct |
162 |
Correct |
250 ms |
79040 KB |
Output is correct |
163 |
Correct |
223 ms |
80236 KB |
Output is correct |
164 |
Correct |
207 ms |
81348 KB |
Output is correct |
165 |
Correct |
267 ms |
82396 KB |
Output is correct |
166 |
Correct |
208 ms |
83800 KB |
Output is correct |
167 |
Correct |
224 ms |
85072 KB |
Output is correct |
168 |
Correct |
239 ms |
89792 KB |
Output is correct |
169 |
Correct |
349 ms |
99280 KB |
Output is correct |
170 |
Correct |
286 ms |
99280 KB |
Output is correct |
171 |
Correct |
268 ms |
100856 KB |
Output is correct |
172 |
Correct |
324 ms |
100856 KB |
Output is correct |
173 |
Correct |
274 ms |
100856 KB |
Output is correct |
174 |
Correct |
347 ms |
100856 KB |
Output is correct |
175 |
Correct |
249 ms |
100916 KB |
Output is correct |
176 |
Correct |
254 ms |
101304 KB |
Output is correct |
177 |
Correct |
189 ms |
101396 KB |
Output is correct |
178 |
Correct |
289 ms |
107256 KB |
Output is correct |
179 |
Correct |
310 ms |
108776 KB |
Output is correct |
180 |
Correct |
378 ms |
109080 KB |
Output is correct |
181 |
Correct |
308 ms |
110540 KB |
Output is correct |
182 |
Correct |
18 ms |
110540 KB |
Output is correct |
183 |
Correct |
16 ms |
110540 KB |
Output is correct |
184 |
Correct |
17 ms |
110540 KB |
Output is correct |
185 |
Correct |
20 ms |
110540 KB |
Output is correct |
186 |
Correct |
17 ms |
110540 KB |
Output is correct |
187 |
Correct |
18 ms |
110540 KB |
Output is correct |
188 |
Correct |
20 ms |
110540 KB |
Output is correct |
189 |
Correct |
19 ms |
110540 KB |
Output is correct |
190 |
Correct |
19 ms |
110540 KB |
Output is correct |
191 |
Correct |
17 ms |
110540 KB |
Output is correct |
192 |
Correct |
16 ms |
110540 KB |
Output is correct |
193 |
Correct |
17 ms |
110540 KB |
Output is correct |
194 |
Correct |
21 ms |
110540 KB |
Output is correct |
195 |
Correct |
18 ms |
110540 KB |
Output is correct |
196 |
Correct |
17 ms |
110540 KB |
Output is correct |
197 |
Correct |
19 ms |
110540 KB |
Output is correct |
198 |
Correct |
19 ms |
110540 KB |
Output is correct |
199 |
Correct |
20 ms |
110540 KB |
Output is correct |
200 |
Correct |
19 ms |
110540 KB |
Output is correct |
201 |
Correct |
19 ms |
110540 KB |
Output is correct |
202 |
Correct |
18 ms |
110540 KB |
Output is correct |
203 |
Correct |
19 ms |
110540 KB |
Output is correct |
204 |
Correct |
18 ms |
110540 KB |
Output is correct |
205 |
Correct |
19 ms |
110540 KB |
Output is correct |
206 |
Correct |
19 ms |
110540 KB |
Output is correct |
207 |
Correct |
20 ms |
110540 KB |
Output is correct |
208 |
Correct |
18 ms |
110540 KB |
Output is correct |
209 |
Correct |
22 ms |
110540 KB |
Output is correct |
210 |
Correct |
138 ms |
110540 KB |
Output is correct |
211 |
Correct |
295 ms |
115352 KB |
Output is correct |
212 |
Correct |
426 ms |
121460 KB |
Output is correct |
213 |
Correct |
463 ms |
127424 KB |
Output is correct |
214 |
Correct |
185 ms |
127424 KB |
Output is correct |
215 |
Correct |
120 ms |
127424 KB |
Output is correct |
216 |
Correct |
283 ms |
127424 KB |
Output is correct |
217 |
Correct |
299 ms |
127424 KB |
Output is correct |
218 |
Correct |
230 ms |
127424 KB |
Output is correct |
219 |
Correct |
188 ms |
127424 KB |
Output is correct |
220 |
Correct |
178 ms |
127424 KB |
Output is correct |
221 |
Correct |
235 ms |
127424 KB |
Output is correct |
222 |
Correct |
244 ms |
127424 KB |
Output is correct |
223 |
Correct |
260 ms |
132832 KB |
Output is correct |
224 |
Correct |
303 ms |
133324 KB |
Output is correct |
225 |
Correct |
281 ms |
133324 KB |
Output is correct |
226 |
Correct |
256 ms |
133708 KB |
Output is correct |
227 |
Correct |
305 ms |
135528 KB |
Output is correct |
228 |
Correct |
248 ms |
136320 KB |
Output is correct |
229 |
Correct |
193 ms |
137268 KB |
Output is correct |
230 |
Correct |
268 ms |
140708 KB |
Output is correct |
231 |
Correct |
313 ms |
142548 KB |
Output is correct |