이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "friend.h"
const int maxn = 1e3+10;
vector <int> edge[maxn];
int hi[maxn];
bool vis[maxn];
int col[maxn];
int dfs(int u) {
for (int v:edge[u]) {
if (vis[v]==1) continue;
vis[v] = 1;
if (hi[v]==-1 or dfs(hi[v])) {
hi[v] = u;
return 1;
}
}
return 0;
}
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
memset(hi,-1,sizeof(hi));
rep(i,1,n) {
if (protocol[i]==0) edge[host[i]].pb(i),edge[i].pb(host[i]),col[i] = col[host[i]]^1;
else {
for (int v:edge[host[i]]) {
edge[i].pb(v);
edge[v].pb(i);
}
col[i] = col[host[i]];
}
}
int ans = n;
rep(i,0,n) if (col[i]==0) {
memset(vis,0,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... |