제출 #377462

#제출 시각아이디문제언어결과실행 시간메모리
377462marat0210Geppetto (COCI15_geppetto)C++14
80 / 80
4 ms364 KiB
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

const int MAXN = 21;

int n, m;
bool uzeo[MAXN];
vector <int> E[MAXN];

int calc (int x) {
  if (x == n) return 1;
  int ret = calc(x+1);

  bool ok = 1;
  for (auto v: E[x])
    if (uzeo[v]) ok = 0;

  if (ok){
    uzeo[x] = 1;
    ret += calc(x+1);
    uzeo[x] = 0;
  }

  return ret;
}

int main (void){
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int x, y; scanf("%d%d", &x, &y);
    --x; --y; 
    E[x].push_back(y);
    E[y].push_back(x);
  }

  printf("%d\n", calc(0));
  return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

geppetto.cpp: In function 'int main()':
geppetto.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   32 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
geppetto.cpp:34:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |     int x, y; scanf("%d%d", &x, &y);
      |               ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...