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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MAX 101010
pii dp[MAX];
int findSample(int N, int confidence[], int host[], int protocol[]) {
int i;
for (i = 0; i < N; i++) dp[i].first = confidence[i];
for (i = N - 1; i > 0; i--) {
if (protocol[i] == 0) {
dp[host[i]].first += dp[i].second;
dp[host[i]].second += dp[i].first;
}
else if (protocol[i] == 1) {
dp[host[i]].first += max(dp[i].first, dp[i].second);
dp[host[i]].second += dp[i].second;
}
else {
dp[host[i]].first = max(dp[host[i]].first + dp[i].second, dp[host[i]].second + dp[i].first);
dp[host[i]].second += dp[i].second;
}
}
return max(dp[0].first, dp[0].second);
}
# | 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... |