Submission #53378

#TimeUsernameProblemLanguageResultExecution timeMemory
53378zetapiFriend (IOI14_friend)C++14
8 / 100
6 ms3220 KiB
//#include "friend.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator const int MAX=1e5; vector<int> lol,vec[MAX]; int odd,even,arr[MAX],mark[MAX],dp[MAX][2],maps[1009][1009]; void dfs(int node,int par) { int f=0,s=0; mark[node]=1; for(auto A:vec[node]) { if(A==par) continue; dfs(A,node); f+=dp[A][0]; s+=dp[A][1]; } dp[node][0]=max(f,arr[node]+s); dp[node][1]=f; return ; } int findSample(int n,int confidence[],int host[],int protocol[]) { int ans=0,ok,N=n,cur; for(int A=0;A<N;A++) arr[0]=max(arr[0],confidence[A]); return arr[0]; for(int A=1;A<N;A++) { if(protocol[A]==0) { vec[host[A]].pb(A); vec[A].pb(host[A]); } else if(protocol[A]==1) { for(auto B:vec[host[A]]) { vec[B].pb(A); vec[A].pb(B); } } else { for(auto B:vec[host[A]]) { vec[B].pb(A); vec[A].pb(B); } vec[host[A]].pb(A); vec[A].pb(host[A]); } } for(int A=0;A<N;A++) if(!mark[A]) { dfs(A,-1); ans+=dp[A][0]; } return ans; } /*int main() { ios_base::sync_with_stdio(false); int n= cout<<findSample() return 0; }*/

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:36:12: warning: unused variable 'ok' [-Wunused-variable]
  int ans=0,ok,N=n,cur;
            ^~
friend.cpp:36:19: warning: unused variable 'cur' [-Wunused-variable]
  int ans=0,ok,N=n,cur;
                   ^~~
#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...