제출 #49248

#제출 시각아이디문제언어결과실행 시간메모리
49248Diuven친구 (IOI14_friend)C++11
100 / 100
63 ms5400 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int MX=100010; int findSample(int n, int A[], int F[], int Prot[]){ int X[MX], Y[MX]; // picked / not-picked for(int i=0; i<n; i++) X[i]=A[i], Y[i]=0; for(int i=n-1; i>0; i--){ if(Prot[i]==0){ X[F[i]]=X[F[i]]+Y[i]; Y[F[i]]=max(Y[F[i]]+X[i], Y[F[i]]+Y[i]); } else if(Prot[i]==1){ X[F[i]]=max({X[F[i]]+Y[i], X[F[i]]+X[i], Y[F[i]]+X[i]}); Y[F[i]]=Y[F[i]]+Y[i]; } else{ X[F[i]]=max(X[F[i]]+Y[i], Y[F[i]]+X[i]); Y[F[i]]=Y[F[i]]+Y[i]; } } return max(X[0],Y[0]); }
#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...