# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367434 | cpp219 | Geppetto (COCI15_geppetto) | C++14 | 3 ms | 492 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 ll int
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 20 + 9;
const ll inf = 1e9 + 7;
typedef pair<int,int> LL;
vector<ll> g[N];
ll n,m,x,y,dd[N][N],ans,b[N];
void f(ll i){
if (i > n){
ans++; return;
}
b[i] = 0; f(i + 1);
for (auto j : g[i]) if (b[j]) return;
b[i] = 1; f(i + 1);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define task "tst"
if (fopen(task".INP","r")){
freopen(task".INP","r",stdin);
//freopen(task".OUT","w",stdout);
}
cin>>n>>m;
while(m--){
cin>>x>>y;
if (dd[x][y]) continue;
dd[x][y] = dd[y][x] = 1;
g[max(x,y)].push_back(min(x,y));
}
f(1); cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |