CodeForcesGym 100753B Bounty Hunter II
Bounty Hunter II
This problem will be judged on CodeForcesGym. Original ID: 100753B
64-bit integer IO format: %I64d Java class name: (Any)

#include <bits/stdc++.h>
using namespace std;
const int maxn = ;
vector<int>g[maxn];
int Link[maxn],n;
bool used[maxn];
bool match(int u){
for(int i = g[u].size()-; i >= ; --i){
if(used[g[u][i]]) continue;
used[g[u][i]] = true;
if(Link[g[u][i]] == - || match(Link[g[u][i]])){
Link[g[u][i]] = u;
return true;
}
}
return false;
}
int main(){
int m;
while(~scanf("%d",&n)){
for(int i = ; i < maxn; ++i) g[i].clear();
for(int i = ; i < n; ++i){
scanf("%d",&m);
for(int j = ,v; j < m; ++j){
scanf("%d",&v);
g[i].push_back(v + n);
}
}
memset(Link,-,sizeof Link);
int ret = ;
for(int i = ; i < n; ++i){
memset(used,false,sizeof used);
if(match(i)) ++ret;
}
printf("%d\n",n - ret);
}
}
/*
4
1 1
1 2
0
1 1 6
0
1 2
2 4 5
1 2
0
0 5
1 4
1 4
1 4
1 4
0
*/
CodeForcesGym 100753B Bounty Hunter II的更多相关文章
- CodeForcesGym 100753B Bounty Hunter II 二分图最小路径覆盖
关键在建图 题解:http://www.cnblogs.com/crackpotisback/p/4856159.html 学习:http://www.cnblogs.com/jackiesteed/ ...
- How to become a successful bug bounty hunter
出处:https://www.hackerone.com/blog/become-a-successful-bug-bounty-hunter 如果你梦想成为赏金猎人,你的梦想就会成真 - 不要把你的 ...
- csu1527: Bounty Hunter
Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu Submit Status id=134 ...
- German Collegiate Programming Contest 2015(第三场)
Divisions David is a young boy and he loves numbers. Recently he learned how to divide two numbers.D ...
- 2015 German Collegiate Programming Contest (GCPC 15) + POI 10-T3(12/13)
$$2015\ German\ Collegiate\ Programming\ Contest\ (GCPC 15) + POI 10-T3$$ \(A.\ Journey\ to\ Greece\ ...
- Bug Bounty Reference
https://github.com/ngalongc/bug-bounty-reference/blob/master/README.md#remote-code-execution Bug Bou ...
- ARTIFICIAL INTELLIGENCE FOR GAMES (Ian Millington / John Funge 著)
相关网站:http://www.ai4g.com PART I AI AND GAMESCHAPTER1 INTRODUCTIONCHAPTER2 GAME AIPART II TECHNIQUESC ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- Gson解析Json数组
需求:从steam官网获取英雄数据,即为Json数据,并导入到本地数据库 Json数据是这样的 { "result": { "heroes": [ { &quo ...
随机推荐
- 多条件查询测试用例设计方法(1)—Pairwise(转)
在我的工作中,我也遇到类似需求.正交法是一种不错的选择,而在我们实践过程中,我们还用了Pairwise方法,以及另一种方法(如下): 假设查询因子:A,B,C,D,E 1.单独查询:A:B:C:D:E ...
- Python基础 — Pandas
Pandas -- 简介 Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的. Pandas ...
- P2476 [SCOI2008]着色方案
传送门 数学太珂怕了--膜一下->这里 记\(sum[i]\)为题中\(c[i]\)的前缀和,\(C[i][j]\)表示\(C_{i}^j\) 设\(f[i][j]\)表示前面\(i\)中颜色已 ...
- mongodb海量数据CRUD优化
1. 批量保存优化 避免一条一条查询,采用bulkWrite, 基于ReplaceOneModel,启用upsert: public void batchSave(List<?> spoT ...
- HDU 1879(最小生成树)
#include "iostream" #include "algorithm" #include "cstdio" using names ...
- 解决前后端分离的“两次请求”引出的Web服务器跨域请求访问问题的解决方案
在前后端分离的项目中,前端和后端可能是在不同的服务器上,也可以是Docker上,那就意味着前端请求后端Restful接口时,存在跨域情况. 后端在做了通用的跨域资源共享CORS设置后,前端在做ajax ...
- 64位linux安装wine等软件
我的系统是centos7 64位的,安装wine的时候以为和32位的一样,结果执行./configure的时候,出现错误(无法建立一个32位程序,您需要安装32位的开发库) configure: er ...
- bootstrap3无间距栅格/grid no-gutter
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- 【转】jvm类加载
类加载机制 JVM把class文件加载的内存,并对数据进行校验.转换解析和初始化,最终形成JVM可以直接使用的Java类型的过程就是加载机制. 类从被加载到虚拟机内存中开始,到卸载出内存为止,它的生命 ...
- 国外一些好用的UX/UI设计工具和资源介绍
你今天使用的设计工具也许不再适合以后的网页和APP设计项目了.新的工具不断的推出市场,目标只有一个,让你的工作更快.更容易而且工作成效更好.以下就是各种工具的介绍入口,当您点击标题就会看到各种很好的工 ...