Submission #133695

#TimeUsernameProblemLanguageResultExecution timeMemory
133695antimirageFriend (IOI14_friend)C++14
100 / 100
37 ms2680 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int c[],int p[],int t[]){ int ans = 0; for (int i = n - 1; i >= 0; i--) { if (i == 0) continue; if (t[i] == 0) { c[p[i]] = max(0, c[p[i]] - c[i]); ans += c[i]; } else if (t[i] == 1) { c[p[i]] += c[i]; } else { c[p[i]] = max( c[p[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...