제출 #132254

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