This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "friend.h"
using namespace std;
vector<int> graph[1001];
bool seen[1001];
int dfs(int curr , int tag){
seen[curr] = 1;
int ret = 0;
if(tag == 0){
ret = 1;
}
for(auto i : graph[curr]){
if(seen[i]){
continue;
}
ret += dfs(i,1-tag);
}
return ret;
}
int findSample(int n , int confidence[] , int host[] , int protocol[]){
for(int i = 1 ; i < n ; i += 1){
if(protocol[i] == 1){
graph[host[i]].push_back(i);
graph[i].push_back(host[i]);
}else{
for(auto j : graph[host[i]]){
graph[i].push_back(j);
graph[j].push_back(i);
}
}
}
int num = dfs(1,0);
return max(num,n-num);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |