Submission #43839

#TimeUsernameProblemLanguageResultExecution timeMemory
43839heonGeppetto (COCI15_geppetto)C++11
80 / 80
6 ms552 KiB
#include<bits/stdc++.h> using namespace std; int n,m; vector <int> relation[25]; bool bio[25]; int solve(int a){ if(a == n) return 1; int ret = solve(a+1); bool ok = 1; for(auto x : relation[a]){ if(bio[x]) ok = 0; } if(ok){ bio[a] = 1; ret += solve(a+1); bio[a] = 0; } return ret; } int main(){ cin >> n >> m; for(int i = 0; i < m; i++){ int a,b; cin >> a >> b; a--,b--; relation[a].push_back(b); relation[b].push_back(a); } cout << solve(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...