제출 #137708

#제출 시각아이디문제언어결과실행 시간메모리
137708mohammedehab2002친구 (IOI14_friend)C++11
100 / 100
37 ms2680 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int a[],int p[],int t[]) { int ans=0; for (int i=n-1;i>=0;i--) { if (a[i]<0) continue; if (!t[i]) { ans+=a[i]; a[p[i]]-=a[i]; } else if (t[i]==1) a[p[i]]=max(a[p[i]],0)+a[i]; else a[p[i]]=max(a[p[i]],a[i]); } return ans+max(a[0],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...