# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104664 | MatesV13 | Geppetto (COCI15_geppetto) | C++11 | 42 ms | 384 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>
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |