Submission #592112

#TimeUsernameProblemLanguageResultExecution timeMemory
592112HanksburgerFriend (IOI14_friend)C++17
100 / 100
27 ms2684 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n, int c[], int h[], int p[]) { int ans=0; for (int i=n-1; i; i--) { if (!p[i]) { ans+=c[i]; c[h[i]]=max(0, c[h[i]]-c[i]); } else if (p[i]==1) c[h[i]]+=c[i]; else c[h[i]]=max(c[h[i]], c[i]); } return ans+c[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...