首页 > TAG信息列表 > 787D

CodeForces 787D : Legacy 线段树优化建图 + 最短路

传送门 题意 分析 线段树优化建图的板子题 我们把区间映射到线段树的一个一个点上,然后建两颗线段树,第一颗线段树自上向下建边,边权为0,第二颗线段树自下往上建边,边权为0,这样就可以做到两颗线段树内的点互相走通 然后操作2可以在第一个线段树内加边,操作3可以在第二个线段树内加

Legacy CodeForces - 787D

原题链接 考察:线段树+最短路 思路:   线段树优化建边的模板题,基本参考了大佬博客,私以为这个是讲得最好的. GO   关于为什么出树是由子到父,因为入树必然是父节点到子节点,而为了搭配入树只能是子节点到父节点. Code #include <iostream> #include <cstring> #include <alg

CodeForces - 787D.Legacy前向星线段树建图+dij

题目链接https://codeforces.com/contest/787/problem/D time limit per test:2 seconds memory limit per test:256 megabytes Rick and his co-workers have made a new radioactive formula and a lot of bad guys are after them. So Rick wants to give his legacy to Mort