Flight HDU - 3499 (分层最短路)】的更多相关文章

Recently, Shua Shua had a big quarrel with his GF. He is so upset that he decides to take a trip to some other city to avoid meeting her. He will travel only by air and he can go to any city if there exists a flight and it can help him reduce the tot…
题意: 给你一幅图,然后起点终点,然后有一个条件是可以使某条边的花费减半,求最短路的最小花费. 思路: (来自大哥) 最短路的时候多一维,途中是否有花费减半的边: 然后转移,如果上一条有减半的,这一条一定只能转移到不能减半,上一条没有减半的,这一条可以减半也可以不减半. 具体处理就是一个二维的处理,网上说分层图,其实我感觉就是DP的思想,还有有一种从一张图跑到另一张图的feel. 后来wa了,就是挫在初始化,还有数据要LL,哎,艹!: 贴一发自己的挫code- #include<cstdio>…
1.状压bfs 这个状压体现在key上  我i们用把key状压一下  就能记录到一个点时 已经拥有的key的种类 ban[x1][y1][x2][y1]记录两个点之间的状态 是门 还是墙 还是啥都没有 inc[x][y]记录这个点所存储的钥匙  (可能不止一个 所以要用二进制) vis[x][y][key]  标记当前点 在拥有的钥匙种类为key时是否走过 #include <iostream> #include <cstdio> #include <sstream>…
Hunter Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2014    Accepted Submission(s): 615 Problem Description One day, a hunter named James went to a mysterious area to find the treasures. Jame…
就是在最短路的基础上   多加了一个时间的限制 , 多一个限制多一维就好了  记住 分层最短路要用dijistra !!! #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include <set> #include <vector> #in…
https://nanti.jisuanke.com/t/31001 题意 可以把k条边的权值变为0,求s到t的最短路 解析  分层最短路  我们建立k+1层图 层与层之间边权为0,i 向 i+1层转移,代表用了一条免费边. #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fi first #define se second #define all(a) (a).begin(), (a).en…
题意: 给你边权,起点和终点,有k次机会把某条路变为0,问你最短路是多长. 思路: 分层最短路模板题.题目有点坑(卡掉了SPFA,只能用dijkstra跑的算法). #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; ,INF=~; int N,M,K; int S,T; *MAXM*(MAXK+)+MAXK+];)+]; voi…
链接:https://ac.nowcoder.com/acm/contest/904/D 来源:牛客网 DongDong坐飞机 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 愿时间过得慢一些,让我记住他的一颦一笑--DongDong DongDong家的萨摩耶去国外读书了,DongDong非常想他,决定假期坐飞机去看望他,DongDong想合理使用手上的飞机折扣让自己不要吃土.给定n…
<题目链接> 题目大意: 现在给你一些点,这些点之间存在一些有向边,每条边都有对应的边权,有一次机会能够使某条边的边权变为原来的1/2,求从起点到终点的最短距离. 解题分析: 分层图最短路模板题,由于最多只能将一条边变成原来的1/2,所以我们在原来二维的图形上多加一层,由第一层到第二层的边代表该边边权为原边权的1/2.就按这种思想跑一遍Dijkstra即可. #include <cstdio> #include <cstring> #include <algori…
Flight Time Limit : 20000/10000ms (Java/Other)   Memory Limit : 65535/65535K (Java/Other) Total Submission(s) : 5   Accepted Submission(s) : 1 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Recently, Shua Shua had a big…