当前位置:网站首页>[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 .
边栏推荐
- Is it reliable to open an account by digging money? Is it safe?
- App automated testing appium Tutorial Part 1 - advanced supplementary content
- 抗洪救灾,共克时艰,城联优品捐赠10万元爱心物资驰援英德
- 【js】-【节流、防抖函数】
- Configuring MySQL multi instance master-slave synchronization for Linux
- Unity - Pico开发 输入系统等相关API的使用---C#篇
- AI首席架构师8-AICA-高翔 《深入理解和实践飞桨2.0》
- Connaissez - vous le protocole TCP (2)?
- 软件测试与质量期末复习
- NLP sequence can completely simulate human brain intelligence
猜你喜欢

Activity隐式跳转

App automated testing appium Tutorial Part 1 - advanced supplementary content

Today's notes 22/1/7

Reverse mapping of anonymous pages

Doris学习笔记之介绍、编译安装与部署

Generation and verification of JWT token

SOC timer and interrupt configuration

你了解TCP协议吗(二)?

【js】-【DFS、BFS应用】-学习笔记

Host is not allowed to connect to this MySQL server
随机推荐
B_ QuRT_ User_ Guide(27)
挖财注册开户靠谱吗?安全吗?
Jacobian matrix J commonly used in slam
asp. Net datalist when there are multiple data displays
ROS notes (09) - query and setting of parameters
新唐NUC980使用记录:自制开发板(基于NUC980DK61YC)
nlp序列完全可以模拟人脑智能
Airflow2 configuration windows azure SSO details based on oauth2 protocol
In flood fighting and disaster relief, the city donated 100000 yuan of love materials to help Yingde
B_QuRT_User_Guide(27)
Prometheus monitoring (I)
2022巴黎时装周儿童单元6.19武汉站圆满落幕
asp. Net datalist to display product information and pictures
Dataset filling data, and the use of rows and columns
微内核Zephyr获众多厂家支持!
券商注册开户靠谱吗?安全吗?
关于在cmd中MySQL不能插中文数据的原因
Devops foundation chapter Jenkins deployment (II)
Airflow2.1.1 summary of the pits stepped on in actual combat!!
sql主從複制搭建