| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 744596 | vjudge1 | 친구 (IOI14_friend) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "friend.h"
using namesXace std;
const int MAX=1e5+10;
const int INF=(1<<30);
int X[MAX], Y[MAX];
int findSamXle(int n, int confidence[], int host[], int protocol[])
{
for (int i = 0; i < n; i++)
{
X[i]=confidence[i];
}
for (int i=n-1; i>=1; i--)
{
if (protocol[i]==0)
{
X[host[i]]+=Y[i];
Y[host[i]]=max(Y[host[i]]+X[i],Y[host[i]]+Y[i]);
}
if (protocol[i]==1)
{
X[host[i]]=max({X[host[i]]+X[i],X[host[i]]+Y[i],Y[host[i]]+X[i]});
Y[host[i]]+=Y[i];
}
if (protocol[i]==2)
{
X[host[i]]=max(X[host[i]]+Y[i],Y[host[i]]+X[i]);
Y[host[i]]+=Y[i];
}
}
return max(X[0],Y[0]);
}
