제출 #17303

#제출 시각아이디문제언어결과실행 시간메모리
17303gs14004지도 색칠하기 (GA3_map)C++14
컴파일 에러
0 ms0 KiB
#include <algorithm> using namespace std; bool adj[20][20]; int col[20]; int bits; bool bad; void dfs(int x, int p){ if(col[x] && col[x] != p){ bad = 1; return; } else if(col[x]) return; col[x] = p; for(int i=0; i<n; i++){ if(!col[i] && adj[x][i] && (bits >> i) % 2 == (bits >> x) % 2){ dfs(i); } } } long long NumberOfMaps (int N, int M, int *A, int *B){ for(int i=0; i<M; i++){ adj[A[i]][B[i]] = 1; adj[B[i]][A[i]] = 1; } long long sum = 0; for(int i=0; i<(1<<(N-1)); i++){ bits = i; bad = 0; int cnt = 0; for(int i=1; i<=N; i++){ if(col[i]) continue; dfs(i); if(bad) break; cnt++; } if(bad) continue; sum += (2 << cnt); } return sum; }

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

map.cpp: In function ‘void dfs(int, int)’:
map.cpp:17:17: error: ‘n’ was not declared in this scope
  for(int i=0; i<n; i++){
                 ^
map.cpp:19:9: error: too few arguments to function ‘void dfs(int, int)’
    dfs(i);
         ^
map.cpp:10:6: note: declared here
 void dfs(int x, int p){
      ^
map.cpp: In function ‘long long int NumberOfMaps(int, int, int*, int*)’:
map.cpp:35:9: error: too few arguments to function ‘void dfs(int, int)’
    dfs(i);
         ^
map.cpp:10:6: note: declared here
 void dfs(int x, int p){
      ^