제출 #168612

#제출 시각아이디문제언어결과실행 시간메모리
168612johutha친구 (IOI14_friend)C++14
0 / 100
2 ms380 KiB
#include "friend.h" #include <vector> #include <iostream> #include <algorithm> #define int int64_t using namespace std; // Find out best sample signed findSample(signed n, signed confidence[], signed host[], signed protocol[]) { vector<int> take; for (int i = 0; i < n; i++) take.push_back(confidence[i]); vector<int> nottake(n, 0); for (int i = n - 1; i > 0; i--) { int hs = host[i]; if (protocol[i] == 0) { take[i] += nottake[hs]; nottake[i] += max(take[hs], nottake[hs]); } else if (protocol[i] == 1) { take[i] = max(take[i] + max(take[hs], nottake[hs]), nottake[i] + take[hs]); nottake[i] += nottake[hs]; } else { take[i] = max(take[i] + nottake[hs], take[hs] + nottake[i]); nottake[i] += nottake[hs]; } } return max(take[0], nottake[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...