0x20 搜索
这里基本就是入门吧。
可达性统计 用bitset搞的判重,发现这东西是真好用哈,空间还小
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<map>
#include<bitset>
using namespace std; map<int,bool>mp[];
struct node
{
int x,y,next;
}a[];int len,last[];
void ins(int x,int y)
{
len++;
a[len].x=x;a[len].y=y;
a[len].next=last[x];last[x]=len;
} int top,sta[];
int ru[];
bitset<>s[];
int main()
{
int n,m;
scanf("%d%d",&n,&m);
len=;memset(last,,sizeof(last));
memset(ru,,sizeof(ru));
for(int i=;i<=m;i++)
{
int x,y;
scanf("%d%d",&x,&y);
if(mp[x][y]==false)
{
ins(y,x);ru[x]++;
mp[x][y]=true;
}
} top=;
for(int i=;i<=n;i++)
{
if(ru[i]==)sta[++top]=i;
s[i][i]=;
}
while(top!=)
{
int x=sta[top];top--;
for(int k=last[x];k;k=a[k].next)
{
int y=a[k].y;
ru[y]--;s[y]|=s[x];
if(ru[y]==)
sta[++top]=y;
}
}
for(int i=;i<=n;i++)printf("%d\n",s[i].count());
return ;
}
可达性统计
小猫爬山 就冲着Freda和rainbow这口狗粮随便写了。
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<map>
#include<bitset>
using namespace std; int n,W,mmin;
int c[],d[];
void dfs(int k,int sp)
{
if(sp>=mmin)return ;
if(k==n+)
{
mmin=sp;
return ;
}
for(int i=;i<=sp;i++)
if(d[i]+c[k]<=W)
{
d[i]+=c[k];
dfs(k+,sp);
d[i]-=c[k];
}
d[sp+]=c[k];
dfs(k+,sp+);
}
int main()
{
scanf("%d%d",&n,&W);
for(int i=;i<=n;i++)scanf("%d",&c[i]);
d[]=;mmin=n;dfs(,);
printf("%d\n",mmin);
return ;
}
小猫爬山
数独那题不大想做啊。
0x20 搜索的更多相关文章
- Centos6 yum安装openldap+phpldapadmin+TLS+双主配置
原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...
- openldap+phpadmin的搭建安装
1.概念介绍 LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根据 ...
- OpenLDAP介绍和安装
LADP 1.目录服务 目录是一个为查询.浏览和搜索而优化的专业分布式数据库,它呈树状结构组织数据,就好象Linux/Unix系统中的文件目录一样.目录数据库和关系数据库不同,它有优异的读性能,但写性 ...
- 制作chm无搜索标签解决方法
chm无搜索标签解决方法: 1.hpp文件中设置Full-text search=Yes 2.下面[windows]有个数字设置为0x420, 网上普通流传的是0x20 === chm制作一般要三个文 ...
- 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")
一.准备工作: 安装pywin32,后面开发需要pywin32的支持,否则无法完成与windows层面相关的操作. pywin32的具体安装及注意事项: 1.整体开发环境: 基于windows7操作系 ...
- grep精确匹配搜索某个单词的用法 (附: grep高效用法小结))
grep(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正 ...
- hash算法搜索获得api函数地址的实现,"kernel32.dll", "CreateThread"
我们一般要获得一个函数的地址,通常采用的是明文,例如定义一个api函数字符串"MessageBoxA",然后在GetProcAddress函数中一个字节一个字节进行比较.这样弊端很 ...
- IDA断点和搜索
一.断点 调试很重要一点是下断点,看看IDA提供的功能,本来已经和WinDbg一样强了. 官方文档的变化 Edit breakpoint Action name: BreakpointEdit Con ...
- SQLSERVER走起微信公众帐号已经开通搜狗微信搜索
SQLSERVER走起微信公众帐号已经开通搜狗微信搜索 请打开下面链接 http://weixin.sogou.com/gzh?openid=oIWsFt-hiIb_oYqQHaBMoNwRB2wM ...
随机推荐
- SwiftUI 官方教程(七)
7. 给子 View 传递数据 LandmarkDetail 现在依然使用硬编码的数据来显示地标.像 LandmarkRow 一样,LandmarkDetail 类型和它组合的其他 view 都需要一 ...
- H3BPM实例分享——金额规则大写
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...
- 3、Collection接口中的功能概述
package cn.itcast_01; import java.util.ArrayList; import java.util.Collection; /** * 集合: * 由于我们使用的是面 ...
- hiho一下 第173周
题目1 : A Game 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi and Little Ho are playing a game. Ther ...
- vue 脚手架 使用步骤
当我知道搭建脚手架得使用命令行的时候.我就崩溃了.所以写一篇记录以后留着自己用也方便大家. 首先要安装一个node 环境, 1.打开cmd 进到你要建项目的目录: E: ...
- 使用Word 2010群发邮件
1.建立数据库,这里我使用了excel 字段:电子邮件地址,名字 填写需要发送的数据 2.新建word文档,这里我使用了word2010 点击工具栏邮件 开始邮件合并,电子邮件 选择收件人,使用现有列 ...
- spring中quatz的多定时任务配置图文详解
近来公司让用quatz框架做定时功能,而且还是执行多定时任务,真是苦恼. 虽然从网上搜了很多资料,但是写法上不太尽如人意,最后还是请教了螃蟹大神,给的配置建议就是简单啊,现在拿来分享下: 这里我们需要 ...
- <td colspan="6"></td>代表这个td占6个td的位置
<td colspan="6"><span class="order-time">2017-10-11 14:55:23</spa ...
- ubuntu18.0安装redis
ubuntu版本:Ubuntu-Server 10.04.1 LTS redis版本:4.0.9 安装 使用apt安装 sudo apt-get update sudo apt-get install ...
- PHP 7 的五大新特性
1. 运算符(NULL 合并运算符) 把这个放在第一个说是因为我觉得它很有用.用法: $a = $_GET['a'] ?? 1; 它相当于: <php $a = isset($_GET['a'] ...