传送门

和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. java 读取html字符串替换字符

    import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org. ...

  2. VIM的一些使用积累

    替换: :s/cst/dst/gc 黏贴后格式不对齐: gg=G 全选并黏贴 gg :"+yG

  3. hdu 1402 A * B Problem Plus (FFT模板)

    A * B Problem Plus Problem Description Calculate A * B. Input Each line will contain two integers A ...

  4. Gson extend 思路

    package org.rx.core.internal; import com.google.gson.*; import net.sf.cglib.proxy.Enhancer; import n ...

  5. Windows下搭建Wampserver+Wordpress

    安装wordpress windows 下载安装包 百度云 提取码:qxzp 安装wamp WampServer就是Windows Apache Mysql PHP集成安装环境,即在window下的a ...

  6. 用processing生成屏保程序

    想法 利用随机数控制圆圈的大小.位置以及颜色,可以产生随机的美感. 让小球动起来,并且在屏幕边界处产生反弹效果. 代码 1: float circle_x = (float) 0.0; 2: floa ...

  7. 爬虫(四)—— 使用pyecharts展示数据

    pyecharts模块 pyecharts可以将数据形象的在页面中用图表显示 一.安装 pip install pyecharts 二.使用 import pyecharts # 创建一个页面 pag ...

  8. windows 安装虚拟环境

    步骤一:安装virtualenv 在windows cmd终端下使用输入:pip install virtualenv 步骤二:新建虚拟环境 在cmd终端输入virtualenv testvir(环境 ...

  9. ASE——第一次结对作业

    ASE--第一次结对作业 问题定义 很早就听说了MSRA的黄金点游戏,让大家写Bot来参加比赛看谁的AI比较聪明可以操盘割韭菜.深感ASE课程老师设计的任务太用心了,各种接口都准备好了,大家只用专注于 ...

  10. View Triggers Function Procedure

    check view total number select count(VIEW_NAME) from USER_VIEWS; check trigger total number select C ...