Submission #1019019

#TimeUsernameProblemLanguageResultExecution timeMemory
1019019SonicMLFriend (IOI14_friend)C++14
100 / 100
17 ms3436 KiB
#include <iostream> #include <fstream> #include "friend.h" using namespace std; int const NMAX = 1e5; int ans[2][1 + NMAX]; int findSample(int n, int confidence[], int host[], int protocol[]) { for(int i = 0;i < n;i++) { ans[1][i] = confidence[i]; ans[0][i] = 0; } for(int i = n-1;i > 0;i--) { int temp0, temp1; if(protocol[i] == 0) { temp0 = max(ans[0][host[i]] + ans[0][i], ans[0][host[i]] + ans[1][i]); temp1 = ans[1][host[i]] + ans[0][i]; }else if(protocol[i] == 1) { temp0 = ans[0][host[i]] + ans[0][i]; temp1 = max(ans[1][host[i]] + ans[1][i], max(ans[1][host[i]] + ans[0][i], ans[0][host[i]] + ans[1][i])); }else { temp0 = ans[0][host[i]] + ans[0][i]; temp1 = max(ans[1][host[i]] + ans[0][i], ans[0][host[i]] + ans[1][i]); } ans[0][host[i]] = temp0; ans[1][host[i]] = temp1; } return max(ans[0][0], ans[1][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...