Submission #293779

#TimeUsernameProblemLanguageResultExecution timeMemory
293779alexandra_udristoiuFriend (IOI14_friend)C++14
58 / 100
41 ms3448 KiB
#include "friend.h" #include<algorithm> using namespace std; static int d[100005][2]; int findSample(int n, int c[], int t[], int pr[]){ int i, x; for(i = 0; i < n; i++){ d[i][1] = c[i]; } for(i = n - 1; i >= 1; i--){ x = t[i]; if(pr[i] == 0){ d[x][1] += d[i][0]; d[x][0] += d[i][1]; } if(pr[i] == 1){ d[x][1] += d[i][1]; d[x][0] += d[i][0]; } if(pr[i] == 2){ d[x][0] += d[i][0]; d[x][1] = max(d[i][0] + d[x][1], d[i][1] + d[x][0]); } d[x][1] = max(d[x][1], d[x][0]); } return d[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...