摘要: 直接写个RMQ就能过。#include#include#include#include#include#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a)<(b)?(a):(b))#define Maxn 60010using namespace std;int maxnum[Maxn][20],minnum[Maxn][20],n,Log[Maxn+10];int Log2(int x){ int num=0; x/=2; while(x) { num++; x/=2; } ... 阅读全文
posted @ 2013-07-29 20:14 fangguo 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 思路:我们需要判断是否有满足的a[n],其实也就是对每一个二进制位进行判断,看是否有满足的。那么我们每次取出一个二进制位,这样每一位只有0,1两种状态,就成了比较典型的2-SAT问题了。#include#include#include#include#include#define Maxn 1010#define Maxm Maxn*Maxnusing namespace std;int vi[Maxn],head[Maxn],dfn[Maxn],low[Maxn],e,n,lab,top,num,m,id[Maxn],Stack[Maxn],B[510][510];struct Edge{ 阅读全文
posted @ 2013-07-29 16:44 fangguo 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 思路:就是找能走的走,遍历一边所有情况,满足就退出。Accepted4284328MS2280K2239 BC++//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #define Maxn 110#define Maxm 6000#define LL int#define inf 100000000#define Abs(a) (a)>0?(a):(-a)using namespace std;in 阅读全文
posted @ 2013-07-29 14:42 fangguo 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 裸的网络流,递归的dinic会爆栈,在第一行加一句就行了#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #define Maxn 120010#define Maxm 210000#define LL int#define inf 100000000#define Abs(a) (a)>0?(a):(-a)using namespace std;struct Edge{ int from,to,nex 阅读全文
posted @ 2013-07-29 14:36 fangguo 阅读(217) 评论(0) 推荐(0) 编辑