# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367434 | 2021-02-17T10:19:33 Z | cpp219 | Geppetto (COCI15_geppetto) | C++14 | 3 ms | 492 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 376 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 364 KB | Output is correct |
10 | Correct | 3 ms | 492 KB | Output is correct |