답안 #387672

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
387672 2021-04-09T05:39:35 Z milleniumEeee 철인 이종 경기 (APIO18_duathlon) C++17
5 / 100
1000 ms 11764 KB
#include <bits/stdc++.h>
#define fastInp ios_base::sync_with_stdio(0); cin.tie(0);
#define pii pair<int, int>
#define fr first
#define sc second
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define mk make_pair
using namespace std;

const int MAXN = (int)1e5 + 5;
vector <int> g[MAXN];

int S, C, F;

bool used[MAXN];

bool dfs(int v) {
	used[v] = 1;
	if (v == F) {
		used[v] = 0;
		if (!used[C]) {
			return false;
		} else {
			return true;
		}
	}
	bool found = false;
	for (int to : g[v]) {
		if (!used[to]) {
			found |= dfs(to);
			if (found) {
				used[v] = 0;
				return true;
			}
		}
	}
	used[v] = 0;
	return false;
}

signed main() {
	fastInp;
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}
	int ans = 0;
	for (int s = 1; s <= n; s++) {
		for (int c = 1; c <= n; c++) {
			for (int f = 1; f <= n; f++) {
				if (s != c && s != f && c != f) {
					S = s;
					C = c;
					F = f;
					if (dfs(s)) {
						ans++;
					}
				}
			}
		}
	}
	cout << ans << endl;
}

/*
4 3 
1 2
2 3
3 4
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 3 ms 2676 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2672 KB Output is correct
6 Correct 3 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 3 ms 2676 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 3 ms 2636 KB Output is correct
11 Correct 3 ms 2576 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2672 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 2 ms 2640 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 2 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 3 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 2 ms 2676 KB Output is correct
32 Correct 2 ms 2636 KB Output is correct
33 Correct 2 ms 2636 KB Output is correct
34 Correct 2 ms 2684 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 3 ms 2676 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2672 KB Output is correct
6 Correct 3 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 3 ms 2676 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 3 ms 2636 KB Output is correct
11 Correct 3 ms 2576 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2672 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 2 ms 2640 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 2 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 3 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 2 ms 2676 KB Output is correct
32 Correct 2 ms 2636 KB Output is correct
33 Correct 2 ms 2636 KB Output is correct
34 Correct 2 ms 2684 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 3 ms 2676 KB Output is correct
37 Correct 5 ms 2636 KB Output is correct
38 Correct 890 ms 2636 KB Output is correct
39 Execution timed out 1082 ms 2636 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 11764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 2636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 7212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 2684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 7144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 3 ms 2676 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2672 KB Output is correct
6 Correct 3 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 3 ms 2676 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 3 ms 2636 KB Output is correct
11 Correct 3 ms 2576 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2672 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 2 ms 2640 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 2 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 3 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 2 ms 2676 KB Output is correct
32 Correct 2 ms 2636 KB Output is correct
33 Correct 2 ms 2636 KB Output is correct
34 Correct 2 ms 2684 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 3 ms 2676 KB Output is correct
37 Correct 5 ms 2636 KB Output is correct
38 Correct 890 ms 2636 KB Output is correct
39 Execution timed out 1082 ms 2636 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 3 ms 2676 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2672 KB Output is correct
6 Correct 3 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 3 ms 2676 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 3 ms 2636 KB Output is correct
11 Correct 3 ms 2576 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2672 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 2 ms 2640 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 2 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 3 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 2 ms 2676 KB Output is correct
32 Correct 2 ms 2636 KB Output is correct
33 Correct 2 ms 2636 KB Output is correct
34 Correct 2 ms 2684 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 3 ms 2676 KB Output is correct
37 Correct 5 ms 2636 KB Output is correct
38 Correct 890 ms 2636 KB Output is correct
39 Execution timed out 1082 ms 2636 KB Time limit exceeded
40 Halted 0 ms 0 KB -