摘要: 思路:当k为1的时候,用二分法查询包含有f个空瓶的上界r,然后更新会方便很多,直接更新区间(a,r)了。#include#include#include#include#include#define lson(x) (x>1)#define inf 1=tree[po].r) { ans+=tree[po].r-tree[po].l+1-tree[po].left; tree[po].left=tree[po].r-tree[po].l+1; tree[po].up=1; return ; } down(po); ... 阅读全文
posted @ 2013-07-26 14:18 fangguo 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 思路:把所有涉及到的点按(x+y)的奇偶分成两部分点,对所有的1*2的骨牌,都有(x+y)为偶数的建到奇数的边。求一次最大匹配,就是答案。#include#include#include#include#include#define Maxn 2010using namespace std;int match[Maxn],map[Maxn][Maxn],vi[Maxn],ny,nx,graphic[Maxn][Maxn];struct Point{int x, y;}hori[Maxn],vert[Maxn];void init(){ memset(map,0,sizeof(map));... 阅读全文
posted @ 2013-07-26 09:02 fangguo 阅读(165) 评论(0) 推荐(0) 编辑