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 ...
随机推荐
- MARK ZUCKERBERG, A letter to our daughter(转)
A letter to our daughter MARK ZUCKERBERG·WEDNESDAY, DECEMBER 2, 2015 Dear Max, Your mother and I ...
- (DP)51NOD 1049 最大子段和
N个整数组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的连续子段和的最大值.当所给的整数均为负数时和为0. 例如:-2,11,-4,13,-5 ...
- vue.js学习文档
1.实例化vue对象 new Vue(){ } 2.对象属性 el: 控制的属性 data: 数据存储位置 methods: 方法存储位置 template: 模板样式 computed: 计算属性 ...
- [Qt Creator 快速入门] 第1章 Qt Creator简介
Qt Creator 是一个跨平台的.完整的 Qt 集成开发环境,其中包括了高级C++代码编辑器.项目和生成管理工具.集成的上下文相关的帮助系统.图形化调试器.代码管理和浏览工具等.这一章先对 Qt ...
- 数据结构之链式队列(C实现)
1.1 linkqueue.h #ifndef LINKQUEUE_H #define LINKQUEUE_H #include <stdio.h> #include <mallo ...
- mybatis之多个对象自动装配问题
因为业务的需要,所以我在一个方法中植入三个对象,但是mybatis并没有自动装配,结果并不是我想的那么美好,还是报错了.报错截图如下: <select id="GetOneBillPa ...
- netty 引用计数器 ,垃圾回收
netty 引用计数器 ,垃圾回收 https://blog.csdn.net/u013851082/article/details/72170065 Netty之有效规避内存泄漏 https://w ...
- IntelliJ IDEA jrebel 实现热部署
前提是能够访问登陆Facebook,有Facebook的账号(我注册了一个) 点击:https://my.jrebel.com 用Facebook登陆 之后按要求填写信息 然后获取激活码 打开 id ...
- PAT1021Deepset Root
题意: 连通则输出最深点.第一步找某个点的最深的,然后从这个最深的点查找其他最深点,做并集. 不连通则输出连通图个数. #include<iostream> #include<cst ...
- ElasticSearch 安装使用
安装: 1.下载ElasticSearch.解压到相关文件夹 2.运行elasticsearch.bat,启动程序 3.在浏览器输入:http://localhost:9200/,显示相关Es内容即安 ...