제출 #1042731

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