Submission #59554

#TimeUsernameProblemLanguageResultExecution timeMemory
59554radoslav11Friend (IOI14_friend)C++14
100 / 100
75 ms6096 KiB
#include <bits/stdc++.h> #include "friend.h" //#include "Lgrader.cpp" using namespace std; template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const int MAXN = (1 << 20); int findSample(int n, int confidence[], int host[], int protocol[]) { int ans = 0; for(int i = n - 1; i >= 1; i--) { if(protocol[i] == 2) chkmax(confidence[host[i]], confidence[i]); else if(protocol[i] == 1) confidence[host[i]] += confidence[i]; else { int value = confidence[i]; ans += value; confidence[host[i]] -= value; chkmax(confidence[host[i]], 0); } } return ans + confidence[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...