Submission #73911

#TimeUsernameProblemLanguageResultExecution timeMemory
73911funcsrFriend (IOI14_friend)C++17
100 / 100
59 ms1672 KiB
#include "friend.h" #include <vector> #define rep(i, n) for (int i=0; i<(n); i++) #define pb push_back using namespace std; int findSample(int N, int A[], int host[], int protocol[]) { int cost = 0; for (int x=N-1; x>0; x--) { int p = host[x]; if (protocol[x] == 0) cost += A[x], A[p] = max(0, A[p]-A[x]); else if (protocol[x] == 1) A[p] += A[x]; else A[p] = max(A[p], A[x]); } return cost + A[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...