Submission #33477

#TimeUsernameProblemLanguageResultExecution timeMemory
33477top34051Friend (IOI14_friend)C++14
100 / 100
39 ms3968 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; const int maxn = 100005; int p[maxn], q[maxn]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int x=0;x<n;x++) p[x] = confidence[x], q[x] = 0; for(int x=n-1;x>0;x--) { int y = host[x]; if(protocol[x]==0) { p[y] = p[y] + q[x]; q[y] = q[y] + max(p[x], q[x]); } else if(protocol[x]==1) { p[y] = max(p[y] + max(p[x], q[x]), p[x] + q[y]); q[y] = q[y] + q[x]; } else { p[y] = max(p[y] + q[x], p[x] + q[y]); q[y] = q[y] + q[x]; } } return max(p[0], q[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...