Submission #259297

#TimeUsernameProblemLanguageResultExecution timeMemory
259297Osama_AlkhodairyFriend (IOI14_friend)C++17
100 / 100
35 ms4216 KiB
#include <bits/stdc++.h> #include "friend.h" //~ #include "grader.cpp" using namespace std; #define ll long long int findSample(int n, int confidence[], int host[], int protocol[]){ vector <ll> p(n), q(n); for(int i = 0 ; i < n ; i++){ p[i] = confidence[i]; } for(int i = n - 1 ; i > 0 ; i--){ int j = host[i]; if(protocol[i] == 0){ p[j] += q[i]; q[j] += max(p[i], q[i]); } else if(protocol[i] == 1){ p[j] = max(p[i] + p[j], max(p[i] + q[j], q[i] + p[j])); q[j] += q[i]; } else{ p[j] = max(p[i] + q[j], q[i] + p[j]); q[j] += 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...