A deco的abs
思路
设$delta_i==sz_isz_{i1}$,那么对于任意的$delta_i$很明显我们可以对其加上任意大小的$d$使其绝对值最小,并且由于其他所有数操作次数都是无限的,所以可以任意修改不影响相对大小关系，然后不断取最小值即可。
代码
1 

起时无数平民哭声高，落时几个帝王卷入波涛去
设$delta_i==sz_isz_{i1}$,那么对于任意的$delta_i$很明显我们可以对其加上任意大小的$d$使其绝对值最小,并且由于其他所有数操作次数都是无限的,所以可以任意修改不影响相对大小关系，然后不断取最小值即可。
1  #include <algorithm> 
因为可以交换无数次，所以可以枚举行数和右端点。
问题就转化为了类似广告牌问题。
开一个前缀和记录$sum_j$表示j为右端点的连续1的个数.
然后开一个桶，记录长度，更新答案即可。
1  #include <algorithm> 
没啥好说的,直接上trie树暴力匹配即可。注意由于每个序列只能选一次所以最后ans除以2.
1  #include <algorithm> 
很明显和最短路本身没啥关系。 把所有边的边权排个序，然后任意相邻的两条边如果边权之差大于$s$很明显就不能构造出这样的图，这时输出$1$即可。否则直接按照顺序用双指针记录重边然后连边，思路不难。
1  #include <algorithm> 
In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples. The cows are now tired of often being forced to take a particular path and want to build some new paths so that they will always have a choice of at least two separate routes between any pair of fields. They currently have at least one route between each pair of fields and want to have at least two. Of course, they can only travel on Official Paths when they move from one field to another.
Given a description of the current set of R (F1 <= R <= 10,000) paths that each connect exactly two different fields, determine the minimum number of new paths (each of which connects exactly two fields) that must be built so that there are at least two separate routes between any pair of fields. Routes are considered separate if they use none of the same paths, even if they visit the same intermediate field along the way.
There might already be more than one paths between the same pair of fields, and you may also build a new path that connects the same fields as some other path.
Line 1: Two spaceseparated integers: F and R
Lines 2..R+1: Each line contains two spaceseparated integers which are the fields at the endpoints of some path.
Line 1: A single integer that is the number of new paths that must be built.
题目来源：
In ZJNU, there is a wellknown prairie. And it attracts pleasant sheep and his companions to have a holiday. Big big wolf and his families know about this, and quietly hid in the big lawn. As ZJNU ACM/ICPC team, we have an obligation to protect pleasant sheep and his companions to free from being disturbed by big big wolf. We decided to build a number of unit fence whose length is 1. Any wolf and sheep can not cross the fence. Of course, one grid can only contain an animal.
Now, we ask to place the minimum fences to let pleasant sheep and his Companions to free from being disturbed by big big wolf and his companions.
There are many cases.
For every case:
N and M（N,M<=200）
then N*M matrix:
0 is empty, and 1 is pleasant sheep and his companions, 2 is big big wolf and his companions.
For every case:
First line output “Case p:”, p is the pth case;
The second line is the answer.