# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
825804 | loctildore | Friend (IOI14_friend) | C++14 | 21 ms | 3412 KiB |
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;
// trans rights
#define ll long long
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x), end(x)
#define MOD 1000000009
int p[100069], q[100069];
int findSample(int n, int confidence[], int host[], int protocol[]) {
for (int i = 0; i < n; i++) p[i] = confidence[i];
for (int i = n - 1; i; i--) {
int x = host[i];
if (!protocol[i]) {
p[x] += q[i];
q[x] += max(p[i], q[i]);
}
else {
q[x] += q[i];
if (protocol[i] == 1) {
p[x] = max(p[x] + p[i], max(p[x] + q[i], q[x] + p[i]));
}
else p[x] = max(p[x] + q[i], q[x] + p[i]);
}
}
return max(p[0], q[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... |