제출 #114498

#제출 시각아이디문제언어결과실행 시간메모리
114498E869120친구 (IOI14_friend)C++14
100 / 100
31 ms3200 KiB
#include "friend.h" #include <iostream> #include <algorithm> using namespace std; int x1[100009], x2[100009]; int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i = 0; i < n; i++) x1[i] = confidence[i]; for (int i = n - 1; i >= 1; i--) { if (protocol[i] == 2) { int D1 = max({ x1[host[i]] + x2[i], x2[host[i]] + x1[i] }), D2 = x2[host[i]] + x2[i]; x1[host[i]] = D1; x2[host[i]] = D2; } if (protocol[i] == 1) { int D1 = max({ x1[host[i]] + x1[i], x1[host[i]] + x2[i], x2[host[i]] + x1[i] }), D2 = x2[host[i]] + x2[i]; x1[host[i]] = D1; x2[host[i]] = D2; } if (protocol[i] == 0) { int D1 = max({ x2[host[i]] + x1[i], x2[host[i]] + x2[i] }), D2 = x1[host[i]] + x2[i]; x1[host[i]] = D2; x2[host[i]] = D1; } } return max(x1[0], x2[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...