Submission #742224

#TimeUsernameProblemLanguageResultExecution timeMemory
742224MODDIFriend (IOI14_friend)C++14
23 / 100
2 ms416 KiB
#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 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...