답안 #103249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103249 2019-03-29T10:26:13 Z E869120 철인 이종 경기 (APIO18_duathlon) C++14
47 / 100
682 ms 40704 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
#pragma warning (disable: 4996)

class UnionFind {
public:
	vector<int>par;

	void init(int sz) {
		par.resize(sz, -1);
	}
	
	int root(int pos) {
		if (par[pos] == -1) return pos;
		par[pos] = root(par[pos]);
		return par[pos];
	}

	void unite(int u, int v) {
		u = root(u); v = root(v);
		if (u != v) par[u] = v;
	}

	bool same(int u, int v) {
		if (root(u) == root(v)) return true;
		return false;
	}
};

long long N, M, A[200009], B[200009], col[100009], col2[100009], dp[100009], cnt1, cnt2, cnts, cntv;
vector<int>X[100009], Y[100009], Z[100009], V, V2;
vector<int>G[59][59];
bool used[100009], cycles[200009];

map<pair<int, int>, int>Map;

void dfs(int pos) {
	if (col[pos] >= 1) return;
	col[pos] = cnts; V.push_back(pos); cnt1 += 1; cnt2 += X[pos].size();
	for (int i = 0; i < X[pos].size(); i++) {
		dfs(X[pos][i]);
	}
}

void dfs2(int pos) {
	if (col2[pos] >= 1) return;
	col2[pos] = cntv;
	for (int i = 0; i < Y[pos].size(); i++) {
		dfs2(Y[pos][i]);
	}
}

void dfs3(int pos, int target) {
	if (pos == target) {
		for (int i = 0; i < V.size() - 1; i++) {
			cycles[Map[make_pair(V[i], V[i + 1])]] = true;
		}
		return;
	}
	used[pos] = true;
	for (int i = 0; i < Z[pos].size(); i++) {
		if (used[Z[pos][i]] == true) continue;
		V.push_back(Z[pos][i]);
		dfs3(Z[pos][i], target);
		V.pop_back();
	}
}

void dfs4(int pos) {
	dp[pos] = 1; V2.push_back(pos);
	for (int i = 0; i < Y[pos].size(); i++) {
		if (dp[Y[pos][i]] >= 1) continue;
		dfs4(Y[pos][i]);
		dp[pos] += dp[Y[pos][i]];
	}
}

long long solve_subtask7() {
	UnionFind UF; UF.init(N + 2);
	for (int i = 1; i <= M; i++) {
		if (UF.same(A[i], B[i]) == true) {
			// この辺がサイクルに含まれる場合
			V.push_back(A[i]);
			dfs3(A[i], B[i]);
			V.clear();
			cycles[i] = true;
		}
		else {
			// この辺がサイクルに含まれない場合
			Z[A[i]].push_back(B[i]);
			Z[B[i]].push_back(A[i]);
			UF.unite(A[i], B[i]);
		}
	}

	for (int i = 1; i <= M; i++) {
		if (cycles[i] == true) continue;
		Y[A[i]].push_back(B[i]);
		Y[B[i]].push_back(A[i]);
	}

	long long FinalAns = 0;

	for (int i = 1; i <= N; i++) {
		if (col[i] >= 1) continue;
		V.clear();
		cnts++; dfs(i);

		vector<long long> dp1, dp2, dp3, dp4;
		for (int j = 0; j < V.size(); j++) {
			if (dp[V[j]] >= 1) continue;
			V2.clear(); dfs4(V[j]);

			long long A1 = 0, A2 = 0, A3 = 0;

			// dp1 の値を求める
			A1 = V2.size() - 1;

			// dp2 の値を求める
			for (int pos : V2) {
				if (pos != V[j]) A2 += (dp[pos] - 1LL);
			}

			// dp3 の値を求める
			A3 += 1LL * (long long)(V2.size() - 1) * ((long long)V2.size() - 2) * ((long long)V2.size() - 3);
			for (int pos : V2) {
				if (pos == V[j]) continue;
				long long rem = V2.size() - 2;
				for (int k = 0; k < Y[pos].size(); k++) {
					if (dp[Y[pos][k]] > dp[pos]) continue;
					A3 -= dp[Y[pos][k]] * (dp[Y[pos][k]] - 1);
					rem -= dp[Y[pos][k]];
				}
				A3 -= rem * (rem - 1);
			}

			dp1.push_back(A1);
			dp2.push_back(A2);
			dp3.push_back(A3);

			for (int k = 0; k < Y[V[j]].size(); k++) {
				dp4.push_back(dp[Y[V[j]][k]]);
			}
		}

		// 総計算
		FinalAns += 1LL * (long long)dp1.size() * ((long long)dp1.size() - 1) * ((long long)dp1.size() - 2);
		for (int j = 0; j < dp3.size(); j++) FinalAns += dp3[j];
		for (int j = 0; j < dp1.size(); j++) FinalAns += 2LL * (long long)(dp1.size() - 1) * ((long long)dp1.size() - 1) * dp1[j];
		for (int j = 0; j < dp2.size(); j++) FinalAns += 2LL * (long long)(dp1.size()) * dp2[j];
		
		long long X = 0; for (int j = 0; j < dp4.size(); j++) X += dp4[j];
		X *= X;
		for (int j = 0; j < dp4.size(); j++) X -= dp4[j] * dp4[j];
		FinalAns += X * (long long)(dp1.size());
	}
	return FinalAns;
}

