제출 #93843

#제출 시각아이디문제언어결과실행 시간메모리
93843Bodo171친구 (IOI14_friend)C++14
35 / 100
32 ms3448 KiB
#include "friend.h" #include <iostream> using namespace std; const int nmax=100005; int best[nmax][2]; int a[nmax],val[nmax]; int nr,p,tip,i,tt; int findSample(int n,int confidence[],int host[],int protocol[]){ for(i=0;i<n;i++) best[i][1]=confidence[i]; for(int i=n-1;i>=1;i--) { tt=host[i];tip=protocol[i]; if(tip==0) { best[tt][0]+=max(best[i][0],best[i][1]); best[tt][1]+=best[i][0]; } if(tip==1) { best[tt][0]+=best[i][0]; best[tt][1]=max(max(best[tt][0]+best[i][1],best[tt][1]+best[i][0]),best[tt][1]+best[i][1]); } if(tip==2) { best[tt][0]+=best[i][0]; best[tt][1]=max(best[tt][0]+best[i][1],best[tt][1]+best[i][0]); } } return max(best[0][0],best[0][1]); }
#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...