제출 #1042720

#제출 시각아이디문제언어결과실행 시간메모리
1042720jer033친구 (IOI14_friend)C++17
58 / 100
15 ms3428 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int confidence[],int host[],int protocol[]){ vector<int> lb(n, 0); vector<int> ub(n, 0); for (int i=0; i<n; i++) ub[i] = confidence[i]; for (int i=n-1; i>=1; i--) { int h = host[i]; int p = protocol[i]; if (p == 1) { lb[h] = lb[h]+lb[i]; ub[h] = ub[h]+ub[i]; } else if (p==2) { lb[h] = max(lb[h], lb[i]); ub[h] = max(ub[h], ub[i]); } else { lb[h] = lb[h] + ub[i]; ub[h] = ub[h] + lb[i]; ub[h] = max(ub[h], lb[h]); } } return max(lb[0], ub[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...