long long solve_subtask2() {
	for (int i = 1; i <= N; i++) {
		if (col[i] >= 1) continue;
		cnts++; dfs(i);
	}

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) Y[j].clear();
		for (int j = 1; j <= M; j++) {
			if (A[j] == i || B[j] == i) continue;
			Y[A[j]].push_back(B[j]);
			Y[B[j]].push_back(A[j]);
		}

		cntv = 0;
		for (int j = 1; j <= N; j++) col2[j] = 0;
		for (int j = 1; j <= N; j++) {
			if (col2[j] >= 1) continue;
			cntv++; dfs2(j);
		}

		for (int j = 1; j <= N; j++) {
			for (int k = 1; k <= N; k++) {
				if (col[j] != col[k]) continue;
				if (col2[j] != col2[k]) G[j][k].push_back(i);
			}
		}
	}

	int cnt = 0;

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			for (int k = 1; k <= N; k++) {
				if (i == j || i == k || j == k || col[i] != col[j] || col[j] != col[k]) continue;

				int d[55]; for (int l = 0; l < 55; l++) d[l] = 0;
				for (int l : G[i][j]) d[l]++;
				for (int l : G[j][k]) d[l]++;

				bool flag = false;
				for (int l = 0; l < 55; l++) {
					if (d[l] >= 2 && l != j) flag = true;
				}

				if (flag == false) {
					cnt++;
				}
			}
		}
	}
	return 1LL * cnt;
}

int main() {
	scanf("%lld%lld", &N, &M);
	for (int i = 1; i <= M; i++) {
		scanf("%lld%lld", &A[i], &B[i]);
		X[A[i]].push_back(B[i]); Map[make_pair(A[i], B[i])] = i;
		X[B[i]].push_back(A[i]); Map[make_pair(B[i], A[i])] = i;
	}

	if (N <= 50 && M <= 100) {
		cout << solve_subtask2() << endl;
	}
	else {
		cout << solve_subtask7() << endl;
	}
	return 0;
}

Compilation message

