This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |