Submission #15786

#TimeUsernameProblemLanguageResultExecution timeMemory
15786myungwooFriend (IOI14_friend)C++14
16 / 100
0 ms3676 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 100005 static int D[MAXN], E[MAXN]; int findSample(int n, int c[], int h[], int p[]) { for (int i=0;i<n;i++) D[i] = c[i]; for (int i=n;--i;){ int t = h[i]; if (p[i] == 0){ D[t] += E[i]; E[t] = max(E[t] + D[i], E[t] + E[t]); }else if (p[i] == 1){ D[t] = max(D[t] + D[i], max(D[t] + E[i], E[t] + D[i])); E[t] += E[i]; }else{ D[t] = max(D[t] + E[i], E[t] + D[i]); E[t] += E[i]; } } return max(D[0], E[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...