count_triplets.cpp:6:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
count_triplets.cpp: In function 'void dfs(int)':
count_triplets.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < X[pos].size(); i++) {
                  ~~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'void dfs2(int)':
count_triplets.cpp:51:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < Y[pos].size(); i++) {
                  ~~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'void dfs3(int, int)':
count_triplets.cpp:58:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < V.size() - 1; i++) {
                   ~~^~~~~~~~~~~~~~
count_triplets.cpp:64:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < Z[pos].size(); i++) {
                  ~~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'void dfs4(int)':
count_triplets.cpp:74:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < Y[pos].size(); i++) {
                  ~~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'long long int solve_subtask7()':
count_triplets.cpp:113:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < V.size(); j++) {
                   ~~^~~~~~~~~~
count_triplets.cpp:132:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int k = 0; k < Y[pos].size(); k++) {
                     ~~^~~~~~~~~~~~~~~
count_triplets.cpp:144:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int k = 0; k < Y[V[j]].size(); k++) {
                    ~~^~~~~~~~~~~~~~~~
count_triplets.cpp:151:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < dp3.size(); j++) FinalAns += dp3[j];
                   ~~^~~~~~~~~~~~
count_triplets.cpp:152:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < dp1.size(); j++) FinalAns += 2LL * (long long)(dp1.size() - 1) * ((long long)dp1.size() - 1) * dp1[j];
                   ~~^~~~~~~~~~~~
count_triplets.cpp:153:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < dp2.size(); j++) FinalAns += 2LL * (long long)(dp1.size()) * dp2[j];
                   ~~^~~~~~~~~~~~
count_triplets.cpp:155:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   long long X = 0; for (int j = 0; j < dp4.size(); j++) X += dp4[j];
                                    ~~^~~~~~~~~~~~
