Submission #344706

#TimeUsernameProblemLanguageResultExecution timeMemory
344706pit4hFriend (IOI14_friend)C++14
35 / 100
1 ms512 KiB
#include<bits/stdc++.h> #include "friend.h" using namespace std; const int MAXN = 1e5+1; int val[2][MAXN]; int findSample(int n, int confidence[], int host[], int protocol[]){ int ans = 0; for(int i=0; i<n; ++i) { val[0][i] = 0; val[1][i] = confidence[i]; } for(int i=n-1; i>=1; --i) { if(protocol[i]==0) { val[0][host[i]] += max(val[0][i], val[1][i]); val[1][host[i]] += val[0][i]; } if(protocol[i]==1) { val[0][host[i]] += val[0][i]; val[1][host[i]] += max(val[0][i], val[1][i]); } if(protocol[i]==2) { val[1][host[i]] = max({val[1][host[i]]+val[0][i], val[0][host[i]]+val[1][i], val[0][host[i]]+val[0][i]}); val[0][host[i]] += val[0][i]; } } ans = max(val[0][0], val[1][0]); return ans; }
#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...