Submission #297718

#TimeUsernameProblemLanguageResultExecution timeMemory
297718peti1234Friend (IOI14_friend)C++17
100 / 100
35 ms1528 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n, int con[], int h[], int p[]) { int sum=0; for (int i=n-1; i>0; i--) { int a=h[i], b=p[i], c=con[i]; if (b==2) con[a]=max(con[a], c); if (b==1) con[a]+=c; if (b==0) sum+=c, con[a]=max(0, con[a]-c); } return sum+con[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...