제출 #993719

#제출 시각아이디문제언어결과실행 시간메모리
993719firewater친구 (IOI14_friend)C++14
35 / 100
1 ms1620 KiB
#include "friend.h" #include<bits/stdc++.h> #define ll long long #define N 100100 using namespace std; // Find out best sample int x,f[N],g[N]; int findSample(int n,int confidence[],int host[],int protocol[]){ memset(f,0,sizeof(f)); memset(g,0,sizeof(g)); for(int i=0;i<n;++i) f[i]=confidence[i]; for(int i=n-1;i>0;--i){ x=host[i]; f[i]=max(f[i],g[i]); if(protocol[i]==0)f[x]+=g[i],g[x]+=f[i]; else if(protocol[i]==1)f[x]+=f[i],g[x]+=g[i]; else f[x]=max(f[x]+g[i],g[x]+f[i]),g[x]+=g[i]; } return max(f[0],g[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...