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 "friend.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define vi vector<int>
using namespace std;
vi G[1300];
int arr[1300], arr1[1300];
bool vis[1300];
int dfs(int node){
for(auto v : G[node]){
if(vis[v]) continue;
vis[v] = 1;
if(arr[v] == -1 || dfs(arr[v])){
arr[v] = node;
return 1;
}
}
return 0;
}
int findSample(int n,int confidence[],int host[],int protocol[]){
memset(arr, -1, sizeof arr);
for(int i = 1; i < n; i++){
if(protocol[i] == 0){
G[host[i]].pb(i);
G[i].pb(host[i]);
arr1[i] = arr1[host[i]] ^1;
}
else{
for(int v : G[host[i]]){
G[i].pb(v);
G[v].pb(i);
}
arr1[i] = arr1[host[i]];
}
}
int ans = n;
for(int i = 0; i < n; i++){
if(arr1[i] == 0){
memset(vis, false, sizeof vis);
ans -= dfs(i);
}
}
return ans;
}
# | 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... |