# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208396 | ArKCa | Geppetto (COCI15_geppetto) | C++17 | 12 ms | 376 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>
#define pb push_back
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
using namespace std;
int n,m,a,b,ans;
vector<int>v[30];
void fun(int x,int y){
ans++;
// printf("%d\n", x);
if(y==(n+1))
return ;
int flag=0;
for(int i=y;i<=n;i++){
flag=0;
for(int j=0;j<v[i].size();j++){
if(((1<<v[i][j])&x)!=0){
flag=1;
}
}
if(flag==0)
fun(x^(1<<i),i+1);
}
}
int main(){
//fri("in.txt");
//fro("out.txt");
cin>>n>>m;/**/
for(int i=0;i<m;i++){
scanf("%lld %lld",&a,&b);
v[a].pb(b);
v[b].pb(a);
}
fun(0,1);
cout<<ans<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |