Submission #53390

#TimeUsernameProblemLanguageResultExecution timeMemory
53390zetapiFriend (IOI14_friend)C++14
16 / 100
22 ms11124 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[A]=confidence[A]; 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++) for(auto B:vec[A]) maps[A][B]=1; for(int A=0;A<N;A++) { int cur=0; for(int B=0;B<N;B++) cur+=(maps[A][B]^1)*arr[B]; ans=max(ans,cur); } 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...