# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959179 | lalig777 | Geppetto (COCI15_geppetto) | C++14 | 18 ms | 428 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 <iostream>
#include <vector>
using namespace std;
int ans=0;
int n, m;
void subsets (int i, vector<vector<bool>>&proh, vector<int>&negado){
if (i==n){
ans++;
return;
}
if (negado[i]==0){
for (int k=0; k<n; k++){
if (proh[i][k]==true) negado[k]++;
}subsets(i+1, proh, negado);
for (int k=0; k<n; k++){
if (proh[i][k]==true) negado[k]--;
}
}
subsets(i+1, proh, negado);
return;
}
int main(){
cin>>n>>m;
vector<vector<bool>>proh(n, vector<bool>(n, false));
vector<int>negado(n, 0);
while (m--){
int a, b;
cin>>a>>b;
proh[a-1][b-1]=true;
proh[b-1][a-1]=true;
}subsets(0, proh, negado);
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |