Submission #252450

# Submission time Handle Problem Language Result Execution time Memory
252450 2020-07-25T15:31:29 Z amoo_safar Duathlon (APIO18_duathlon) C++14
100 / 100
560 ms 174292 KB
#include<bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define debug(x) cerr << #x << " = " << x << '\n'
#define int ll
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 8e5 + 10;
const int N2 = N;

ll ans;
int n, m;

int la;
vector<int> H[N], G[N2], R[N2];

int mk[N2], st[N], T = 1, dep[N2], wh[N];

void AddEdge(int u, int v){
	G[u].pb(v);
	G[v].pb(u);
	//cerr << u << ' ' << v << '\n';
}

int dfs(int u, int p, int d){
	mk[u] = 1;
	dep[u] = d;
	st[u] = T ++;

	int hbk = d, res;
	int cnt = (p == -1 ? 0 : 1);
	
	vector<pii> V;

	for(auto adj : H[u]){
		if(adj == p) continue;
		if(mk[adj]){
			hbk = min(hbk, dep[adj]);
		} else {
			res = dfs(adj, u, d + 1);
			hbk = min(hbk, res);
			if(res >= d){
				cnt ++;
				V.pb({T, cnt});
			} else {
				V.pb({T, 1});
			}

		}
	}
	//cerr << "! " << u << ' ' << cnt << ' ' << la << '\n';
	if(cnt > 0){
		wh[u] = la + 1;
		for(int i = 1; i <= cnt; i++) AddEdge(u, la + i);
		int idx;
		for(auto adj : H[u]){
			if(dep[adj] < dep[u]) idx = 1;
			else idx = upper_bound(V.begin(), V.end(), pii(st[adj], cnt + 1)) -> S;
			if(dep[adj] >= dep[u]) AddEdge(wh[adj], la + idx);
		}
		la += cnt;
	}
	return hbk;
}

int par[N2], sz[N];
int Find(int u){
	if(par[u] == u) return u;
	return par[u] = Find(par[u]);
}
void Unite(int u, int v){
	u = Find(u); v = Find(v);
	if(u == v) return ;
	par[u] = v;
	sz[v] += sz[u];
}

vector<pii> cut;
int DFS(int u, int p, int d){
	mk[u] = 1;
	dep[u] = d;

	int hbk = d, res;
	for(auto adj : G[u]){
		if(adj == p) continue;
		if(mk[adj]){
			hbk = min(hbk, dep[adj]);
			Unite(u, adj);
		} else {
			res = DFS(adj, u, d + 1);
			hbk = min(res, hbk);
			if(res <= d) Unite(adj, u);
			else {
				cut.pb(pii(adj, u));
			}
		}
	}
	return hbk;
}
int sub[N2];
vector<int> vis;
vector<pii> oth;
void DFS2(int u, int p, int d){
	vis.pb(u);
	sub[u] = sz[u];
	dep[u] = d;
	mk[u] = 1;
	for(auto adj : R[u]){
		if(adj == p) continue;
		DFS2(adj, u, d + 1);
		sub[u] += sub[adj];
	}
}

vector<int> com[N2];
vector<int> fuck[N2];

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	int u, v;
	for(int i = 1; i <= m; i++){
		cin >> u >> v;
		H[u].pb(v);
		H[v].pb(u);
	}

	cerr << '\n';
	
	la = n;
	for(int i = 1; i <= n; i++){
		if(mk[i]) continue;
		dfs(i, -1, 0);
	}
	iota(par, par + N2, 0);
	fill(sz + 1, sz + n + 1, 1);

	memset(mk, 0, sizeof mk);
	for(int i = 1; i <= la; i++){
		if(mk[i]) continue;
		DFS(i, -1, 0);
	}
	for(int i = 1; i <= la; i++) com[Find(i)].pb(i);

	for(auto &x : cut){
		x.F = Find(x.F); x.S = Find(x.S);
		R[x.F].pb(x.S);
		R[x.S].pb(x.F);
	}

	memset(mk, 0, sizeof mk);
	
	for(int i = 1; i <= la; i++){
		if(mk[i]) continue;
		if(Find(i) != i) continue;
		vis.clear();
		DFS2(i, -1, 0);


		int sm = sub[i];
		for(auto nd : vis){
			oth.clear();
			vector<int> con;
			for(auto nd2 : com[nd]){
				int res = (nd2 <= n), res2 = 0, tmp;
				
				vector<pii> ed;
				for(auto adj : G[nd2]){
					if(Find(adj) == nd) continue;
					int tm;
					tmp = Find(adj);
					if(dep[tmp] > dep[nd]) tm = sub[tmp];
					else tm = sm - sub[nd];
					ed.pb({tm, adj});
					res += tm;
					res2 += tm;
				}
				ll S2 = 0;
				for(auto [tm, adj] : ed) S2 += 1ll * (tm) * (tm - 1); 
				bool fl = false;
				for(auto [tm, adj] : ed){
					if((adj <= n) && (wh[adj] != adj)){
						fuck[adj].pb(sm - tm);
						//if(nd2 <= n) tm --;
						ans += 1ll * (res2 - tm) * (res2 - tm - 1);
						ans -= S2 - (1ll * tm * (tm - 1));

						ans += 2ll * (sm - res) * (res2 - tm);
						fl = true;
					}
				}
				oth.pb({res, fl});
			}
			ll Sum = 0, S2 = 0;
			for(auto [res, fl] : oth){
				Sum += res;
				S2 += res * (res - 1);
			}
			for(auto [res, fl] : oth){
				if(fl){
					ans += 1ll * (Sum - res) * (Sum - res - 1);
					ans -= S2 - (1ll * (res) * (res - 1));
				}
			}
				
		}
	}
	for(int i = 1; i <= n; i++){
		if(wh[i] == i) continue;

		int sm = 0;
		for(auto x : fuck[i]){
			sm += x;
			ans -= 1ll * x * (x - 1);
		}
		ans += 1ll * sm * (sm - 1);
	}
	cout << ans << '\n';
	return 0;
}
/*
9 10
1 2
2 3
3 4
4 5
4 2
3 6
6 7
6 8
8 3
8 9


10 9
1 2
2 3
*/

Compilation message

count_triplets.cpp: In function 'int32_t main()':
count_triplets.cpp:184:14: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
     for(auto [tm, adj] : ed) S2 += 1ll * (tm) * (tm - 1); 
              ^
count_triplets.cpp:184:22: warning: unused variable 'adj' [-Wunused-variable]
     for(auto [tm, adj] : ed) S2 += 1ll * (tm) * (tm - 1); 
                      ^