count_triplets.cpp:157:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < dp4.size(); j++) X -= dp4[j] * dp4[j];
                   ~~^~~~~~~~~~~~
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:218:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:220:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &A[i], &B[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 7424 KB Output is correct
2 Correct 7 ms 7424 KB Output is correct
3 Correct 8 ms 7424 KB Output is correct
4 Correct 10 ms 7424 KB Output is correct
5 Correct 9 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7552 KB Output is correct
8 Correct 9 ms 7552 KB Output is correct
9 Correct 8 ms 7552 KB Output is correct
10 Correct 11 ms 7552 KB Output is correct
11 Correct 8 ms 7552 KB Output is correct
12 Correct 9 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 10 ms 7552 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 5 ms 7424 KB Output is correct
17 Correct 11 ms 7424 KB Output is correct
18 Correct 10 ms 7424 KB Output is correct
19 Correct 8 ms 7424 KB Output is correct
20 Correct 9 ms 7424 KB Output is correct
21 Correct 9 ms 7448 KB Output is correct
22 Correct 11 ms 7424 KB Output is correct
23 Correct 9 ms 7524 KB Output is correct
24 Correct 9 ms 7552 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 11 ms 7424 KB Output is correct
27 Correct 9 ms 7552 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 9 ms 7424 KB Output is correct
30 Correct 9 ms 7424 KB Output is correct
31 Correct 9 ms 7524 KB Output is correct
32 Correct 9 ms 7424 KB Output is correct
33 Correct 9 ms 7552 KB Output is correct
34 Correct 9 ms 7424 KB Output is correct
35 Correct 8 ms 7424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 7424 KB Output is correct
2 Correct 7 ms 7424 KB Output is correct
3 Correct 8 ms 7424 KB Output is correct
4 Correct 10 ms 7424 KB Output is correct
5 Correct 9 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7552 KB Output is correct
8 Correct 9 ms 7552 KB Output is correct
9 Correct 8 ms 7552 KB Output is correct
10 Correct 11 ms 7552 KB Output is correct
11 Correct 8 ms 7552 KB Output is correct
12 Correct 9 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 10 ms 7552 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 5 ms 7424 KB Output is correct
17 Correct 11 ms 7424 KB Output is correct
18 Correct 10 ms 7424 KB Output is correct
19 Correct 8 ms 7424 KB Output is correct
20 Correct 9 ms 7424 KB Output is correct
21 Correct 9 ms 7448 KB Output is correct
22 Correct 11 ms 7424 KB Output is correct
23 Correct 9 ms 7524 KB Output is correct
24 Correct 9 ms 7552 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 11 ms 7424 KB Output is correct
27 Correct 9 ms 7552 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 9 ms 7424 KB Output is correct
30 Correct 9 ms 7424 KB Output is correct
31 Correct 9 ms 7524 KB Output is correct
32 Correct 9 ms 7424 KB Output is correct
33 Correct 9 ms 7552 KB Output is correct
34 Correct 9 ms 7424 KB Output is correct
35 Correct 8 ms 7424 KB Output is correct
36 Correct 10 ms 7552 KB Output is correct
37 Correct 7 ms 7500 KB Output is correct
38 Correct 17 ms 7552 KB Output is correct
39 Correct 24 ms 7552 KB Output is correct
40 Correct 22 ms 7624 KB Output is correct
41 Correct 9 ms 7552 KB Output is correct
42 Correct 10 ms 7424 KB Output is correct
43 Correct 10 ms 7552 KB Output is correct
44 Correct 8 ms 7424 KB Output is correct
45 Correct 9 ms 7424 KB Output is correct
46 Correct 10 ms 7424 KB Output is correct
47 Correct 9 ms 7424 KB Output is correct
48 Correct 9 ms 7552 KB Output is correct
49 Correct 9 ms 7524 KB Output is correct
50 Correct 9 ms 7424 KB Output is correct
51 Correct 24 ms 7672 KB Output is correct
52 Correct 24 ms 7552 KB Output is correct
53 Correct 21 ms 7552 KB Output is correct
54 Correct 23 ms 7644 KB Output is correct
55 Correct 26 ms 7552 KB Output is correct
56 Correct 23 ms 7552 KB Output is correct
57 Correct 21 ms 7680 KB Output is correct
58 Correct 27 ms 7680 KB Output is correct
59 Correct 18 ms 7552 KB Output is correct
60 Correct 16 ms 7552 KB Output is correct
61 Correct 11 ms 7552 KB Output is correct
62 Correct 10 ms 7472 KB Output is correct
63 Correct 28 ms 7552 KB Output is correct
64 Correct 24 ms 7552 KB Output is correct
65 Correct 21 ms 7552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 578 ms 40704 KB Output is correct
2 Correct 539 ms 40680 KB Output is correct
3 Correct 552 ms 37352 KB Output is correct
4 Correct 568 ms 39944 KB Output is correct
5 Correct 602 ms 35392 KB Output is correct
6 Correct 602 ms 35836 KB Output is correct
7 Correct 566 ms 34700 KB Output is correct
8 Correct 509 ms 35380 KB Output is correct
9 Correct 605 ms 33296 KB Output is correct
10 Correct 573 ms 34136 KB Output is correct
11 Correct 500 ms 29564 KB Output is correct
12 Correct 457 ms 29020 KB Output is correct
13 Correct 447 ms 28144 KB Output is correct
14 Correct 438 ms 27756 KB Output is correct
15 Correct 309 ms 24568 KB Output is correct
16 Correct 294 ms 24184 KB Output is correct
17 Correct 36 ms 9592 KB Output is correct
18 Correct 29 ms 9464 KB Output is correct
19 Correct 28 ms 9472 KB Output is correct
20 Correct 36 ms 9464 KB Output is correct
21 Correct 34 ms 9564 KB Output is correct
22 Correct 30 ms 9472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 7680 KB Output is correct
2 Correct 11 ms 7808 KB Output is correct
3 Correct 10 ms 7680 KB Output is correct
4 Correct 14 ms 7800 KB Output is correct
5 Correct 13 ms 7696 KB Output is correct
6 Correct 11 ms 7808 KB Output is correct
7 Correct 10 ms 7808 KB Output is correct
8 Correct 14 ms 7808 KB Output is correct
9 Correct 12 ms 7680 KB Output is correct
10 Correct 10 ms 7680 KB Output is correct
11 Correct 11 ms 7680 KB Output is correct
12 Correct 10 ms 7680 KB Output is correct
13 Correct 10 ms 7680 KB Output is correct
14 Correct 15 ms 7680 KB Output is correct
15 Correct 10 ms 7680 KB Output is correct
16 Correct 11 ms 7680 KB Output is correct
17 Correct 9 ms 7680 KB Output is correct
18 Correct 10 ms 7680 KB Output is correct
19 Correct 10 ms 7808 KB Output is correct
20 Correct 10 ms 7808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 466 ms 34392 KB Output is correct
2 Correct 447 ms 34556 KB Output is correct
3 Correct 492 ms 34544 KB Output is correct
4 Correct 449 ms 34416 KB Output is correct
5 Correct 475 ms 34452 KB Output is correct
6 Correct 584 ms 35700 KB Output is correct
7 Correct 535 ms 35312 KB Output is correct
8 Correct 446 ms 35080 KB Output is correct
9 Correct 491 ms 34672 KB Output is correct
10 Correct 498 ms 33912 KB Output is correct
11 Correct 508 ms 34416 KB Output is correct
12 Correct 468 ms 33656 KB Output is correct
13 Correct 480 ms 33608 KB Output is correct
14 Correct 416 ms 31608 KB Output is correct
15 Correct 411 ms 29944 KB Output is correct
16 Correct 230 ms 23672 KB Output is correct
17 Correct 358 ms 35308 KB Output is correct
18 Correct 478 ms 35352 KB Output is correct
19 Correct 414 ms 35532 KB Output is correct
20 Correct 481 ms 35444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 7808 KB Output is correct
2 Correct 10 ms 7936 KB Output is correct
3 Incorrect 14 ms 7808 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 482 ms 34396 KB Output is correct
2 Correct 493 ms 34288 KB Output is correct
3 Incorrect 682 ms 36700 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 7424 KB Output is correct
2 Correct 7 ms 7424 KB Output is correct
3 Correct 8 ms 7424 KB Output is correct
4 Correct 10 ms 7424 KB Output is correct
5 Correct 9 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7552 KB Output is correct
8 Correct 9 ms 7552 KB Output is correct
9 Correct 8 ms 7552 KB Output is correct
10 Correct 11 ms 7552 KB Output is correct
11 Correct 8 ms 7552 KB Output is correct
12 Correct 9 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 10 ms 7552 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 5 ms 7424 KB Output is correct
17 Correct 11 ms 7424 KB Output is correct
18 Correct 10 ms 7424 KB Output is correct
19 Correct 8 ms 7424 KB Output is correct
20 Correct 9 ms 7424 KB Output is correct
21 Correct 9 ms 7448 KB Output is correct
22 Correct 11 ms 7424 KB Output is correct
23 Correct 9 ms 7524 KB Output is correct
24 Correct 9 ms 7552 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 11 ms 7424 KB Output is correct
27 Correct 9 ms 7552 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 9 ms 7424 KB Output is correct
30 Correct 9 ms 7424 KB Output is correct
31 Correct 9 ms 7524 KB Output is correct
32 Correct 9 ms 7424 KB Output is correct
33 Correct 9 ms 7552 KB Output is correct
34 Correct 9 ms 7424 KB Output is correct
35 Correct 8 ms 7424 KB Output is correct
36 Correct 10 ms 7552 KB Output is correct
37 Correct 7 ms 7500 KB Output is correct
38 Correct 17 ms 7552 KB Output is correct
39 Correct 24 ms 7552 KB Output is correct
40 Correct 22 ms 7624 KB Output is correct
41 Correct 9 ms 7552 KB Output is correct
42 Correct 10 ms 7424 KB Output is correct
43 Correct 10 ms 7552 KB Output is correct
44 Correct 8 ms 7424 KB Output is correct
45 Correct 9 ms 7424 KB Output is correct
46 Correct 10 ms 7424 KB Output is correct
47 Correct 9 ms 7424 KB Output is correct
48 Correct 9 ms 7552 KB Output is correct
49 Correct 9 ms 7524 KB Output is correct
50 Correct 9 ms 7424 KB Output is correct
51 Correct 24 ms 7672 KB Output is correct
52 Correct 24 ms 7552 KB Output is correct
53 Correct 21 ms 7552 KB Output is correct
54 Correct 23 ms 7644 KB Output is correct
55 Correct 26 ms 7552 KB Output is correct
56 Correct 23 ms 7552 KB Output is correct
57 Correct 21 ms 7680 KB Output is correct
58 Correct 27 ms 7680 KB Output is correct
59 Correct 18 ms 7552 KB Output is correct
60 Correct 16 ms 7552 KB Output is correct
61 Correct 11 ms 7552 KB Output is correct
62 Correct 10 ms 7472 KB Output is correct
63 Correct 28 ms 7552 KB Output is correct
64 Correct 24 ms 7552 KB Output is correct
65 Correct 21 ms 7552 KB Output is correct
66 Correct 10 ms 7552 KB Output is correct
67 Correct 11 ms 7680 KB Output is correct
68 Incorrect 11 ms 7808 KB Output isn't correct
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 7424 KB Output is correct
2 Correct 7 ms 7424 KB Output is correct
3 Correct 8 ms 7424 KB Output is correct
4 Correct 10 ms 7424 KB Output is correct
5 Correct 9 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7552 KB Output is correct
8 Correct 9 ms 7552 KB Output is correct
9 Correct 8 ms 7552 KB Output is correct
10 Correct 11 ms 7552 KB Output is correct
11 Correct 8 ms 7552 KB Output is correct
12 Correct 9 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 10 ms 7552 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 5 ms 7424 KB Output is correct
17 Correct 11 ms 7424 KB Output is correct
18 Correct 10 ms 7424 KB Output is correct
19 Correct 8 ms 7424 KB Output is correct
20 Correct 9 ms 7424 KB Output is correct
21 Correct 9 ms 7448 KB Output is correct
22 Correct 11 ms 7424 KB Output is correct
23 Correct 9 ms 7524 KB Output is correct
24 Correct 9 ms 7552 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 11 ms 7424 KB Output is correct
27 Correct 9 ms 7552 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 9 ms 7424 KB Output is correct
30 Correct 9 ms 7424 KB Output is correct
31 Correct 9 ms 7524 KB Output is correct
32 Correct 9 ms 7424 KB Output is correct
33 Correct 9 ms 7552 KB Output is correct
34 Correct 9 ms 7424 KB Output is correct
35 Correct 8 ms 7424 KB Output is correct
36 Correct 10 ms 7552 KB Output is correct
37 Correct 7 ms 7500 KB Output is correct
38 Correct 17 ms 7552 KB Output is correct
39 Correct 24 ms 7552 KB Output is correct
40 Correct 22 ms 7624 KB Output is correct
41 Correct 9 ms 7552 KB Output is correct
42 Correct 10 ms 7424 KB Output is correct
43 Correct 10 ms 7552 KB Output is correct
44 Correct 8 ms 7424 KB Output is correct
45 Correct 9 ms 7424 KB Output is correct
46 Correct 10 ms 7424 KB Output is correct
47 Correct 9 ms 7424 KB Output is correct
48 Correct 9 ms 7552 KB Output is correct
49 Correct 9 ms 7524 KB Output is correct
50 Correct 9 ms 7424 KB Output is correct
51 Correct 24 ms 7672 KB Output is correct
52 Correct 24 ms 7552 KB Output is correct
53 Correct 21 ms 7552 KB Output is correct
54 Correct 23 ms 7644 KB Output is correct
55 Correct 26 ms 7552 KB Output is correct
56 Correct 23 ms 7552 KB Output is correct
57 Correct 21 ms 7680 KB Output is correct
58 Correct 27 ms 7680 KB Output is correct
59 Correct 18 ms 7552 KB Output is correct
60 Correct 16 ms 7552 KB Output is correct
61 Correct 11 ms 7552 KB Output is correct
62 Correct 10 ms 7472 KB Output is correct
63 Correct 28 ms 7552 KB Output is correct
64 Correct 24 ms 7552 KB Output is correct
65 Correct 21 ms 7552 KB Output is correct
66 Correct 578 ms 40704 KB Output is correct
67 Correct 539 ms 40680 KB Output is correct
68 Correct 552 ms 37352 KB Output is correct
69 Correct 568 ms 39944 KB Output is correct
70 Correct 602 ms 35392 KB Output is correct
71 Correct 602 ms 35836 KB Output is correct
72 Correct 566 ms 34700 KB Output is correct
73 Correct 509 ms 35380 KB Output is correct
74 Correct 605 ms 33296 KB Output is correct
75 Correct 573 ms 34136 KB Output is correct
76 Correct 500 ms 29564 KB Output is correct
77 Correct 457 ms 29020 KB Output is correct
78 Correct 447 ms 28144 KB Output is correct
79 Correct 438 ms 27756 KB Output is correct
80 Correct 309 ms 24568 KB Output is correct
81 Correct 294 ms 24184 KB Output is correct
82 Correct 36 ms 9592 KB Output is correct
83 Correct 29 ms 9464 KB Output is correct
84 Correct 28 ms 9472 KB Output is correct
85 Correct 36 ms 9464 KB Output is correct
86 Correct 34 ms 9564 KB Output is correct
87 Correct 30 ms 9472 KB Output is correct
88 Correct 10 ms 7680 KB Output is correct
89 Correct 11 ms 7808 KB Output is correct
90 Correct 10 ms 7680 KB Output is correct
91 Correct 14 ms 7800 KB Output is correct
92 Correct 13 ms 7696 KB Output is correct
93 Correct 11 ms 7808 KB Output is correct
94 Correct 10 ms 7808 KB Output is correct
95 Correct 14 ms 7808 KB Output is correct
96 Correct 12 ms 7680 KB Output is correct
97 Correct 10 ms 7680 KB Output is correct
98 Correct 11 ms 7680 KB Output is correct
99 Correct 10 ms 7680 KB Output is correct
100 Correct 10 ms 7680 KB Output is correct
101 Correct 15 ms 7680 KB Output is correct
102 Correct 10 ms 7680 KB Output is correct
103 Correct 11 ms 7680 KB Output is correct
104 Correct 9 ms 7680 KB Output is correct
105 Correct 10 ms 7680 KB Output is correct
106 Correct 10 ms 7808 KB Output is correct
107 Correct 10 ms 7808 KB Output is correct
108 Correct 466 ms 34392 KB Output is correct
109 Correct 447 ms 34556 KB Output is correct
110 Correct 492 ms 34544 KB Output is correct
111 Correct 449 ms 34416 KB Output is correct
112 Correct 475 ms 34452 KB Output is correct
113 Correct 584 ms 35700 KB Output is correct
114 Correct 535 ms 35312 KB Output is correct
115 Correct 446 ms 35080 KB Output is correct
116 Correct 491 ms 34672 KB Output is correct
117 Correct 498 ms 33912 KB Output is correct
118 Correct 508 ms 34416 KB Output is correct
119 Correct 468 ms 33656 KB Output is correct
120 Correct 480 ms 33608 KB Output is correct
121 Correct 416 ms 31608 KB Output is correct
122 Correct 411 ms 29944 KB Output is correct
123 Correct 230 ms 23672 KB Output is correct
124 Correct 358 ms 35308 KB Output is correct
125 Correct 478 ms 35352 KB Output is correct
126 Correct 414 ms 35532 KB Output is correct
127 Correct 481 ms 35444 KB Output is correct
128 Correct 14 ms 7808 KB Output is correct
129 Correct 10 ms 7936 KB Output is correct
130 Incorrect 14 ms 7808 KB Output isn't correct
131 Halted 0 ms 0 KB -