Submission #748473

#TimeUsernameProblemLanguageResultExecution timeMemory
748473kkkkkkkkFriend (IOI14_friend)C++14
100 / 100
27 ms3400 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n,int confidence[],int host[],int protocol[]) { int zemen[n],ne_zemen[n]={0}; for (int i=0;i<n;i++) zemen[i]=confidence[i]; for (int i=n-1;i>0;i--){ if (protocol[i]==2){ zemen[host[i]]=max(zemen[host[i]]+ne_zemen[i],zemen[i]+ne_zemen[host[i]]); ne_zemen[host[i]]+=ne_zemen[i]; } else if (protocol[i]==1){ zemen[host[i]]=max({zemen[host[i]]+ne_zemen[i],ne_zemen[host[i]]+zemen[i],zemen[host[i]]+zemen[i]}); ne_zemen[host[i]]+=ne_zemen[i]; } else { zemen[host[i]]+=ne_zemen[i]; ne_zemen[host[i]]=max(ne_zemen[host[i]]+zemen[i],ne_zemen[host[i]]+ne_zemen[i]); } } return max(zemen[0],ne_zemen[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...