제출 #153364

#제출 시각아이디문제언어결과실행 시간메모리
153364arnold518친구 (IOI14_friend)C++14
100 / 100
39 ms3448 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e5; pii dp[MAXN+10]; int findSample(int N, int *C, int *H, int *P) { int i, j; for(i=0; i<N; i++) dp[i]={C[i], 0}; for(i=N-1; i>=1; i--) { if(P[i]==0) dp[H[i]]={dp[H[i]].first+dp[i].second, max(dp[i].first+dp[H[i]].second, dp[i].second+dp[H[i]].second)}; else if(P[i]==1) dp[H[i]]={max({dp[H[i]].first+dp[i].second, dp[i].first+dp[H[i]].second, dp[i].first+dp[H[i]].first}), dp[i].second+dp[H[i]].second}; else dp[H[i]]={max(dp[H[i]].first+dp[i].second, dp[i].first+dp[H[i]].second), dp[i].second+dp[H[i]].second}; } return max(dp[0].first, dp[0].second); }

컴파일 시 표준 에러 (stderr) 메시지

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:15:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
#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...