# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43839 | heon | Geppetto (COCI15_geppetto) | C++11 | 6 ms | 552 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |