제출 #104664

#제출 시각아이디문제언어결과실행 시간메모리
104664MatesV13Geppetto (COCI15_geppetto)C++11
80 / 80
42 ms384 KiB
#include <bits/stdc++.h> using namespace std; long long n, m, ans; bool sastojci[25], ok; pair<int, int> fuj[500]; void pizza(int i){ for (int j=1;j<=n;j++){ sastojci[j] = i%2; i=i/2; } } int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i=0;i<m;i++){ int a, b; cin >> a >> b; fuj[i]=make_pair(a,b); } long long x = pow(2.0, (double)n); for (int i=0;i<x;i++){ ok = true; pizza(i); for (int j=0;j<m;j++)if (sastojci[fuj[j].first] and sastojci[fuj[j].second]) {ok=0; break;} if (ok) ans++; } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...