답안 #173054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
173054 2020-01-03T09:13:45 Z maximath_1 친구 (IOI14_friend) C++11
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
int findSample(int n, int c[], int h[], int p[]){
	int ans[n], alt[n];
	for(int i=0; i<n; i++) ans[i]=c[i];
	for(int i=n-1; i>0; i--){
		if(p[i]==0){
			ans[h[i]]+=alt[i];
			alt[h[i]]+=ans[i];
		}else if(p[i]==1){
			ans[h[i]]+=ans[i];
			alt[h[i]]+=alt[i];
		}else if(p[i]==2){
			ans[h[i]]=max(ans[h[i]]+alt[i], alt[h[i]]+ans[i]);
			alt[h[i]]+=alt[i];
		}
		ans[h[i]]=max(ans[h[i]], alt[h[i]]);
	}
	return ans[0];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -