
最短路
yjt9299
这个作者很懒,什么都没留下…
展开
-
codeforces gym 100753e 简单最短路+恶心的超内存
Every day you drive to work using the same roads as it is the shortest way. This is efficient, but over time you have grown increasingly bored of seeing the same buildings and junctions every day. So ...原创 2018-07-13 11:56:41 · 384 阅读 · 2 评论 -
codeforces 787D (线段树建图+dij)
D. Legacytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRick and his co-workers have made a new radioactive formula and a lot o...原创 2018-07-31 12:46:47 · 848 阅读 · 1 评论 -
codeforces 230d(最短路+预处理)
链接: http://codeforces.com/problemset/problem/230/D题意: n个点 m 条边 现在你找到从1到n的最短路,但是这里有一个限制就是如果你在时间t到达节点u 如果有其他人也在这个时间到节点u 那么你就要等这个人走了之后才能离开u。思路: 对于每一个点开个vector 存其他人在什么时间到达,并且预处理出我如果在该时间到,我应该在什么时间离开。然后...原创 2018-09-06 23:24:39 · 724 阅读 · 2 评论 -
codeforces 1051F (树+ 最短路)
链接:http://codeforces.com/problemset/problem/1051/F题意: 现在给你n个点和m条边组成一个图,有q个询问每次问你从x点到y点的最短路径。但是这里有个限制条件就是m最多比n大20 而且保证一定联通。思路: 这个题当然就是抓住 m-n <=20 这个限制条件。 那么对于这个题,我如抽出来n-1条边组成一棵树,先不考虑剩下的边,那么问题就...原创 2018-09-21 19:12:34 · 582 阅读 · 0 评论 -
codeforces 938d D. Buy a Ticket
链接:http://codeforces.com/contest/938/problem/D题意: n个点 m 个边,并且每个点有个权值,你要对每个点求出 一个点j 使得dis[i,j]*2+a[j] 是最小的。思路: 建立一个超级源点 S 从S 向每个点建一条边 边权为该点的点权,然后跑个dij 就是答案。 不难理解。代码:#include<bits/stdc++.h...原创 2018-10-08 16:39:06 · 337 阅读 · 0 评论