제출 #54720

#제출 시각아이디문제언어결과실행 시간메모리
54720SpaimaCarpatilor친구 (IOI14_friend)C++17
100 / 100
37 ms5512 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; int p[100009], q[100009]; int findSample (int N, int confidence[], int host[], int protocol[]) { for (int i=0; i<N; i++) p[i] = confidence[i], q[i] = 0; for (int i=N - 1; i>0; i--) { int j = host[i], oldP = p[j], oldQ = q[j]; if (protocol[i] == 0) p[j] = oldP + q[i], q[j] = oldQ + max (p[i], q[i]); else if (protocol[i] == 1) p[j] = max ({oldP + p[i], oldP + q[i], oldQ + p[i]}), q[j] = oldQ + q[i]; else p[j] = max (oldP + q[i], oldQ + p[i]), q[j] = oldQ + 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...