传送门

和10-17 B 君的第三题 类似,应该算是简化版,给出了固定的点。

f[s]表示只考虑连端都在s集合中的边,s中的固定点(1或者2)能到达整个集合的方案数。

预处理c[s]表示s集合中的总边数,转移就用所有方案减去s集合中有一部分不能到达的方案,也就是枚举一个子集作为能到达的,这个子集的补集和子集之间的边方向确定了,补集内的边随便选,也就和无向图每条边选或者不选等价了。

和无向图不同的是,1能到达的点的集合为s1,2能到达的点的集合为s2的时候,(s1,s2的补集内的边随便定向,补集和s1,s2之间的边方向唯一确定),s1中的任意点不能于s2中的点有连边,因为一个点x不在s2中表明它到s2集合内的点的边都是指向s2的,那么x若在s1中,s1和s2就联通了。

一开始一直wa三个点,因为我固定一个点的时候枚举子集可以为0但是我跳出了。。。

 //Achen
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
#define Formylove return 0
const int N=,p=1e9+;
typedef long long LL;
typedef double db;
using namespace std;
int n,m,a[],b[],mp[][];
LL pr[],c[N],f[N],to[N];
LL ans; template<typename T> void read(T &x) {
char ch=getchar(); x=; T f=;
while(ch!='-'&&(ch<''||ch>'')) ch=getchar();
if(ch=='-') f=-,ch=getchar();
for(;ch>=''&&ch<='';ch=getchar()) x=x*+ch-''; x*=f;
} //#define ANS
int main() {
#ifdef ANS
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
#endif
read(n); read(m);
pr[]=;
For(i,,) pr[i]=2LL*pr[i-]%p;
For(i,,m) {
read(a[i]); read(b[i]);
mp[a[i]][b[i]]++;
mp[b[i]][a[i]]++;
c[pr[a[i]-]+pr[b[i]-]]++;
}
For(i,,n) {
For(j,,n) if(mp[i][j]) to[pr[i-]]|=pr[j-];
}
int up=pr[n]-;
For(i,,n-) For(s,,up) {
if(!(s&pr[i])) {
c[s|pr[i]]+=c[s];
to[s|pr[i]]|=to[s];
}
}
//For(i,1,up) printf("%d : %d\n",i,to[i]);
f[]=f[]=;
For(s,,up) {
LL t=;
for(int ss=((s-)&s);ss;ss=((ss-)&s)) {
if((!(s&)&&(s&)&&!(ss&)&&(ss&))||(!(s&)&&(s&)&&!(ss&)&&(ss&)))
t=(t+f[ss]*pr[c[s^ss]]%p)%p;
}
if((!(s&)&&(s&))||(!(s&)&&(s&))) f[s]=(pr[c[s]]-t+p)%p;
}
For(s,,up) if((s&)&&!(s&)) {
int S=(up^s)-;
for(int ss=S;;ss=((ss-)&S)) {
if((s&to[up^s^ss])!=||((up^s^ss)&to[s])!=) {
if(!ss) break; else continue;
}
ans=(ans+f[s]*f[up^s^ss]%p*pr[c[ss]]%p)%p;
if(!ss) break;
}
}
printf("%lld\n",(pr[m]-ans+p)%p);
Formylove;
}

I - Nice to Meet You的更多相关文章

  1. tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []

    tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end w ...

  2. bzoj1787 [Ahoi2008]Meet 紧急集合

    1787: [Ahoi2008]Meet 紧急集合 Time Limit: 20 Sec  Memory Limit: 162 MB Submit: 2272  Solved: 1029 [Submi ...

  3. 【BZOJ-1787&1832】Meet紧急集合&聚会 倍增LCA

    1787: [Ahoi2008]Meet 紧急集合 Time Limit: 20 Sec  Memory Limit: 162 MBSubmit: 2259  Solved: 1023[Submit] ...

  4. How to disable Passwords must meet complexity requirements[windows 7]

    The Password complexity is a Local Policy setting named "Passwords must meet complexity require ...

  5. Codeforces Round #325 (Div. 2) F. Lizard Era: Beginning meet in the mid

    F. Lizard Era: Beginning Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  6. bzoj 1787 [Ahoi2008]Meet 紧急集合(1832 [AHOI2008]聚会)

    1787: [Ahoi2008]Meet 紧急集合 Time Limit: 20 Sec  Memory Limit: 162 MBSubmit: 1841  Solved: 857[Submit][ ...

  7. hadoop权威指南 chapter1 Meet Hadoop

    Meet Hadoop 1.1 Data!(数据) Most of the data is locked up in the largest web properties (like search e ...

  8. BZOJ 1787: [Ahoi2008]Meet 紧急集合( 树链剖分 )

    这道题用 LCA 就可以水过去 , 但是我太弱了 QAQ 倍增写LCA总是写残...于是就写了树链剖分... 其实也不难写 , 线段树也不用用到 , 自己YY一下然后搞一搞就过了...速度还挺快的好像 ...

  9. Meet Apache Wicket

    第一次接触Wicket,如此多的内容是文字,的原贴,希望大家指正 Meet Apache Wicket By JonathanLocke, original author of Wicket 乔纳森· ...

  10. 1787: [Ahoi2008]Meet 紧急集合

    1787: [Ahoi2008]Meet 紧急集合 Time Limit: 20 Sec  Memory Limit: 162 MBSubmit: 1482  Solved: 652[Submit][ ...

随机推荐

  1. linux基础知识-常用命令

    ifconfig :查看当前ip hostname:查看主机名 vim /etc/hosts:修改地址映射 service iptables status : 查看防火墙状态 chkconfig ip ...

  2. window环境mysql卸载不干净

    停止MySQL服务1添加删除程序中卸载MySQL2到安装目录删除MySQL3删除:C:\Documents and Settings\All Users\Application Data\MySQL ...

  3. http协议和file协议的区别

    1.在本地直接使用浏览器打开  html文件 和 通过本地服务器打开  html文件  有什么区别呢.  https://segmentfault.com/q/1010000006554881/a-1 ...

  4. flask中的目录解析

    首先我们看一下博客blog的封面,flask和django都属于web框架.不过flask属于轻量级web框架,功能的实现是通过扩展实现的,extension.py 中存放各个对象,具体的功能通过对象 ...

  5. Data URL scheme 笔记

    0x01起因 今天做CTF的时候,发现一堆数据,大概是这样的 data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAIUAAACFCAYAAAB12js8AAA ...

  6. <读书笔记>《JS DOM编程艺术》

    2016/03/04 12:00 第一二章:JS的简史以及基本语法 1.P11 2.variable 3.P13    等于 4.P13 5.P14 转义字符 6.关联数组不是一个好习惯 7.P18 ...

  7. vue父组件与子组件之间的数据传递

    父组件向子组件传递数据 父组件用数据绑定:子组件用props接收 <!-- test-vue-model父组件 --> <template> <div> <m ...

  8. EF复合主键

    [Key,Column(Order = )] [Key,Column(Order = )]

  9. python 模拟双色球输出

    编写Python函数:完成一个双色球彩票的模拟生成过程, 其中前六个为红色球,数字范围1-33,不可重复.最后一个为蓝色球 1-16. import random #red_nums是采集红色球的数字 ...

  10. SpringBoot+Thymeleaf+iView

    SpringBoot+Thymeleaf参考: https://www.cnblogs.com/kibana/p/10236187.html 1.Controller: package cn.mmwe ...