제출 #15691

#제출 시각아이디문제언어결과실행 시간메모리
15691ainta친구 (IOI14_friend)C++98
100 / 100
40 ms3044 KiB
#include "friend.h" #include<algorithm> using namespace std; // Find out best sample int Gap[101000][2]; int findSample(int n,int confidence[],int host[],int protocol[]){ int i; for(i=0;i<n;i++)Gap[i][0]=confidence[i]; for(i=n-1;i>0;i--){ if(protocol[i] == 1){ Gap[host[i]][0] += Gap[i][0]; Gap[host[i]][1] += Gap[i][1]; } if(protocol[i] == 2){ Gap[host[i]][0] = max(Gap[i][0] + Gap[host[i]][1], Gap[host[i]][0] + Gap[i][1]); Gap[host[i]][1] += Gap[i][1]; } if(protocol[i] == 0){ Gap[host[i]][0] += Gap[i][1]; Gap[host[i]][1] += Gap[i][0]; } Gap[host[i]][0]=max(Gap[host[i]][0], Gap[host[i]][1]); } return max(Gap[0][0],Gap[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...