Submission #59319

# Submission time Handle Problem Language Result Execution time Memory
59319 2018-07-21T13:58:48 Z thiago4532 Duathlon (APIO18_duathlon) C++17
0 / 100
4 ms 928 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;
const int maxn = 10 + 10, inf = 0x3f3f3f3f;
vector<int> grafo[maxn];
int a, b, c;
bool dp[maxn][(1<<(maxn-10))+10];

bool certo;
void dfs(int u, int mask){
	if(dp[u][mask]) return;
	dp[u][mask] = true;

	if(u == c){
		certo = (mask&(1<<a) && mask&(1<<b));
	}else{
		for(auto v : grafo[u]){
			if(mask&(1<<v)) continue;
			dfs(v, mask | (1<<v));
		}
	}
}

main(){
	ios::sync_with_stdio(false), cin.tie(0);
	int n, m;
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		int a, b;
		cin >> a >> b;
		grafo[a].push_back(b);
		grafo[b].push_back(a);
	}

	int ans=0;
	for(a=1;a<=n;a++){
		for(b=1;b<=n;b++){
			for(c=1;c<=n;c++){
				certo = false;
				dfs(a, 1<<a);
				ans += certo;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

Compilation message

count_triplets.cpp:25:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 488 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 692 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 692 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -