답안 #727601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
727601 2023-04-21T02:49:42 Z SanguineChameleon 철인 이종 경기 (APIO18_duathlon) C++17
16 / 100
43 ms 7108 KB
#include <bits/stdc++.h>
using namespace std;

void just_do_it();

int main() {
	#ifdef KAMIRULEZ
		freopen("kamirulez.inp", "r", stdin);
		freopen("kamirulez.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	just_do_it();
	return 0;
}

const int maxn = 1e5 + 20;
vector<int> adj[maxn];
bool can[55][55][55];
bool bad[maxn];
bool flag[maxn];
int n, m;

void dfs(int x, int a, int b) {
	can[x][a][b] = true;
	for (auto c: adj[b]) {
		if (c != x && !can[x][a][c]) {
			dfs(x, a, c);
		}
	}
}

void sub1() {
	for (int x = 1; x <= n; x++) {
		for (int a = 1; a <= n; a++) {
			if (a != x) {
				dfs(x, a, a);
			}
		}
		bad[x] = false;
	}
	int res = 0;
	for (int a = 1; a <= n; a++) {
		for (int b = 1; b <= n; b++) {
			if (b == a) {
				continue;
			}
			for (int c = 1; c <= n; c++) {
				if (c == a || c == b) {
					continue;
				}
				bool ok = true;
				for (int x = 1; x <= n; x++) {
					if (x == b) {
						continue;
					}
					if (!can[x][a][b] && !can[x][b][c]) {
						ok = false;
						break;
					}
				}
				if (ok) {
					res++;
				}
			}
		}
	}
	cout << res;
}

void just_do_it() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	if (n <= 50) {
		sub1();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2680 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2684 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2680 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2680 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 3 ms 2680 KB Output is correct
29 Correct 2 ms 2644 KB Output is correct
30 Correct 2 ms 2644 KB Output is correct
31 Correct 3 ms 2644 KB Output is correct
32 Correct 2 ms 2680 KB Output is correct
33 Correct 2 ms 2676 KB Output is correct
34 Correct 3 ms 2684 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2680 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2684 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2680 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2680 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 3 ms 2680 KB Output is correct
29 Correct 2 ms 2644 KB Output is correct
30 Correct 2 ms 2644 KB Output is correct
31 Correct 3 ms 2644 KB Output is correct
32 Correct 2 ms 2680 KB Output is correct
33 Correct 2 ms 2676 KB Output is correct
34 Correct 3 ms 2684 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 3 ms 2772 KB Output is correct
37 Correct 4 ms 2744 KB Output is correct
38 Correct 9 ms 2804 KB Output is correct
39 Correct 14 ms 2832 KB Output is correct
40 Correct 13 ms 2804 KB Output is correct
41 Correct 3 ms 2772 KB Output is correct
42 Correct 4 ms 2772 KB Output is correct
43 Correct 3 ms 2772 KB Output is correct
44 Correct 3 ms 2772 KB Output is correct
45 Correct 3 ms 2772 KB Output is correct
46 Correct 3 ms 2772 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 2 ms 2772 KB Output is correct
49 Correct 3 ms 2772 KB Output is correct
50 Correct 2 ms 2808 KB Output is correct
51 Correct 8 ms 2772 KB Output is correct
52 Correct 8 ms 2804 KB Output is correct
53 Correct 10 ms 2772 KB Output is correct
54 Correct 12 ms 2832 KB Output is correct
55 Correct 12 ms 2844 KB Output is correct
56 Correct 10 ms 2836 KB Output is correct
57 Correct 9 ms 2808 KB Output is correct
58 Correct 9 ms 2772 KB Output is correct
59 Correct 7 ms 2772 KB Output is correct
60 Correct 7 ms 2808 KB Output is correct
61 Correct 6 ms 2800 KB Output is correct
62 Correct 4 ms 2772 KB Output is correct
63 Correct 10 ms 2832 KB Output is correct
64 Correct 8 ms 2772 KB Output is correct
65 Correct 7 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 6988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 7060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 7108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2680 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2684 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2680 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2680 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 3 ms 2680 KB Output is correct
29 Correct 2 ms 2644 KB Output is correct
30 Correct 2 ms 2644 KB Output is correct
31 Correct 3 ms 2644 KB Output is correct
32 Correct 2 ms 2680 KB Output is correct
33 Correct 2 ms 2676 KB Output is correct
34 Correct 3 ms 2684 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 3 ms 2772 KB Output is correct
37 Correct 4 ms 2744 KB Output is correct
38 Correct 9 ms 2804 KB Output is correct
39 Correct 14 ms 2832 KB Output is correct
40 Correct 13 ms 2804 KB Output is correct
41 Correct 3 ms 2772 KB Output is correct
42 Correct 4 ms 2772 KB Output is correct
43 Correct 3 ms 2772 KB Output is correct
44 Correct 3 ms 2772 KB Output is correct
45 Correct 3 ms 2772 KB Output is correct
46 Correct 3 ms 2772 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 2 ms 2772 KB Output is correct
49 Correct 3 ms 2772 KB Output is correct
50 Correct 2 ms 2808 KB Output is correct
51 Correct 8 ms 2772 KB Output is correct
52 Correct 8 ms 2804 KB Output is correct
53 Correct 10 ms 2772 KB Output is correct
54 Correct 12 ms 2832 KB Output is correct
55 Correct 12 ms 2844 KB Output is correct
56 Correct 10 ms 2836 KB Output is correct
57 Correct 9 ms 2808 KB Output is correct
58 Correct 9 ms 2772 KB Output is correct
59 Correct 7 ms 2772 KB Output is correct
60 Correct 7 ms 2808 KB Output is correct
61 Correct 6 ms 2800 KB Output is correct
62 Correct 4 ms 2772 KB Output is correct
63 Correct 10 ms 2832 KB Output is correct
64 Correct 8 ms 2772 KB Output is correct
65 Correct 7 ms 2772 KB Output is correct
66 Incorrect 2 ms 2644 KB Output isn't correct
67 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2680 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2684 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2680 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2680 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 3 ms 2680 KB Output is correct
29 Correct 2 ms 2644 KB Output is correct
30 Correct 2 ms 2644 KB Output is correct
31 Correct 3 ms 2644 KB Output is correct
32 Correct 2 ms 2680 KB Output is correct
33 Correct 2 ms 2676 KB Output is correct
34 Correct 3 ms 2684 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 3 ms 2772 KB Output is correct
37 Correct 4 ms 2744 KB Output is correct
38 Correct 9 ms 2804 KB Output is correct
39 Correct 14 ms 2832 KB Output is correct
40 Correct 13 ms 2804 KB Output is correct
41 Correct 3 ms 2772 KB Output is correct
42 Correct 4 ms 2772 KB Output is correct
43 Correct 3 ms 2772 KB Output is correct
44 Correct 3 ms 2772 KB Output is correct
45 Correct 3 ms 2772 KB Output is correct
46 Correct 3 ms 2772 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 2 ms 2772 KB Output is correct
49 Correct 3 ms 2772 KB Output is correct
50 Correct 2 ms 2808 KB Output is correct
51 Correct 8 ms 2772 KB Output is correct
52 Correct 8 ms 2804 KB Output is correct
53 Correct 10 ms 2772 KB Output is correct
54 Correct 12 ms 2832 KB Output is correct
55 Correct 12 ms 2844 KB Output is correct
56 Correct 10 ms 2836 KB Output is correct
57 Correct 9 ms 2808 KB Output is correct
58 Correct 9 ms 2772 KB Output is correct
59 Correct 7 ms 2772 KB Output is correct
60 Correct 7 ms 2808 KB Output is correct
61 Correct 6 ms 2800 KB Output is correct
62 Correct 4 ms 2772 KB Output is correct
63 Correct 10 ms 2832 KB Output is correct
64 Correct 8 ms 2772 KB Output is correct
65 Correct 7 ms 2772 KB Output is correct
66 Incorrect 41 ms 6988 KB Output isn't correct
67 Halted 0 ms 0 KB -