Submission #959179

#TimeUsernameProblemLanguageResultExecution timeMemory
959179lalig777Geppetto (COCI15_geppetto)C++14
80 / 80
18 ms428 KiB
#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 timeMemoryGrader output
Fetching results...