제출 #413741

#제출 시각아이디문제언어결과실행 시간메모리
413741Antekb친구 (IOI14_friend)C++14
100 / 100
31 ms3416 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ ll ans=0; vector<ll> w(n); for(int i=0; i<n; i++){ w[i]=confidence[i]; } for(int i=n-1; i>0; i--){ if(w[i]<0)continue; if(protocol[i]==0){ w[host[i]]-=w[i]; ans+=w[i]; } else if(protocol[i]==1){ w[host[i]]=max({w[host[i]], w[host[i]]+w[i], w[i]}); } else{ w[host[i]]=max(w[host[i]], w[i]); } } ans+=max(0ll, w[0]); return ans; }
#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...