差分约束的md

This commit is contained in:
ljcjames 2022-08-15 21:52:38 +08:00
parent 3dd15fd977
commit 3fc223a5ce
2 changed files with 20 additions and 0 deletions

BIN
8.15/-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

20
8.15/Readme.md Normal file
View File

@ -0,0 +1,20 @@
# 差分约束
* https://vjudge.net/contest/509525#discuss
### 题意
不明所以
### 做法
* x1-x2<=w
* x1<=x2+w
* dist[v]<=dist[u]+w
* add(x2,x1,w);
* x1-x2>=1? add(x1,x2,-1);
* 最短路->最大值,反之亦然
![-1的示意图](-1.png)
### 关键词
数学最短路spfa
### 易错点
* 隐藏条件
* 构图
### 工具箱
* PPT