제출 #163152

#제출 시각아이디문제언어결과실행 시간메모리
163152mhy908친구 (IOI14_friend)C++14
100 / 100
44 ms4216 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; typedef long long LL; LL chose[100010], nochose[100010]; int findSample(int n, int con[], int host[], int proto[]) { for(int i=0; i<n; i++){ chose[i]=(LL)con[i]; } for(int i=n-1; i>=1; i--){ LL c1=chose[host[i]], n1=nochose[host[i]], c2=chose[i], n2=nochose[i]; if(proto[i]==0){ chose[host[i]]=c1+n2; nochose[host[i]]=max(c2+n1, n1+n2); } if(proto[i]==1){ chose[host[i]]=max(c1+c2, max(c1+n2, n1+c2)); nochose[host[i]]=n1+n2; } if(proto[i]==2){ chose[host[i]]=max(c1+n2, c2+n1); nochose[host[i]]=n1+n2; } } return (int)max(chose[0], nochose[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...