Submission #115760

#TimeUsernameProblemLanguageResultExecution timeMemory
115760RezwanArefin01Friend (IOI14_friend)C++17
100 / 100
31 ms2688 KiB
#include "friend.h" #define max(a, b) ((a) > (b) ? (a) : (b)) int findSample(int n, int val[], int host[], int typ[]){ int ans = 0; for(int i = n - 1; i >= 1; --i) { int &A = val[host[i]], &B = val[i]; if(typ[i] == 0) ans += B, A = max(0, A - B); if(typ[i] == 1) A += B; if(typ[i] == 2) A = max(A, B); } return ans + val[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...