UVa 1025 (动态规划) A Spy in the Metro】的更多相关文章

题意: 有线性的n个车站,从左到右编号分别为1~n.有M1辆车从第一站开始向右开,有M2辆车从第二站开始向左开.在0时刻主人公从第1站出发,要在T时刻回见车站n 的一个间谍(忽略主人公的换乘时间).输出最少的等待时间,如果无解输出impossible. 分析: d(i, j)表示第i时刻在第j个车站,最少还需要的等待时间.边界是:d(T, n) = 0, d(T, i) = +∞ 预处理: has_train[t][i][0]数组是用来记录t时刻第i个车站是否有向右开的车,类似has_train…
[题目链接]:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3466 [题意] 有n个站台;(线性的); 每相邻两个站台之间的火车的行驶时间是固定的; 然后每天在第一个站台会向第n个站台的方向发出m1辆车; 最后一个站台会向第1个站台的方向发出m2辆车; 给出m1辆车是何时发出的,m2辆车是何时发出的(递增顺序给出); 然后有一个人要从1…
UVA - 1025 A Spy in the Metro Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City Metro, examining the time table. The Algorit…
A Spy in the Metro Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station o…
 UVA 1025 -- A Spy in the Metro  题意:  一个间谍要从第一个车站到第n个车站去会见另一个,在是期间有n个车站,有来回的车站,让你在时间T内时到达n,并且等车时间最短,输出最短等车时间. 思路:  先用一个has_train[t][i][0]来表示在t时刻,在车站i,是否有往右开的车.同理,has_train[t][i][1]用来保存是否有往左开的车. 用d(i,j)表示时刻i,你在车站j,最少还需要等待多长时间.边界条件是d(T,n)=0,其他d(T,i)为正无…
Problem UVA1025-A Spy in the Metro Accept: 713  Submit: 6160Time Limit: 3000 mSec Problem Description Input  Output For each test case, print a line containing the case number (starting with 1) and an integer representing the total waiting time in th…
A Spy in the Metro Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we nd her in the rst station of Algorithms City Metro, examining the time table. The Algorithms City Metro…
洛谷2583 地铁间谍(UVa1025A Spy in the Metro) 本题地址:http://www.luogu.org/problem/show?pid=2583 题目描述 特工玛利亚被送到S市执行一个特别危险的任务.她需要利用地铁完成他的任务,S市的地铁只有一条线路运行,所以并不复杂. 玛利亚有一个任务,现在的时间为0,她要从第一个站出发,并在最后一站的间谍碰头.玛利亚知道有一个强大的组织正在追踪她,她知道如果一直呆在一个车 站,她会有很大的被抓的风险,躲在运行的列车中是比较安全的.…
传送门 Description Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City Metro, examining the time table. The Algorithms City Metro…
传送门 参考资料: [1]:算法竞赛入门经典:第九章 DAG上的动态规划 题意: Algorithm城市的地铁有 n 个站台,编号为 1~n,共有 M1+M2 辆列车驶过: 其中 M1 辆列车从 1 号站台驶向 n 号站台,M2 辆列车从 n 号站台驶向 1 号地铁: (单程线,M1 辆列车到达 n 号站台后不会回返,同理 M2) 特工 Maria 要在 T 时刻到达 n 号站台与特务会面,但为了保证安全,在会面前尽量呆在行进的列车中: 现给出你这 M1+M2 辆列车的发车时刻: 问如何换乘列车…