이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |