Submission #927911

#TimeUsernameProblemLanguageResultExecution timeMemory
927911TAhmed33Friend (IOI14_friend)C++98
100 / 100
25 ms3412 KiB
#include <bits/stdc++.h> using namespace std; int findSample (int n, int confidence[], int host[], int protocol[]) { int p[n] = {}, q[n] = {}; for (int i = 0; i < n; i++) p[i] = confidence[i]; for (int i = n - 1; i >= 1; i--) { int p1 = p[i], q1 = q[i]; if (protocol[i] == 2) { p[host[i]] = max(p[host[i]] + q1, p1 + q[host[i]]); q[host[i]] += q1; } else if (protocol[i] == 1) { p[host[i]] = max({q[host[i]] + p1, p[host[i]] + q1, p1 + p[host[i]]}); q[host[i]] += q1; } else { p[host[i]] += q1; q[host[i]] += max(p1, q1); } } return max({p[0], q[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...