제출 #162098

#제출 시각아이디문제언어결과실행 시간메모리
162098oolimry친구 (IOI14_friend)C++14
100 / 100
91 ms3064 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int notake[100005]; int findSample(int n, int take[], int host[], int protocol[]) { for(int v = n-1;v >= 1;v--){ int u = host[v]; if(protocol[v] == 0){ //I Am Your Friend take[u] += notake[v]; notake[u] += max(take[v],notake[v]); } else if(protocol[v] == 1){ //My Friends Are Your Friends take[u] = max(take[u]+take[v],max(take[u]+notake[v],notake[u]+take[v])); notake[u] += notake[v]; } else{ take[u] = max(take[u]+notake[v],notake[u]+take[v]); notake[u] += notake[v]; } } return max(take[0],notake[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...