제출 #422503

#제출 시각아이디문제언어결과실행 시간메모리
422503Andyvanh1친구 (IOI14_friend)C++14
19 / 100
1 ms460 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; #define vt vector #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,x) for(int (i) = 0; (i) < (x); (i)++ ) typedef long long ll; typedef long double ld; typedef vt<int> vi; typedef pair<int,int> pii; int dp[1002][2]; vi adjlist[1002]; void dfs_dp(int node, int par, int val[]){ dp[node][1] = val[node]; for(auto& e: adjlist[node]){ if(e!=par){ dfs_dp(e,node,val); dp[node][0] += max(dp[e][0],dp[e][1]); dp[node][1] += dp[e][0]; } } } int findSample(int n, int confidence[], int host[], int protocol[]){ for(int i = 1; i< n; i++){ adjlist[host[i]].pb(i); adjlist[i].pb(host[i]); } dfs_dp(0,-1,confidence); return max(dp[0][0],dp[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...