Submission #422267

#TimeUsernameProblemLanguageResultExecution timeMemory
422267OzyFriend (IOI14_friend)C++17
0 / 100
1 ms332 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define lli long long int #define debugsl(a) cout << #a << " = " << a << ", " #define debug(a) cout << #a << " = " << a << endl lli dp[1002][2]; vector<lli> hijos[1002]; lli conf[1002]; void DFS(lli pos, lli padre) { for (auto h : hijos[pos]) { if (h == padre) continue; DFS(h,pos); dp[pos][1] += dp[h][0]; dp[pos][0] += max(dp[h][0], dp[h][1]); } } int findSample(int n,int confidence[],int host[],int protocol[]){ rep(i,1,n-1) { hijos[i].push_back(host[i]); hijos[host[i]].push_back(i); } rep(i,0,n-1) conf[i] = confidence[i]; DFS(0,0); lli a = max(dp[0][0],dp[0][1]); return a; }
#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...