Submission #116282

#TimeUsernameProblemLanguageResultExecution timeMemory
116282nvmdavaFriend (IOI14_friend)C++17
100 / 100
35 ms3448 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int ie[100005], oe[100005]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 0; i < n; i++) ie[i] = confidence[i]; for(int i = n - 1; i > 0; i--){ int j = host[i]; if(protocol[i] == 0){ oe[j] += max(ie[i], oe[i]); ie[j] += oe[i]; } else if(protocol[i] == 1){ ie[j] = max(ie[i] + ie[j], max(ie[j] + oe[i], oe[j] + ie[i])); oe[j] += oe[i]; } else { ie[j] = max(ie[j] + oe[i], oe[j] + ie[i]); oe[j] += oe[i]; } } return max(ie[0], oe[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...