Submission #986944

#TimeUsernameProblemLanguageResultExecution timeMemory
986944zsomborFriend (IOI14_friend)C++17
100 / 100
25 ms2644 KiB
#include <iostream> #include "friend.h" using namespace std; int findSample(int n, int c[], int h[], int p[]) { int ans = 0; for (int i = n - 1; i > 0; i--) { if (p[i] == 0) { c[h[i]] = max(c[h[i]] - c[i], 0); ans += c[i]; } if (p[i] == 1) c[h[i]] += c[i]; if (p[i] == 2) c[h[i]] = max(c[h[i]], c[i]); } return c[0] + ans; }
#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...