제출 #58617

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