제출 #119075

#제출 시각아이디문제언어결과실행 시간메모리
119075Mamnoon_Siam친구 (IOI14_friend)C++17
100 / 100
31 ms3448 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 1e5 + 5; int findSample(int n, int confidence[], int host[], int protocol[]){ ll w[maxn], tot = 0; for(int i = 0; i < n; i++) w[i] = confidence[i]; for(int i = n - 1; i >= 1; i--) { int A = host[i], B = i; if(protocol[i] == 0) { w[A] -= w[B]; w[A] = max(w[A], 0LL); tot += w[B]; } else if(protocol[i] == 1) { w[A] += w[B]; } else { w[A] = max(w[A], w[B]); } } return tot + w[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...