Submission #436682

#TimeUsernameProblemLanguageResultExecution timeMemory
436682ScarletSFriend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size() using namespace std; const int N = 1005; int mt[N]; vector<int> e[N], v[2]; bool done[N], cmp[N]; void dfs(int c, int x) { v[x].push_back(c); mt[c]=-1; cmp[c]=1; for (int i : e[c]) if (!cmp[i]) dfs(i,x^1); } bool try_kuhn(int c) { if (done[c]) return 0; done[c]=1; for (int i : e[c]) if (mt[i]!=-1||try_kuhn(i)) { mt[i]=c; return 1; } return 0; } int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i=1;i<n;++i) { if (protocol[i]==0) { e[i].push_back(host[i]); e[host[i]].push_back(i); } else { for (int j : edges[host[i]]) { e[i].push_back(j); e[j].push_back(i); } } } int tot=0, cur; for (int i=0;i<n;++i) if (!cmp[i]) { v[0].clear(); v[1].clear(); dfs(i,0); for (int j : v[0]) { done.reset(); try_kuhn(j); } cur=0; for (int j : v[1]) if (mt[j]!=1) ++cur; tot+=-cur+v[0].size()+v[1].size(); } return tot; } /**int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; int c[n]; for (int i=0;i<n;++i) cin>>c[i]; int h[n]; for (int i=1;i<n;++i) cin>>h[i]; int p[n]; for (int i=1;i<n;++i) cin>>p[i]; cout<<findSample(n,c,h,p); return 0; }**/

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:46:26: error: 'edges' was not declared in this scope
   46 |             for (int j : edges[host[i]])
      |                          ^~~~~
friend.cpp:62:22: error: request for member 'reset' in 'done', which is of non-class type 'bool [1005]'
   62 |                 done.reset();
      |                      ^~~~~