
差分
ToheartZhang
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
NOIP2012 Day2 T2 借教室
碰到区间问题要想到差分。 此题一开始想成[1, n]二分,原因是读题不认真,题目要求按订单一个个顺序判断,只要有一个不符合就打回去,不用管后面的,所以是[1, m]满足单调性,故二分订单。#include<cstdio> #include<cstring> #include<iostream> using namespace std; const int maxn = 1000010; int n原创 2017-07-23 16:05:46 · 393 阅读 · 0 评论 -
CodeVS 1242 布局
//差分约束系统 //以x-y <= k为例,等价于x <= k+y,相当于x和y之间的连边最大权值为k,然后跑最短路即知最大解。 //好久不做CodeVS了,洛谷大法好! #include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; queue<int> q; int n, m1, m2, tot; bool f原创 2017-08-24 10:46:16 · 313 阅读 · 0 评论