제출 #742697

#제출 시각아이디문제언어결과실행 시간메모리
742697vjudge1Friend (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() vector<int> g[1005]; bool visited[1005]; int p[1005], col[1005]; int dfs(int n) { for (auto x : g[n]) { if (visited[x]) continue; visited[x] = 1; if (p[x] == -1 || dfs(p[x])) { p[x] = n; return 1; } } return 0; } int findSample(int n, int confidence[], int host[], int protocol[]) { memset(p, -1, sizeof(p)); for (int i = 0; i < n; i++) { if (protocol[i] == 0) { g[host[i]].push_back(i); g[i].push_back(host[i]); col[i] = col[host[i]] ^ 1; } } int ans = n; for (int i = 0; i < n; i++) { if (col[i] == 0) { memset(vis, 0, sizeof(vis)); ans -= dfs(n); } } return ans; }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:38:20: error: 'vis' was not declared in this scope
   38 |             memset(vis, 0, sizeof(vis));
      |                    ^~~