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>
#include "friend.h"
using namespace std;
typedef long long LL;
LL chose[100010], nochose[100010];
int findSample(int n, int con[], int host[], int proto[])
{
for(int i=0; i<n; i++){
chose[i]=(LL)con[i];
}
for(int i=n-1; i>=1; i--){
LL c1=chose[host[i]], n1=nochose[host[i]], c2=chose[i], n2=nochose[i];
if(proto[i]==0){
chose[host[i]]=c1+n2;
nochose[host[i]]=max(c2+n1, n1+n2);
}
if(proto[i]==1){
chose[host[i]]=max(c1+c2, max(c1+n2, n1+c2));
nochose[host[i]]=n1+n2;
}
if(proto[i]==2){
chose[host[i]]=max(c1+n2, c2+n1);
nochose[host[i]]=n1+n2;
}
}
return (int)max(chose[0], nochose[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... |