Submission #15691

#TimeUsernameProblemLanguageResultExecution timeMemory
15691aintaFriend (IOI14_friend)C++98
100 / 100
40 ms3044 KiB
#include "friend.h" #include<algorithm> using namespace std; // Find out best sample int Gap[101000][2]; int findSample(int n,int confidence[],int host[],int protocol[]){ int i; for(i=0;i<n;i++)Gap[i][0]=confidence[i]; for(i=n-1;i>0;i--){ if(protocol[i] == 1){ Gap[host[i]][0] += Gap[i][0]; Gap[host[i]][1] += Gap[i][1]; } if(protocol[i] == 2){ Gap[host[i]][0] = max(Gap[i][0] + Gap[host[i]][1], Gap[host[i]][0] + Gap[i][1]); Gap[host[i]][1] += Gap[i][1]; } if(protocol[i] == 0){ Gap[host[i]][0] += Gap[i][1]; Gap[host[i]][1] += Gap[i][0]; } Gap[host[i]][0]=max(Gap[host[i]][0], Gap[host[i]][1]); } return max(Gap[0][0],Gap[0][1]); }
#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...