题意: 给了由n个数组成的一个数列,然后给你各种区间的和是大于ci还是小于ci啥的,最后问你是否冲突. 思路: 差分约束水题,不过wa了两次,原因处理区间问题的细节马虎了,说下建图吧,这个题目给的是大于或者小于,不是大于等于啥的,其实这个好办,直接进行相应的+-1就能添加等于号了,然后进行关系转换 假如输入的是 a b str c b = a + b + 1 //一开始忘记了区间的这个处理方法忘记+1 那么if(str[0] == g) b - a > c b - a >…
Burn the Linked Camp Time Limit: 2 Seconds Memory Limit: 65536 KB It is well known that, in the period of The Three Empires, Liu Bei, the emperor of the Shu Empire, was defeated by Lu Xun, a general of the Wu Empire. The defeat was due to Liu Be…
Code: #include<cstdio> #include<queue> #include<algorithm> using namespace std; const int N=500000+3; const int INF=-233333333+2; int head[N],to[N<<1],nex[N<<1],val[N<<1],d[N],inq[N]; queue<int>Q; int cnt,s,t,n; v…