제출 #586529

#제출 시각아이디문제언어결과실행 시간메모리
586529SeDunion친구 (IOI14_friend)C++17
100 / 100
27 ms2236 KiB
#include "friend.h" #include<iostream> #include<assert.h> #include<vector> using namespace std; const int N = 1e5 + 123; int p[N], q[N]; 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 y = n - 1 ; y > 0 ; -- y) { int x = host[y]; if (protocol[y] == 0) { int np = p[x] + q[y]; int nq = max(q[x] + p[y], q[x] + q[y]); p[x] = np, q[x] = nq; } else if (protocol[y] == 1) { int np = max(max(p[x] + p[y], p[x] + q[y]), q[x] + p[y]); int nq = q[x] + q[y]; p[x] = np, q[x] = nq; } else { int np = max(p[x] + q[y], q[x] + p[y]); int nq = q[x] + q[y]; p[x] = np, q[x] = nq; } } 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...