Submission #59322

# Submission time Handle Problem Language Result Execution time Memory
59322 2018-07-21T14:00:19 Z thiago4532 Duathlon (APIO18_duathlon) C++17
0 / 100
4 ms 940 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 = (certo || (mask&(1<<a) && mask&(1<<b)));
	}else{
		for(auto v : grafo[u]){
			if(mask&(1<<v)) continue;
			dfs(v, mask | (1<<v));
		}
	}
}

int32_t 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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 740 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 888 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 888 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 888 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 940 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 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -