제출 #97409

#제출 시각아이디문제언어결과실행 시간메모리
97409MvC친구 (IOI14_friend)C++11
100 / 100
50 ms3516 KiB
#pragma GCC optimize("O3") #include "friend.h" #include<bits/stdc++.h> #define rc(x) return cout<<x<<endl,0 #define pb push_back #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; typedef long double ld; const ll INF=0x3f3f3f3f3f3f3f3f; const ll llinf=(1LL<<62); const int inf=(1<<30); const int nmax=1e5+50; const int mod=1e9+7; using namespace std; int f[nmax],g[nmax]; int findSample(int n,int c[],int host[],int pr[]) { int h,i; for(i=0;i<n;i++)f[i]=c[i]; for(i=n-1;i>0;i--) { h=host[i]; if(pr[i]==0) { f[h]=max(f[h]+g[i],f[i]+g[h]); g[h]=max(g[i]+g[h],f[i]+g[h]); } else if(pr[i]==2) { f[h]=max(f[h]+g[i],f[i]+g[h]); g[h]+=g[i]; } else { f[h]=max(max(f[h]+g[i],f[i]+g[h]),f[h]+f[i]); g[h]+=g[i]; } } return max(g[0],f[0]); } /*int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); return 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...