当前位置:网站首页>[learning notes] differential constraint
[learning notes] differential constraint
2022-06-28 08:14:00 【Ants looking up at the stars】
The perfect combination of graph theory and inequality .
- If you find the maximum value of the difference between two variables , Then find the shortest path , Form like x i + d ≥ x j x_i+d\geq x_j xi+d≥xj
- If you find the minimum value of the difference between two variables , Then find the longest way , Form like x i + d ≤ x j x_i+d\leq x_j xi+d≤xj
Talk nonsense
Wannafly challenge round 9E - Group by group
There's a long one for n Sequence of numbers A, Among them is m There are two restrictions , There are two conditions :
1、 For interval [l,r], Its interval elements are bitwise or equal to x.
2、 For interval [l,r], Its interval elements are bitwise AND and equal to x.
Find a sequence of numbers A, To satisfy a given m Conditions , Make sure there's a solution .
1<=n,m<=10^5, 1<=l<=r<=n, 0<=x<2^20
sol: Obviously, in terms of position . Then find the shortest path .
wait … direct spfa Too slow will T .
We can make the upper bound a little smaller .
For or for 0 Arithmetic , We know s[l~r]=0 .
For prefixes and sum[i] , hypothesis s[1~i] Yes x individual 0 . that sum[i]<=i-x .
We connect one directly from the source i-x The edge of , It can effectively reduce the number of iterations .
[POI2015] PUS
POI
First of all, the complexity problem is not considered , This is a difference constraint .
Then consider optimizing .
One is when building a map , The problem of too many edges , We use the segment tree to optimize the drawing .
The second problem is that the data is too large to run . We Optimize according to the particularity of the graph .
First of all d[i]=x , We throw away the negative side , That is, only the lower bound is preserved , Final back inspection .
This is the right side .
Second, if you have a positive ring , Output has no solution .
direct DAG Just run topology sorting .
边栏推荐
- Prometheus service discovery
- Redis cerebral fissure
- Connaissez - vous le protocole TCP (2)?
- 城联优品向英德捐赠抗洪救灾爱心物资
- [shangpinhui] project notes
- About using font icons in placeholder
- 券商注册开户靠谱吗?安全吗?
- Jenkins' common build trigger and hook services (V)
- SOC serial port configuration
- Is it reliable for the top ten securities companies to register and open accounts? Is it safe?
猜你喜欢
B_QuRT_User_Guide(27)
Image translation /transformer:ittr: unpaired image to image translation with transformers
MySQL row format parsing
SOC timer and interrupt configuration
三角变换公式
asp. Net registration page
Uvcgan: unt vision transformer cycle-consistent Gan for unpropared image-to-image translation
MySQL two table connection principle (understand join buf)
asp. Net datalist to display product information and pictures
Configuring multiple instances of MySQL under Linux
随机推荐
Usage record of Xintang nuc980: self made development board (based on nuc980dk61yc)
MySQL two table connection principle (understand join buf)
Study notes 22/1/19 and 22/1/20
安装nrm后,使用nrm命令报错internal/validators.js:124 throw new ERR_INVALID_ARG_TYPE(name, ‘string‘, value)
About RAC modifying scan IP
Introduction, compilation, installation and deployment of Doris learning notes
Trigonometric transformation formula
The micro kernel zephyr is supported by many manufacturers!
ROS 笔记(09)— 参数的查询和设置
Generation and verification of JWT token
设置cmd的编码为utf-8
B_ QuRT_ User_ Guide(28)
sql主从复制搭建
SOC timer and interrupt configuration
The solution of "user account control to continue, please enter administrator user name and password" appears in win10 Professional Edition
Doris学习笔记之介绍、编译安装与部署
Installing MySQL under Linux
Oracle RAC -- understanding of VIP
SLAM中常用的雅克比矩阵J
Connaissez - vous le protocole TCP (2)?