Submission #1125046

#TimeUsernameProblemLanguageResultExecution timeMemory
1125046epicci23Friend (IOI14_friend)C++20
100 / 100
22 ms2116 KiB
#include "bits/stdc++.h" using namespace std; #include "friend.h" int findSample(int n,int confidence[],int host[],int protocol[]){ array<int,2> val[n+5]; for(int i=0;i<n;i++){ val[i][1] = confidence[i]; val[i][0] = 0; } for(int i=n-1;i>=1;i--){ int p = host[i]; int op = protocol[i]; if(op == 0){ val[p][0] += max(val[i][0], val[i][1]); val[p][1] += val[i][0]; } else if(op == 1){ val[p][1] = max({val[p][1]+val[i][0],val[p][1]+val[i][1],val[p][0]+val[i][1]}); val[p][0] += val[i][0]; } else{ val[p][1] = max(val[p][1]+val[i][0],val[p][0]+val[i][1]); val[p][0] += val[i][0]; } } return max(val[0][0],val[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...