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 <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
int findSample(int n, int a[], int p[], int b[]){
int ret = 0;
for(int i = n - 1; i; i--){
switch(b[i]){
case 0:
ret += a[i];
a[p[i]] = max(a[p[i]] - a[i], 0);
break;
case 1:
a[p[i]] += a[i];
break;
case 2:
a[p[i]] = max(a[p[i]], a[i]);
break;
}
}
return ret + 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... |