脑洞+暴力。 因为边权是1,所以bfs一下,O(n^2)求任意两点间最短路,再枚举。 ans最大是\(dis_{s1,t1}+dis_{s2,t2}\) 再考虑有公共边的情况,一定存在两个点 u, v ,最后留下的边为(s1,u),(s2,u),(u,v),(v,t1),(...
2023-02-24编程教程Codeforces,Destroying,Roads传送门:>Here< 题意:给出一张无向图(边权为1),并给出两对起点和终点以及距离:s1,t1,l1; s2,t2,l2; 要求删除尽量多的边,使得dis(s1,t1)<=l1, dis(s2,r2)<=l2 解题思路 首先我们会发现,...
2023-02-24编程教程Codeforces543,Destroying,RoadsDestroying Roads 题目链接 题意 n个点,m条边每两个点之间不会有两个相同的边,然后给你两个起s1,s2和终点t1,t2; 求删除最多的边后满足两个s1到t1距离\(<=l1\),s2到t2的距离\(<=l2\) 求能删除最多的边。 ...
2023-02-24编程教程Destroying,RoadsD. Destroying Roads time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In some country there are exactly n cities and m bidirectional road...
2023-02-24编程教程CF544,Destroying,RoadsB - Destroying Roads 思路:这么菜的题我居然想了40分钟。。。 n^2枚举两个交汇点,点与点之间肯定都跑最短路,取最小值。 #include<bits/stdc++.h> #define LL long long #define fi first #define se se...
2023-02-24编程教程Codeforces,div,RoadsB. Destroying Roads time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In some country there are exactly n cities and m&nbs...
2023-02-24编程教程543.,Codeforces,Roads