제출 #28923

#제출 시각아이디문제언어결과실행 시간메모리
28923noobprogrammer친구 (IOI14_friend)C++14
100 / 100
36 ms3972 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std ; int p[100010] , q[100010] ; int findSample(int n,int confi[],int host[],int prt[]){ int ans = 0; for(int i = 0 ; i< n; i++) p[i] = confi[i] ; for(int i=n-1;i>0;i--){ int x = host[i] ; int y = i ; int u = 0 , nu = 0 ; if(prt[i] == 0){ u = p[x] + q[y] ; nu = max(p[y] + q[x] , q[x] + q[y]) ; } else if(prt[i] == 1){ u = max(max(p[x] + p[y] , p[x] + q[y]) , p[y] + q[x]) ; nu = q[x] + q[y] ; } else{ u = max(p[x] + q[y] , p[y] + q[x]) ; nu = q[x] + q[y] ; } p[x] = u ; q[x] = nu ; ans = max(ans , max(u , nu )) ; } 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...