제출 #967517

#제출 시각아이디문제언어결과실행 시간메모리
96751712345678친구 (IOI14_friend)C++17
100 / 100
21 ms3560 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int nx=1e5+5; int p[nx], q[nx]; int findSample(int n,int confidence[],int host[],int protocol[]){ for (int i=0; i<n; i++) p[i]=confidence[i]; for (int i=n-1; i>0; i--) { if (protocol[i]==0) { p[host[i]]=p[host[i]]+q[i]; q[host[i]]=max(q[host[i]]+q[i], q[host[i]]+p[i]); } if (protocol[i]==1) { p[host[i]]=max({p[host[i]]+p[i], p[host[i]]+q[i], q[host[i]]+p[i]}); q[host[i]]=q[host[i]]+q[i]; } if (protocol[i]==2) { p[host[i]]=max(p[host[i]]+q[i], q[host[i]]+p[i]); q[host[i]]=q[host[i]]+q[i]; } } 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...