제출 #102781

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