count_triplets.cpp:186:14: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
     for(auto [tm, adj] : ed){
              ^
count_triplets.cpp:200:13: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
    for(auto [res, fl] : oth){
             ^
count_triplets.cpp:200:21: warning: unused variable 'fl' [-Wunused-variable]
    for(auto [res, fl] : oth){
                     ^
count_triplets.cpp:204:13: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
    for(auto [res, fl] : oth){
             ^
# Verdict Execution time Memory Grader output
1 Correct 55 ms 106844 KB Output is correct
2 Correct 59 ms 106872 KB Output is correct
3 Correct 57 ms 106780 KB Output is correct
4 Correct 78 ms 106872 KB Output is correct
5 Correct 85 ms 106872 KB Output is correct
6 Correct 70 ms 106872 KB Output is correct
7 Correct 71 ms 106872 KB Output is correct
8 Correct 71 ms 106872 KB Output is correct
9 Correct 61 ms 106872 KB Output is correct
10 Correct 59 ms 106872 KB Output is correct
11 Correct 60 ms 106872 KB Output is correct
12 Correct 60 ms 106872 KB Output is correct
13 Correct 62 ms 106872 KB Output is correct
14 Correct 60 ms 106872 KB Output is correct
15 Correct 70 ms 106872 KB Output is correct
16 Correct 61 ms 106872 KB Output is correct
17 Correct 66 ms 106864 KB Output is correct
18 Correct 64 ms 107128 KB Output is correct
19 Correct 61 ms 106872 KB Output is correct
20 Correct 62 ms 106872 KB Output is correct
21 Correct 60 ms 106872 KB Output is correct
22 Correct 62 ms 106872 KB Output is correct
23 Correct 63 ms 107000 KB Output is correct
24 Correct 62 ms 106872 KB Output is correct
25 Correct 60 ms 106872 KB Output is correct
26 Correct 60 ms 106876 KB Output is correct
27 Correct 60 ms 106860 KB Output is correct
28 Correct 60 ms 106872 KB Output is correct
29 Correct 62 ms 106872 KB Output is correct
30 Correct 60 ms 106872 KB Output is correct
31 Correct 62 ms 106872 KB Output is correct
32 Correct 60 ms 106876 KB Output is correct
33 Correct 69 ms 106876 KB Output is correct
34 Correct 62 ms 106876 KB Output is correct
35 Correct 60 ms 106872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 106844 KB Output is correct
2 Correct 59 ms 106872 KB Output is correct
3 Correct 57 ms 106780 KB Output is correct
4 Correct 78 ms 106872 KB Output is correct
5 Correct 85 ms 106872 KB Output is correct
6 Correct 70 ms 106872 KB Output is correct
7 Correct 71 ms 106872 KB Output is correct
8 Correct 71 ms 106872 KB Output is correct
9 Correct 61 ms 106872 KB Output is correct
10 Correct 59 ms 106872 KB Output is correct
11 Correct 60 ms 106872 KB Output is correct
12 Correct 60 ms 106872 KB Output is correct
13 Correct 62 ms 106872 KB Output is correct
14 Correct 60 ms 106872 KB Output is correct
15 Correct 70 ms 106872 KB Output is correct
16 Correct 61 ms 106872 KB Output is correct
17 Correct 66 ms 106864 KB Output is correct
18 Correct 64 ms 107128 KB Output is correct
19 Correct 61 ms 106872 KB Output is correct
20 Correct 62 ms 106872 KB Output is correct
21 Correct 60 ms 106872 KB Output is correct
22 Correct 62 ms 106872 KB Output is correct
23 Correct 63 ms 107000 KB Output is correct
24 Correct 62 ms 106872 KB Output is correct
25 Correct 60 ms 106872 KB Output is correct
26 Correct 60 ms 106876 KB Output is correct
27 Correct 60 ms 106860 KB Output is correct
28 Correct 60 ms 106872 KB Output is correct
29 Correct 62 ms 106872 KB Output is correct
30 Correct 60 ms 106872 KB Output is correct
31 Correct 62 ms 106872 KB Output is correct
32 Correct 60 ms 106876 KB Output is correct
33 Correct 69 ms 106876 KB Output is correct
34 Correct 62 ms 106876 KB Output is correct
35 Correct 60 ms 106872 KB Output is correct
36 Correct 60 ms 106848 KB Output is correct
37 Correct 59 ms 106872 KB Output is correct
38 Correct 62 ms 106872 KB Output is correct
39 Correct 62 ms 106872 KB Output is correct
40 Correct 61 ms 106872 KB Output is correct
41 Correct 61 ms 106872 KB Output is correct
42 Correct 59 ms 106872 KB Output is correct
43 Correct 60 ms 106872 KB Output is correct
44 Correct 60 ms 106872 KB Output is correct
45 Correct 64 ms 107000 KB Output is correct
46 Correct 76 ms 106872 KB Output is correct
47 Correct 66 ms 106872 KB Output is correct
48 Correct 60 ms 106872 KB Output is correct
49 Correct 61 ms 106872 KB Output is correct
50 Correct 71 ms 106872 KB Output is correct
51 Correct 60 ms 106872 KB Output is correct
52 Correct 61 ms 106872 KB Output is correct
53 Correct 61 ms 106872 KB Output is correct
54 Correct 62 ms 106872 KB Output is correct
55 Correct 68 ms 106872 KB Output is correct
56 Correct 61 ms 106872 KB Output is correct
57 Correct 61 ms 106872 KB Output is correct
58 Correct 60 ms 106872 KB Output is correct
59 Correct 61 ms 106872 KB Output is correct
60 Correct 61 ms 106872 KB Output is correct
61 Correct 62 ms 107004 KB Output is correct
62 Correct 60 ms 106872 KB Output is correct
63 Correct 61 ms 106872 KB Output is correct
64 Correct 61 ms 106872 KB Output is correct
65 Correct 61 ms 106876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 295 ms 155368 KB Output is correct
2 Correct 278 ms 155368 KB Output is correct
3 Correct 349 ms 159972 KB Output is correct
4 Correct 312 ms 155488 KB Output is correct
5 Correct 321 ms 151648 KB Output is correct
6 Correct 351 ms 158172 KB Output is correct
7 Correct 350 ms 153316 KB Output is correct
8 Correct 362 ms 154720 KB Output is correct
9 Correct 353 ms 149984 KB Output is correct
10 Correct 343 ms 149728 KB Output is correct
11 Correct 288 ms 142428 KB Output is correct
12 Correct 291 ms 141916 KB Output is correct
13 Correct 279 ms 140904 KB Output is correct
14 Correct 271 ms 140168 KB Output is correct
15 Correct 239 ms 136292 KB Output is correct
16 Correct 237 ms 135528 KB Output is correct
17 Correct 71 ms 113912 KB Output is correct
18 Correct 71 ms 113916 KB Output is correct
19 Correct 79 ms 113816 KB Output is correct
20 Correct 72 ms 113784 KB Output is correct
21 Correct 71 ms 113656 KB Output is correct
22 Correct 71 ms 113656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 107384 KB Output is correct
2 Correct 64 ms 107420 KB Output is correct
3 Correct 64 ms 107384 KB Output is correct
4 Correct 63 ms 107512 KB Output is correct
5 Correct 74 ms 107512 KB Output is correct
6 Correct 63 ms 107512 KB Output is correct
7 Correct 61 ms 107640 KB Output is correct
8 Correct 64 ms 107384 KB Output is correct
9 Correct 62 ms 107384 KB Output is correct
10 Correct 62 ms 107384 KB Output is correct
11 Correct 63 ms 107384 KB Output is correct
12 Correct 62 ms 107384 KB Output is correct
13 Correct 65 ms 107512 KB Output is correct
14 Correct 63 ms 107256 KB Output is correct
15 Correct 61 ms 107188 KB Output is correct
16 Correct 62 ms 107132 KB Output is correct
17 Correct 61 ms 107416 KB Output is correct
18 Correct 62 ms 107384 KB Output is correct
19 Correct 64 ms 107388 KB Output is correct
20 Correct 63 ms 107384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 409 ms 158160 KB Output is correct
2 Correct 417 ms 158448 KB Output is correct
3 Correct 411 ms 158164 KB Output is correct
4 Correct 522 ms 158368 KB Output is correct
5 Correct 432 ms 158164 KB Output is correct
6 Correct 426 ms 174292 KB Output is correct
7 Correct 458 ms 169524 KB Output is correct
8 Correct 464 ms 166484 KB Output is correct
9 Correct 528 ms 163668 KB Output is correct
10 Correct 404 ms 156756 KB Output is correct
11 Correct 451 ms 157908 KB Output is correct
12 Correct 519 ms 156244 KB Output is correct
13 Correct 560 ms 156116 KB Output is correct
14 Correct 374 ms 152020 KB Output is correct
15 Correct 324 ms 148316 KB Output is correct
16 Correct 226 ms 136800 KB Output is correct
17 Correct 356 ms 160440 KB Output is correct
18 Correct 367 ms 158756 KB Output is correct
19 Correct 363 ms 159832 KB Output is correct
20 Correct 355 ms 158984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 107384 KB Output is correct
2 Correct 64 ms 107384 KB Output is correct
3 Correct 62 ms 107256 KB Output is correct
4 Correct 62 ms 107256 KB Output is correct
5 Correct 63 ms 107180 KB Output is correct
6 Correct 63 ms 107256 KB Output is correct
7 Correct 63 ms 107228 KB Output is correct
8 Correct 63 ms 107256 KB Output is correct
9 Correct 68 ms 107128 KB Output is correct
10 Correct 63 ms 107128 KB Output is correct
11 Correct 64 ms 107256 KB Output is correct
12 Correct 66 ms 107512 KB Output is correct
13 Correct 64 ms 107384 KB Output is correct
14 Correct 64 ms 107384 KB Output is correct
15 Correct 64 ms 107384 KB Output is correct
16 Correct 67 ms 107256 KB Output is correct
17 Correct 64 ms 107256 KB Output is correct
18 Correct 63 ms 107260 KB Output is correct
19 Correct 64 ms 107256 KB Output is correct
20 Correct 62 ms 107240 KB Output is correct
21 Correct 64 ms 107256 KB Output is correct
22 Correct 62 ms 107384 KB Output is correct
23 Correct 65 ms 107256 KB Output is correct
24 Correct 62 ms 107256 KB Output is correct
25 Correct 61 ms 107000 KB Output is correct
26 Correct 60 ms 107000 KB Output is correct
27 Correct 63 ms 106872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 424 ms 158368 KB Output is correct
2 Correct 406 ms 157780 KB Output is correct
3 Correct 439 ms 154972 KB Output is correct
4 Correct 395 ms 149980 KB Output is correct
5 Correct 363 ms 144988 KB Output is correct
6 Correct 343 ms 142824 KB Output is correct
7 Correct 332 ms 141924 KB Output is correct
8 Correct 317 ms 140652 KB Output is correct
9 Correct 340 ms 140264 KB Output is correct
10 Correct 328 ms 139876 KB Output is correct
11 Correct 308 ms 139364 KB Output is correct
12 Correct 275 ms 138984 KB Output is correct
13 Correct 282 ms 138856 KB Output is correct
14 Correct 303 ms 142056 KB Output is correct
15 Correct 489 ms 167444 KB Output is correct
16 Correct 497 ms 163424 KB Output is correct
17 Correct 431 ms 162912 KB Output is correct
18 Correct 427 ms 159196 KB Output is correct
19 Correct 395 ms 150368 KB Output is correct
20 Correct 393 ms 149340 KB Output is correct
21 Correct 409 ms 149164 KB Output is correct
22 Correct 346 ms 144988 KB Output is correct
23 Correct 318 ms 141688 KB Output is correct
24 Correct 376 ms 154828 KB Output is correct
25 Correct 391 ms 155104 KB Output is correct
26 Correct 383 ms 151676 KB Output is correct
27 Correct 383 ms 151920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 106844 KB Output is correct
2 Correct 59 ms 106872 KB Output is correct
3 Correct 57 ms 106780 KB Output is correct
4 Correct 78 ms 106872 KB Output is correct
5 Correct 85 ms 106872 KB Output is correct
6 Correct 70 ms 106872 KB Output is correct
7 Correct 71 ms 106872 KB Output is correct
8 Correct 71 ms 106872 KB Output is correct
9 Correct 61 ms 106872 KB Output is correct
10 Correct 59 ms 106872 KB Output is correct
11 Correct 60 ms 106872 KB Output is correct
12 Correct 60 ms 106872 KB Output is correct
13 Correct 62 ms 106872 KB Output is correct
14 Correct 60 ms 106872 KB Output is correct
15 Correct 70 ms 106872 KB Output is correct
16 Correct 61 ms 106872 KB Output is correct
17 Correct 66 ms 106864 KB Output is correct
18 Correct 64 ms 107128 KB Output is correct
19 Correct 61 ms 106872 KB Output is correct
20 Correct 62 ms 106872 KB Output is correct
21 Correct 60 ms 106872 KB Output is correct
22 Correct 62 ms 106872 KB Output is correct
23 Correct 63 ms 107000 KB Output is correct
24 Correct 62 ms 106872 KB Output is correct
25 Correct 60 ms 106872 KB Output is correct
26 Correct 60 ms 106876 KB Output is correct
27 Correct 60 ms 106860 KB Output is correct
28 Correct 60 ms 106872 KB Output is correct
29 Correct 62 ms 106872 KB Output is correct
30 Correct 60 ms 106872 KB Output is correct
31 Correct 62 ms 106872 KB Output is correct
32 Correct 60 ms 106876 KB Output is correct
33 Correct 69 ms 106876 KB Output is correct
34 Correct 62 ms 106876 KB Output is correct
35 Correct 60 ms 106872 KB Output is correct
36 Correct 60 ms 106848 KB Output is correct
37 Correct 59 ms 106872 KB Output is correct
38 Correct 62 ms 106872 KB Output is correct
39 Correct 62 ms 106872 KB Output is correct
40 Correct 61 ms 106872 KB Output is correct
41 Correct 61 ms 106872 KB Output is correct
42 Correct 59 ms 106872 KB Output is correct
43 Correct 60 ms 106872 KB Output is correct
44 Correct 60 ms 106872 KB Output is correct
45 Correct 64 ms 107000 KB Output is correct
46 Correct 76 ms 106872 KB Output is correct
47 Correct 66 ms 106872 KB Output is correct
48 Correct 60 ms 106872 KB Output is correct
49 Correct 61 ms 106872 KB Output is correct
50 Correct 71 ms 106872 KB Output is correct
51 Correct 60 ms 106872 KB Output is correct
52 Correct 61 ms 106872 KB Output is correct
53 Correct 61 ms 106872 KB Output is correct
54 Correct 62 ms 106872 KB Output is correct
55 Correct 68 ms 106872 KB Output is correct
56 Correct 61 ms 106872 KB Output is correct
57 Correct 61 ms 106872 KB Output is correct
58 Correct 60 ms 106872 KB Output is correct
59 Correct 61 ms 106872 KB Output is correct
60 Correct 61 ms 106872 KB Output is correct
61 Correct 62 ms 107004 KB Output is correct
62 Correct 60 ms 106872 KB Output is correct
63 Correct 61 ms 106872 KB Output is correct
64 Correct 61 ms 106872 KB Output is correct
65 Correct 61 ms 106876 KB Output is correct
66 Correct 62 ms 106872 KB Output is correct
67 Correct 61 ms 107128 KB Output is correct
68 Correct 63 ms 107256 KB Output is correct
69 Correct 71 ms 107256 KB Output is correct
70 Correct 63 ms 107384 KB Output is correct
71 Correct 61 ms 107128 KB Output is correct
72 Correct 62 ms 107128 KB Output is correct
73 Correct 62 ms 107128 KB Output is correct
74 Correct 63 ms 107128 KB Output is correct
75 Correct 65 ms 107128 KB Output is correct
76 Correct 66 ms 106872 KB Output is correct
77 Correct 68 ms 107256 KB Output is correct
78 Correct 67 ms 107228 KB Output is correct
79 Correct 67 ms 107128 KB Output is correct
80 Correct 64 ms 107128 KB Output is correct
81 Correct 62 ms 107128 KB Output is correct
82 Correct 61 ms 107256 KB Output is correct
83 Correct 62 ms 107256 KB Output is correct
84 Correct 62 ms 107256 KB Output is correct
85 Correct 61 ms 107256 KB Output is correct
86 Correct 62 ms 107256 KB Output is correct
87 Correct 62 ms 107256 KB Output is correct
88 Correct 62 ms 107256 KB Output is correct
89 Correct 61 ms 107128 KB Output is correct
90 Correct 61 ms 107128 KB Output is correct
91 Correct 65 ms 107256 KB Output is correct
92 Correct 63 ms 107256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 106844 KB Output is correct
2 Correct 59 ms 106872 KB Output is correct
3 Correct 57 ms 106780 KB Output is correct
4 Correct 78 ms 106872 KB Output is correct
5 Correct 85 ms 106872 KB Output is correct
6 Correct 70 ms 106872 KB Output is correct
7 Correct 71 ms 106872 KB Output is correct
8 Correct 71 ms 106872 KB Output is correct
9 Correct 61 ms 106872 KB Output is correct
10 Correct 59 ms 106872 KB Output is correct
11 Correct 60 ms 106872 KB Output is correct
12 Correct 60 ms 106872 KB Output is correct
13 Correct 62 ms 106872 KB Output is correct
14 Correct 60 ms 106872 KB Output is correct
15 Correct 70 ms 106872 KB Output is correct
16 Correct 61 ms 106872 KB Output is correct
17 Correct 66 ms 106864 KB Output is correct
18 Correct 64 ms 107128 KB Output is correct
19 Correct 61 ms 106872 KB Output is correct
20 Correct 62 ms 106872 KB Output is correct
21 Correct 60 ms 106872 KB Output is correct
22 Correct 62 ms 106872 KB Output is correct
23 Correct 63 ms 107000 KB Output is correct
24 Correct 62 ms 106872 KB Output is correct
25 Correct 60 ms 106872 KB Output is correct
26 Correct 60 ms 106876 KB Output is correct
27 Correct 60 ms 106860 KB Output is correct
28 Correct 60 ms 106872 KB Output is correct
29 Correct 62 ms 106872 KB Output is correct
30 Correct 60 ms 106872 KB Output is correct
31 Correct 62 ms 106872 KB Output is correct
32 Correct 60 ms 106876 KB Output is correct
33 Correct 69 ms 106876 KB Output is correct
34 Correct 62 ms 106876 KB Output is correct
35 Correct 60 ms 106872 KB Output is correct
36 Correct 60 ms 106848 KB Output is correct
37 Correct 59 ms 106872 KB Output is correct
38 Correct 62 ms 106872 KB Output is correct
39 Correct 62 ms 106872 KB Output is correct
40 Correct 61 ms 106872 KB Output is correct
41 Correct 61 ms 106872 KB Output is correct
42 Correct 59 ms 106872 KB Output is correct
43 Correct 60 ms 106872 KB Output is correct
44 Correct 60 ms 106872 KB Output is correct
45 Correct 64 ms 107000 KB Output is correct
46 Correct 76 ms 106872 KB Output is correct
47 Correct 66 ms 106872 KB Output is correct
48 Correct 60 ms 106872 KB Output is correct
49 Correct 61 ms 106872 KB Output is correct
50 Correct 71 ms 106872 KB Output is correct
51 Correct 60 ms 106872 KB Output is correct
52 Correct 61 ms 106872 KB Output is correct
53 Correct 61 ms 106872 KB Output is correct
54 Correct 62 ms 106872 KB Output is correct
55 Correct 68 ms 106872 KB Output is correct
56 Correct 61 ms 106872 KB Output is correct
57 Correct 61 ms 106872 KB Output is correct
58 Correct 60 ms 106872 KB Output is correct
59 Correct 61 ms 106872 KB Output is correct
60 Correct 61 ms 106872 KB Output is correct
61 Correct 62 ms 107004 KB Output is correct
62 Correct 60 ms 106872 KB Output is correct
63 Correct 61 ms 106872 KB Output is correct
64 Correct 61 ms 106872 KB Output is correct
65 Correct 61 ms 106876 KB Output is correct
66 Correct 295 ms 155368 KB Output is correct
67 Correct 278 ms 155368 KB Output is correct
68 Correct 349 ms 159972 KB Output is correct
69 Correct 312 ms 155488 KB Output is correct
70 Correct 321 ms 151648 KB Output is correct
71 Correct 351 ms 158172 KB Output is correct
72 Correct 350 ms 153316 KB Output is correct
73 Correct 362 ms 154720 KB Output is correct
74 Correct 353 ms 149984 KB Output is correct
75 Correct 343 ms 149728 KB Output is correct
76 Correct 288 ms 142428 KB Output is correct
77 Correct 291 ms 141916 KB Output is correct
78 Correct 279 ms 140904 KB Output is correct
79 Correct 271 ms 140168 KB Output is correct
80 Correct 239 ms 136292 KB Output is correct
81 Correct 237 ms 135528 KB Output is correct
82 Correct 71 ms 113912 KB Output is correct
83 Correct 71 ms 113916 KB Output is correct
84 Correct 79 ms 113816 KB Output is correct
85 Correct 72 ms 113784 KB Output is correct
86 Correct 71 ms 113656 KB Output is correct
87 Correct 71 ms 113656 KB Output is correct
88 Correct 61 ms 107384 KB Output is correct
89 Correct 64 ms 107420 KB Output is correct
90 Correct 64 ms 107384 KB Output is correct
91 Correct 63 ms 107512 KB Output is correct
92 Correct 74 ms 107512 KB Output is correct
93 Correct 63 ms 107512 KB Output is correct
94 Correct 61 ms 107640 KB Output is correct
95 Correct 64 ms 107384 KB Output is correct
96 Correct 62 ms 107384 KB Output is correct
97 Correct 62 ms 107384 KB Output is correct
98 Correct 63 ms 107384 KB Output is correct
99 Correct 62 ms 107384 KB Output is correct
100 Correct 65 ms 107512 KB Output is correct
101 Correct 63 ms 107256 KB Output is correct
102 Correct 61 ms 107188 KB Output is correct
103 Correct 62 ms 107132 KB Output is correct
104 Correct 61 ms 107416 KB Output is correct
105 Correct 62 ms 107384 KB Output is correct
106 Correct 64 ms 107388 KB Output is correct
107 Correct 63 ms 107384 KB Output is correct
108 Correct 409 ms 158160 KB Output is correct
109 Correct 417 ms 158448 KB Output is correct
110 Correct 411 ms 158164 KB Output is correct
111 Correct 522 ms 158368 KB Output is correct
112 Correct 432 ms 158164 KB Output is correct
113 Correct 426 ms 174292 KB Output is correct
114 Correct 458 ms 169524 KB Output is correct
115 Correct 464 ms 166484 KB Output is correct
116 Correct 528 ms 163668 KB Output is correct
117 Correct 404 ms 156756 KB Output is correct
118 Correct 451 ms 157908 KB Output is correct
119 Correct 519 ms 156244 KB Output is correct
120 Correct 560 ms 156116 KB Output is correct
121 Correct 374 ms 152020 KB Output is correct
122 Correct 324 ms 148316 KB Output is correct
123 Correct 226 ms 136800 KB Output is correct
124 Correct 356 ms 160440 KB Output is correct
125 Correct 367 ms 158756 KB Output is correct
126 Correct 363 ms 159832 KB Output is correct
127 Correct 355 ms 158984 KB Output is correct
128 Correct 64 ms 107384 KB Output is correct
129 Correct 64 ms 107384 KB Output is correct
130 Correct 62 ms 107256 KB Output is correct
131 Correct 62 ms 107256 KB Output is correct
132 Correct 63 ms 107180 KB Output is correct
133 Correct 63 ms 107256 KB Output is correct
134 Correct 63 ms 107228 KB Output is correct
135 Correct 63 ms 107256 KB Output is correct
136 Correct 68 ms 107128 KB Output is correct
137 Correct 63 ms 107128 KB Output is correct
138 Correct 64 ms 107256 KB Output is correct
139 Correct 66 ms 107512 KB Output is correct
140 Correct 64 ms 107384 KB Output is correct
141 Correct 64 ms 107384 KB Output is correct
142 Correct 64 ms 107384 KB Output is correct
143 Correct 67 ms 107256 KB Output is correct
144 Correct 64 ms 107256 KB Output is correct
145 Correct 63 ms 107260 KB Output is correct
146 Correct 64 ms 107256 KB Output is correct
147 Correct 62 ms 107240 KB Output is correct
148 Correct 64 ms 107256 KB Output is correct
149 Correct 62 ms 107384 KB Output is correct
150 Correct 65 ms 107256 KB Output is correct
151 Correct 62 ms 107256 KB Output is correct
152 Correct 61 ms 107000 KB Output is correct
153 Correct 60 ms 107000 KB Output is correct
154 Correct 63 ms 106872 KB Output is correct
155 Correct 424 ms 158368 KB Output is correct
156 Correct 406 ms 157780 KB Output is correct
157 Correct 439 ms 154972 KB Output is correct
158 Correct 395 ms 149980 KB Output is correct
159 Correct 363 ms 144988 KB Output is correct
160 Correct 343 ms 142824 KB Output is correct
161 Correct 332 ms 141924 KB Output is correct
162 Correct 317 ms 140652 KB Output is correct
163 Correct 340 ms 140264 KB Output is correct
164 Correct 328 ms 139876 KB Output is correct
165 Correct 308 ms 139364 KB Output is correct
166 Correct 275 ms 138984 KB Output is correct
167 Correct 282 ms 138856 KB Output is correct
168 Correct 303 ms 142056 KB Output is correct
169 Correct 489 ms 167444 KB Output is correct
170 Correct 497 ms 163424 KB Output is correct
171 Correct 431 ms 162912 KB Output is correct
172 Correct 427 ms 159196 KB Output is correct
173 Correct 395 ms 150368 KB Output is correct
174 Correct 393 ms 149340 KB Output is correct
175 Correct 409 ms 149164 KB Output is correct
176 Correct 346 ms 144988 KB Output is correct
177 Correct 318 ms 141688 KB Output is correct
178 Correct 376 ms 154828 KB Output is correct
179 Correct 391 ms 155104 KB Output is correct
180 Correct 383 ms 151676 KB Output is correct
181 Correct 383 ms 151920 KB Output is correct
182 Correct 62 ms 106872 KB Output is correct
183 Correct 61 ms 107128 KB Output is correct
184 Correct 63 ms 107256 KB Output is correct
185 Correct 71 ms 107256 KB Output is correct
186 Correct 63 ms 107384 KB Output is correct
187 Correct 61 ms 107128 KB Output is correct
188 Correct 62 ms 107128 KB Output is correct
189 Correct 62 ms 107128 KB Output is correct
190 Correct 63 ms 107128 KB Output is correct
191 Correct 65 ms 107128 KB Output is correct
192 Correct 66 ms 106872 KB Output is correct
193 Correct 68 ms 107256 KB Output is correct
194 Correct 67 ms 107228 KB Output is correct
195 Correct 67 ms 107128 KB Output is correct
196 Correct 64 ms 107128 KB Output is correct
197 Correct 62 ms 107128 KB Output is correct
198 Correct 61 ms 107256 KB Output is correct
199 Correct 62 ms 107256 KB Output is correct
200 Correct 62 ms 107256 KB Output is correct
201 Correct 61 ms 107256 KB Output is correct
202 Correct 62 ms 107256 KB Output is correct
203 Correct 62 ms 107256 KB Output is correct
204 Correct 62 ms 107256 KB Output is correct
205 Correct 61 ms 107128 KB Output is correct
206 Correct 61 ms 107128 KB Output is correct
207 Correct 65 ms 107256 KB Output is correct
208 Correct 63 ms 107256 KB Output is correct
209 Correct 71 ms 113144 KB Output is correct
210 Correct 238 ms 136412 KB Output is correct
211 Correct 354 ms 147932 KB Output is correct
212 Correct 399 ms 152168 KB Output is correct
213 Correct 458 ms 155236 KB Output is correct
214 Correct 207 ms 142048 KB Output is correct
215 Correct 210 ms 140776 KB Output is correct
216 Correct 422 ms 152032 KB Output is correct
217 Correct 380 ms 146276 KB Output is correct
218 Correct 335 ms 140740 KB Output is correct
219 Correct 307 ms 139628 KB Output is correct
220 Correct 299 ms 139448 KB Output is correct
221 Correct 272 ms 138936 KB Output is correct
222 Correct 305 ms 140324 KB Output is correct
223 Correct 415 ms 151388 KB Output is correct
224 Correct 434 ms 149344 KB Output is correct
225 Correct 350 ms 144096 KB Output is correct
226 Correct 368 ms 144096 KB Output is correct
227 Correct 361 ms 143824 KB Output is correct
228 Correct 328 ms 141288 KB Output is correct
229 Correct 276 ms 139240 KB Output is correct
230 Correct 390 ms 145780 KB Output is correct
231 Correct 365 ms 145820 KB Output is correct