제출 #293910

#제출 시각아이디문제언어결과실행 시간메모리
293910alexandra_udristoiu친구 (IOI14_friend)C++14
100 / 100
40 ms3576 KiB
#include "friend.h" #include<algorithm> using namespace std; static int d[100005][2]; int findSample(int n, int c[], int t[], int pr[]){ int i, x; for(i = 0; i < n; i++){ d[i][1] = c[i]; } for(i = n - 1; i >= 1; i--){ x = t[i]; if(pr[i] == 0){ d[x][1] += d[i][0]; d[x][0] += d[i][1]; } if(pr[i] == 1){ d[x][1] += d[i][1]; d[x][0] += d[i][0]; } if(pr[i] == 2){ d[x][1] = max(d[i][0] + d[x][1], d[i][1] + d[x][0]); d[x][0] += d[i][0]; } d[x][1] = max(d[x][1], d[x][0]); } return d[0][1]; }
#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...