제출 #422229

#제출 시각아이디문제언어결과실행 시간메모리
422229Ozy친구 (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 pares, impares; vector<lli> hijos[1002]; lli conf[1002]; void DFS(lli pos, lli padre, lli prof) { if (prof%2 == 0) pares += conf[pos]; else impares += conf[pos]; for (auto h : hijos[pos]) { if (h == padre) continue; DFS(h,pos,prof+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]; pares = 0; impares = 0; DFS(0,0,0); pares = max(pares,impares); return pares; }
#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...