Submission #554260

#TimeUsernameProblemLanguageResultExecution timeMemory
554260flappybirdFriend (IOI14_friend)C++17
16 / 100
1 ms340 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define MAX 101010 pii dp[MAX]; int findSample(int N, int confidence[], int host[], int protocol[]) { int i; for (i = 0; i < N; i++) dp[i].first = confidence[i]; for (i = N - 1; i > 0; i--) { if (protocol[i] == 0) { dp[host[i]].first += dp[i].second; dp[host[i]].second += dp[i].first; } else if (protocol[i] == 1) { dp[host[i]].first += max(dp[i].first, dp[i].second); dp[host[i]].second += dp[i].second; } else { dp[host[i]].first = max(dp[host[i]].first + dp[i].second, dp[host[i]].second + dp[i].first); dp[host[i]].second += dp[i].second; } } return max(dp[0].first, dp[0].second); }
#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...