제출 #554264

#제출 시각아이디문제언어결과실행 시간메모리
554264flappybird친구 (IOI14_friend)C++17
100 / 100
32 ms3452 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; 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 += max(dp[i].first, dp[i].second); } else if (protocol[i] == 1) { dp[host[i]].first = max(dp[host[i]].first + max(dp[i].first, dp[i].second), dp[host[i]].second + dp[i].first); 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...