제출 #61063

#제출 시각아이디문제언어결과실행 시간메모리
61063hamzqq9친구 (IOI14_friend)C++14
0 / 100
4 ms1068 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; #define st first #define nd second #define sz(x) (x.size()) #define pb push_back #define N 100005 int findSample(int n,int confidence[],int host[],int protocol[]) { int P[N],Q[N]={0}; for(int i=0;i<n;i++) P[i]=confidence[i]; for(int i=n-1;i>=0;i--) { int x=host[i]; int y=i; if(protocol[i]==0) { Q[x]=max(Q[x]+Q[y],P[y]+Q[x]); P[x]=P[x]+Q[y]; } if(protocol[i]==1) { P[x]=max(max(P[x]+Q[y],P[y]+Q[x]),P[x]+P[y]); Q[x]=Q[y]+Q[x]; } if(protocol[i]==2) { P[x]=max(P[y]+Q[x],P[x]+Q[y]); Q[x]=Q[x]+Q[y]; } } return max(P[0],Q[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...