Submission #385885

#TimeUsernameProblemLanguageResultExecution timeMemory
385885ParsaAlizadehFriend (IOI14_friend)C++17
100 / 100
39 ms3052 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]){ vector<int> c(confidence, confidence + n); int ans = 0; for (int i = n - 1; i >= 1; i--) { if (protocol[i] == 0) { c[host[i]] -= c[i]; ans += c[i]; c[host[i]] = max(c[host[i]], 0); } if (protocol[i] == 1) { c[host[i]] += c[i]; } if (protocol[i] == 2) { c[host[i]] = max(c[host[i]], c[i]); } }; ans += c[0]; return ans; }
#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...