# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208397 | 2020-03-11T07:05:38 Z | ArKCa | Geppetto (COCI15_geppetto) | C++17 | 7 ms | 380 KB |
#include<bits/stdc++.h> #define pb push_back #define ll long long #define int ll #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[50]; 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); } } int32_t 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 380 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 7 ms | 376 KB | Output is correct |