제출 #335600

#제출 시각아이디문제언어결과실행 시간메모리
335600Joshc친구 (IOI14_friend)C++11
100 / 100
33 ms3436 KiB
#include <algorithm> using namespace std; #define f first #define s second pair<int, int> dp[100001]; int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i=0; i<n; i++) dp[i] = {confidence[i], 0}; for (int i=n-1; i>0; i--) { int j = host[i], type = protocol[i]; if (type == 0) dp[j] = {dp[j].f+dp[i].s, dp[j].s+max(dp[i].f, dp[i].s)}; else if (type == 1) dp[j] = {max(dp[j].f+max(dp[i].f, dp[i].s), dp[i].f+dp[j].s), dp[i].s+dp[j].s}; else dp[j] = {max(dp[j].f+dp[i].s, dp[i].f+dp[j].s), dp[i].s+dp[j].s}; } return max(dp[0].f, dp[0].s); }
#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...