A solo trip
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 23391 Accepted Submission(s): 8140
Then there was T That's ok . There are three integers on each line a,b,time, Express a,b The distance between cities is time Hours ;(1=<(a,b)<=1000;a,b There may be multiple paths between them )
The next step is T+1 Yes S Number , It means the city connected with cao'er's family .
The next step is T+2 Yes D Number , Where does Cao Er want to go .
6 2 3
1 3 5
1 4 7
2 8 12
3 8 4
4 9 12
9 10 2
8 9 10
Shortest path problem , There is no negative value ,dijkstra Algorithm , Priority queue implementation
dijkstra The idea is in this picture
Attach code ：
#define inf 0x3fffffff
using namespace std;
friend bool operator<(node a,node b)
int dijkstra(int star,int end)
} return x;
while(scanf("%d %d %d",&t,&s,&d)!=EOF)
scanf("%d %d %d",&a,&b,&time);
if(map[a][b]>time)// There may be multiple paths to choose the smallest
if(a>max_road)//max_road,min_road Just to shorten the time
- hdu 2066 A solo trip Dijkstra
Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=2066 Problem analysis : Take Caoer family as the starting point , Give the time of arrival between cities , Give the city that cao'er wants to go to , The shortest time . A typical single source is the most ...
- HDU 2066 A solo trip (Dijkstra Algorithm ）
A solo trip Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submis ...
- hdu 2066 A solo trip
Topic linking http://acm.hdu.edu.cn/showproblem.php?pid=2066 A solo trip Description Although cao'er is a road maniac ( I have been in Hangdian for more than a year , I'm still crazy on campus ...
- HDU 2066 A solo trip （dijkstra Water problem + Judge heavy side ）
Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=2066 The main idea of the topic : Multiple groups of input data , The first line of each group is three integers T,S and D, Express T Strip road , The cities adjacent to Caoer's home are ...
- HDU 2066 A solo trip 【Dijkstra 】
The question : give s A starting point ,d It's a destination , Ask the shortest distance from the beginning to the end Because there are many starting points , So set the values of these starting points to 0 Ah = = I've changed it for a long time = = Because it's in the code t, I don't know why to call dijkstra() After the function ...
- hdu 2066 A solo trip Problem solving report
Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=2066 The title mean : give T Strip road , The city number adjacent to Caoer's house , And the number of the place where grass wants to go . What do you want to go from Caoer's home to Caoer's ...
- hdu - 2066 A solo trip ( The shortest path of the foundation )
http://acm.hdu.edu.cn/showproblem.php?pid=2066 The shortest distance between the city and grass is 0, Then proceed dijkstra, stay t You can find the nearest one among the cities . #inc ...
- HDU 2066 A solo trip - from lanshui_Yang
Problem Description Although cao'er is a road maniac ( I have been in Hangdian for more than a year , Even people who get lost on campus , Khan, ~), But cao'er still likes traveling very much , Because on the journey I'll meet a lot of people ( Prince charming ,^0^), A lot of things , It's also abundant ...
- hdu 2066 A solo trip （ Shortest path problem ）
shortest path ································· There are a lot of similar problems that won't ! Learn slowly !!!!. progress , Even a little every day ! ( Love is not a small thing , It's really the accumulation of small things !( Listen to cool dog music , very ...
- CSS3 text-shadow
<!DOCTYPE html > <html > <head> <meta charset="utf-8"> <title&g ...
- About Memcache mutex design-mode .net Realization
I've seen it online before memcache-mutex Scene analysis and implementation code , There will be .net The way to achieve it , Of course, here is mainly based on the original pseudo code , Take this as a summary and record . If you are interested in the implementation, try the code provided in this article ...
- docker( 6、 ... and ) Use docker-maven-plugin Plug in build docker Mirror image ( Deprecated )
You can refer to the blog :https://blog.csdn.net/aixiaoyang168/article/details/77453974 docker-maven-plugin The official website recommends using it in new projects do ...
- Functional programming - First glance F#
A large number of books on functional programming languages will eventually be used Fuctor,Monad,Monoids, Category theory and other words scare away imperative language players , So I try to avoid these problems , Uncovering the practical results of these complex words . In addition, I will try to use C ...
- STM32——C Language knowledge points ： The pointer 、 Structure
/* ============================================================================ Name : Cyuyanfuxi.c ...
- Use AdminLTE stay content District , Open the corresponding page
Reference resources :https://bbs.csdn.net/topics/391846671 ask : Like opening starter.html, Then click on the link in the left column ( Such as user.html) When , How to achieve... On the right cont ...
- Shell Script Hello World
#!/bin/bash echo "Hello World !" “#!” It's an agreed mark , It tells the system what interpreter is needed to execute this script , That is, what kind of Shell.echo The command is used to show the window ...
- .net Use minimal heap to implement TopN Algorithm
Test code : using System; using System.Collections.Generic; using System.Linq; using System.Text; namespac ...
- Prototype In depth exploration of
- css There are three basic positioning mechanisms in
css There are three basic positioning mechanisms in a. Normal document flow b. location : Relative positioning Absolute positioning Fixed position c. float 1. In the ordinary stream , Element location is determined by document order and element properties , Block level elements are arranged from top to bottom , The vertical distance between the frames is determined by the vertical distance between the frames mar ...