Submission #742714

#TimeUsernameProblemLanguageResultExecution timeMemory
742714BlagojFriend (IOI14_friend)C++14
100 / 100
24 ms2208 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() int p[100005], q[100005]; int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i = 0; i < n; i++) { p[i] = confidence[i]; } for (int i = n - 1; i >= 1; i--) { if (protocol[i] == 0) { p[host[i]] += q[i]; q[host[i]] = max(q[host[i]] + p[i], q[host[i]] + q[i]); } if (protocol[i] == 1) { p[host[i]] = max({p[host[i]] + p[i], p[host[i]] + q[i], q[host[i]] + p[i]}); q[host[i]] += q[i]; } if (protocol[i] == 2) { p[host[i]] = max(p[host[i]] + q[i], q[host[i]] + p[i]); q[host[i]] += q[i]; } } 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...