Bounty Hunter II

Time Limit: 5000ms
Memory Limit: 262144KB

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的更多相关文章

  1. CodeForcesGym 100753B Bounty Hunter II 二分图最小路径覆盖

    关键在建图 题解:http://www.cnblogs.com/crackpotisback/p/4856159.html 学习:http://www.cnblogs.com/jackiesteed/ ...

  2. How to become a successful bug bounty hunter

    出处:https://www.hackerone.com/blog/become-a-successful-bug-bounty-hunter 如果你梦想成为赏金猎人,你的梦想就会成真 - 不要把你的 ...

  3. csu1527: Bounty Hunter

    Time Limit:5000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu Submit Status id=134 ...

  4. German Collegiate Programming Contest 2015(第三场)

    Divisions David is a young boy and he loves numbers. Recently he learned how to divide two numbers.D ...

  5. 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\ ...

  6. Bug Bounty Reference

    https://github.com/ngalongc/bug-bounty-reference/blob/master/README.md#remote-code-execution Bug Bou ...

  7. ARTIFICIAL INTELLIGENCE FOR GAMES (Ian Millington / John Funge 著)

    相关网站:http://www.ai4g.com PART I AI AND GAMESCHAPTER1 INTRODUCTIONCHAPTER2 GAME AIPART II TECHNIQUESC ...

  8. 五、Pandas玩转数据

    Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...

  9. Gson解析Json数组

    需求:从steam官网获取英雄数据,即为Json数据,并导入到本地数据库 Json数据是这样的 { "result": { "heroes": [ { &quo ...

随机推荐

  1. hdu3018 Ant Trip (并查集+欧拉回路)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3018 题意:给你一个图,每条路只能走一次.问至少要多少个人才能遍历所有的点和所有的边. 这是之前没有接 ...

  2. yii int

    @echo off rem ------------------------------------------------------------- rem Yii command line ini ...

  3. DHTML_____window对象的事件

    <html> <head> <meta charset="utf-8"> <title>window对象事件</title&g ...

  4. jquery实现文字自动向上滚动,鼠标放上去停止,移开继续滚动代码...

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. 创建 pulic dblink 使不同的用户可以访问dblink

    1. system: grant create public database link to ivrsdata; 2.userdate: tnsnames.ora config db connect ...

  6. JavaScript 把函数作为参数进行传值

    JavaScript 响应式编程模式有点类似 WebForm 中的事件驱动模式(传相应的处理函数给委托,通过事件来触发来进行相关的处理),在 AngularJs 2.x 框架中,应用了 RxJS AP ...

  7. IFormattable,ICustomFormatter, IFormatProvider接口

    定                 义 1.IFormattable   提供一种功能,用以将对象的值格式化为字符串表示形式. 2.IFormatProvider  提供用于检索控制格式化的对象的机制 ...

  8. 树莓派连接arduino(USB串口通讯)

    2018-06-0115:12:19 https://blog.csdn.net/song527730241/article/details/50884890 重要步骤  查看端口:(ttyUSB0或 ...

  9. 可滚动的ResultSet类型 实现分页

    可滚动的ResultSet类型. 这个类型支持前后滚动取得纪录next().previous(),回到第一行first(),同时还支持要取的 ResultSet中的第几行 absolute(int n ...

  10. ArcGIS 坐标系 整理

    刚使用ArcGIS的时候,对坐标系的点一直很混乱,今天想要整理整理. 一.地理坐标系与投影坐标系的区分 首先要能区分地理坐标系(GCS)和投影坐标系(PCS). 上面的是地理坐标系的举例,简单理解为不 ...