제출 #154112

#제출 시각아이디문제언어결과실행 시간메모리
154112popovicirobert친구 (IOI14_friend)C++14
100 / 100
39 ms3576 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int confidence[],int host[],int protocol[]){ vector <int> p(n), q(n); for(int i = 0; i < n; i++) { p[i] = confidence[i]; } for(int i = n - 1; i > 0; i--) { int id = host[i], t = protocol[i]; int P = p[id], Q = q[id]; if(t == 0) { p[id] = q[i] + P; q[id] = max(Q + q[i], p[i] + Q); } if(t == 1) { p[id] = max(P + q[i], p[i] + max(P, Q)); q[id] = Q + q[i]; } if(t == 2) { p[id] = max(P + q[i], Q + p[i]); q[id] = Q + 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...