Submission #81638

# Submission time Handle Problem Language Result Execution time Memory
81638 2018-10-25T16:41:58 Z xiaowuc1 Geppetto (COCI15_geppetto) C++14
80 / 80
64 ms 652 KB
#include <bits/stdc++.h>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);

ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/
using namespace std;

const double PI = 2 * acos(0);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, ll> pill;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<vector<ll>> matrix;

int adj[25];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while(m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    adj[a] |= 1 << b;
    adj[b] |= 1 << a;
  }
  int r = 0;
  for(int mask = 0; mask < (1<<n); mask++) {
    bool bad = false;
    for(int i = 0; i < n && !bad; i++) {
      bad |= (mask&(1<<i)) && (mask&adj[i]);
    }
    if(!bad) {
      r++;
    }
  }
  printf("%d\n", r);
}

Compilation message

geppetto.cpp: In function 'int main()':
geppetto.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &n, &m);
   ~~~~~^~~~~~~~~~~~~~~~
geppetto.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &a, &b);
     ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 456 KB Output is correct
4 Correct 6 ms 456 KB Output is correct
5 Correct 6 ms 540 KB Output is correct
6 Correct 6 ms 572 KB Output is correct
7 Correct 7 ms 640 KB Output is correct
8 Correct 6 ms 640 KB Output is correct
9 Correct 20 ms 652 KB Output is correct
10 Correct 64 ms 652 KB Output is correct