Submission #31172

#TimeUsernameProblemLanguageResultExecution timeMemory
31172cscandkswonFriend (IOI14_friend)C++14
27 / 100
56 ms3972 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int MAXN=100000; int p[MAXN], q[MAXN]; int findSample(int n,int confidence[],int host[],int protocol[]){ int i; for(i=0; i<n; i++) p[i]=confidence[i], q[i]=0; for(i=n-1; i>0; i--){ if(protocol[i]==0){ p[host[i]]=p[host[i]]+q[i]; q[host[i]]=q[host[i]]+p[i]; } else if(protocol[i]==1){ p[host[i]]=max(p[host[i]]+p[i], max(p[host[i]]+q[i], q[host[i]]+p[i])); q[host[i]]=q[host[i]]+q[i]; } else{ p[host[i]]=max(p[host[i]]+q[i], q[host[i]]+p[i]); q[host[i]]=q[host[i]]+q[i]; } } return max(p[0], q[0]); }
#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...