제출 #136159

#제출 시각아이디문제언어결과실행 시간메모리
136159arthurconmy친구 (IOI14_friend)C++14
0 / 100
2 ms380 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "friend.h" #endif using namespace std; const int MAXN=1000; int C[MAXN]; int H[MAXN]; int P[MAXN]; int ans[2][MAXN]; int findSample(int n, int C_raw[], int H_raw[], int P_raw[]) { for(int i=0; i<n; i++) { C[i]=C_raw[i]; H[i]=H_raw[i]; P[i]=P_raw[i]; } ans[1][0] = C[0]; for(int i=1; i<n; i++) { if(P[i]==0) { ans[0][i] = ans[1][H[i]]; ans[1][i] = max(ans[0][H[i]]+C[i],ans[1][H[i]]); } if(P[i]==1) { ans[0][i] = ans[1][H[i]]; ans[1][i] = max(ans[1][H[i]],C[i]+C[H[i]]); } } return ans[1][n]; }
#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...