Submission #284576

#TimeUsernameProblemLanguageResultExecution timeMemory
284576ScarletSFriend (IOI14_friend)C++17
0 / 100
3 ms640 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size() using namespace std; vector<int> edges[1000]; bool done[1000]; int ans[2]; void dfs(int c, int x) { ++ans[x]; done[c]=1; for (int i : edges[c]) if (!done[i]) dfs(i,x^1); } int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i=1;i<n;++i) { if (protocol[i]==1) { edges[i].push_back(host[i]); edges[host[i]].push_back(i); } else { for (int j : edges[host[i]]) { edges[i].push_back(j); edges[j].push_back(i); } } } dfs(0,0); cout<<max(ans[0],ans[1]); } /**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:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...