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 <bits/stdc++.h>
using namespace std;
#define sz(a) ((int)(a).size())
typedef vector<int> vint;
typedef vector<vint> vvint;
#ifndef wambule
#include "friend.h"
#else
#endif
int findSample(int n, int cfd[], int hst[], int ptc[]) {
int x[n], y[n];
for(int i = 0; i < n; ++i) {
x[i] = cfd[i];
y[i] = 0;
}
for(int i = n - 1; i > 0; --i) {
int j = hst[i];
if(ptc[i] == 0) {
x[j] += y[i];
y[j] += max(x[i], y[i]);
} else if(ptc[i] == 1) {
x[j] = max(x[i] + x[j], max(x[i] + y[j], y[i] + x[j]));
y[j] += y[i];
} else {
x[j] = max(x[i] + y[j], y[i] + x[j]);
y[j] += y[i];
}
}
return max(x[0], y[0]);
}
#ifdef wambule
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
return 0;
}
#endif
# | 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... |