Submission #367434

#TimeUsernameProblemLanguageResultExecution timeMemory
367434cpp219Geppetto (COCI15_geppetto)C++14
80 / 80
3 ms492 KiB
#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)

geppetto.cpp: In function 'int main()':
geppetto.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   27 |         freopen(task".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...