Tags: des blog HTTP Io ar OS for SP strong Choose the best route
Time limit: 1000 ms
Memory limit: 32768kb
64bit Io format: % I64d % i64usubmit status practice HDU 2680
Description One day, Kiki wants to visit one of her friends. as she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. now give you a map of the city's traffic route, and the stations which are near Kiki's home so that she can take. you may sup
Choose the best routetime limit: 1000 msmemory limit: 32768 kbthis problem will be judged on HDU. Original ID: 2680
64-bit integer Io format: % i64d Java class name: Main one day, Kiki wants to visit one of her friends. as she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. now give you a map of the city's traffic route, and the stations which are near Kiki's home so that she can take. you may suppose Kiki can c
Choose the best routeTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 10287 Accepted Submission (s): 3317Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the lea
Choose the best routeTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 10619 Accepted Submission (s): 3423Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the lea
visit her friends, but the goods are easy to get carsick, so find a route that takes the least time. Now give you the roadmap to find a route that takes the least amount of time from the starting point near her home (there can be multiple) to the terminal near the friend's home (only one). Each site is numbered from 1 to N. idea: At first I was directly without the brain using the DIJ algorithm to do the results in the slightest surprise (TLE), fuck. Look at other people's thinking to build sho
Choose the best routeTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total Submission (s): 10782 Accepted Submission (s): 3491Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the least
University Computer Research and Examination (machine test part)--Full true simulationTest instructions: A person, to take the bus to work. Always have n stations, M route, known he can from the W stations to travel, to arrive at the destination s the minimum time spent. If not, then output-1.Parse: Dijkstra algorithm, but the direct use of W-Dijkstra, will time out. Here are two ideas:1. Set the person's location to site 0, then connect the site 0 and the W starting point, which is equivalent
http://acm.hdu.edu.cn/showproblem.php?pid=2680Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the least time Kiki needs to spend. To make it easy, if the city has n bus stations, the stations would been expressed
to join the queue, if you do not need to repeat the queue to join. Because it was the last value that was updated when he was taken out. This avoids repeated operations over and over again. The inverse of the bellman-ford is not optimized, for each side of the n-1 times to relax, so as to try to update the shortest distance of the end of each edge, and SPFA directly from the beginning of the starting point to find the adjacent side, determine whether it can be updated, and determine whether to
Choose the best routeTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 10690 Accepted Submission (s): 3454Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the least
Link: Click to open linkThe main idea:Enter N,m,s, which represents n points, m edges, and s represents the end point. Then input the side, each side input p,q,t;p,q represents two points, T is the edge right, notice that the topic is from P point to Q side, it should establish a directed graph. Then enter W to indicate that there is a W starting point, and then enter the starting point, and for multiple starting points, if you use a SPFA for each starting point, then the starting point can be a
http://acm.hdu.edu.cn/showproblem.php?pid=2680Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the least time Kiki needs to spend. To make it easy, if the city has n bus stations, the stations would been expressed
("%d%d%d", n, s, m))The end is M, the farthest point is n{Memset(MPInf,sizeof(MP));While(s--){int aBC;scanf("%d%d%d", a, b, c);If(MP[A][b]>c) MP[A][b]=c;}int D;Number of start pointsscanf("%d", d);While(d--){int x;Starting pointscanf("%d", x); Mp[0][x]=0;will be able to do the starting point is connected to the ' 0 ', and are assigned a value of 0, does not affect the subsequent operation, to ensure that there is only one starting point ' 0 '}int k=dijstra () ; if (K==infprintf ( "-1 \n "); else
Title: Click to open linkCode:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Hdu Oj 2680 Choose the best route
Because there are multiple starting points, so what?1: Reverse build (personal feeling trouble)2: Building a super starting pointI used the second, simple rough, that is, a new starting point (0), he and all the topic of the beginning of the link, and the distance is 0, and then the template walk#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. HDU 2680 Choose the best route
Choose the best routeTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 7671 Accepted Submission (s): 2524Problem Descriptionone Day, Kiki wants to visit one of her friends. As she is liable to carsickness, she wants to arrive at her friend's home as soon as possible. Now give your a map of the city ' s traffic route, and the stations which is near Kiki's home so, she can take. Suppose Kiki can change the bus at any station. Please find the leas
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.