이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
void debug_out() {cerr<<endl;}
template <typename Head, typename... Tail>
void debug_out(Head _H, Tail... _T) {cerr<<" "<<to_string(_H);debug_out(_T...);}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
const int MAXN = -1;
const int inf=1000000500ll;
const int MOD = (int)1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> pi;
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
int oth[n+5];memset(oth,0,sizeof oth);
for(int i=n-1;i>0;i--){
if(protocol[i] == 0){
confidence[host[i]]=max(confidence[i],confidence[host[i]]+oth[i]);
oth[host[i]] += max(confidence[i], oth[i]);
} else if(protocol[i] == 1){
confidence[host[i]] += max(confidence[i], oth[i]);
oth[host[i]]=oth[host[i]]+oth[i];
} else{
confidence[host[i]]=max(confidence[i],confidence[host[i]]+oth[i]);
oth[host[i]]=oth[host[i]]+oth[i];
}
}
return max(confidence[0],oth[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... |