Submission #432994

#TimeUsernameProblemLanguageResultExecution timeMemory
432994REALITYNBFriend (IOI14_friend)C++17
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define F first #define S second #define mp make_pair #include "friend.h" using namespace std; const int N = 3e5+1 ; int findSample(int n , int* v, int* p , int* protocol ){ vector<int> adj[n] ; for(int i=1;i<n;i++) adj[p[i]].push_back(i) ; function<int(int,int)> dfs = [&](int a , int s){ int sum=(s?v[a]:0); for(int x: adj[a]){ sum+=dfs(x,s^1) ; } return sum ; }; return max(dfs(0,0),dfs(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...