Shortest Path 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5636 Description There is a path graph G=(V,E) with n vertices. Vertices are numbered from 1 to n and there is an edge with unit length between i and i+1 (1≤i<n). To make the graph more in…
Shortest Path Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1146 Accepted Submission(s): 358 Problem Description There is a path graph G=(V,E) with n vertices. Vertices are numbered from 1 to…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5636 题解: 1.暴力枚举: #include<cmath> #include<cstdio> #include<iostream> #include<algorithm> using namespace std; typedef long long LL; ; ; int n, m; ], b[]; int main() { int T; scanf(&qu…
题目链接 HDU5636 n个点,其中编号相邻的两个点之间都有一条长度为1的边,然后除此之外还有3条长度为1的边. m个询问,每次询问求两个点之前的最短路. 我们把这三条边的6个点两两算最短路, 然后询问的时候用这6个点的距离来更新答案就可以了. (不过听说好像有更好的方法,先占个坑) 时间复杂度$O(216m)$ #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <=…
题目链接:pid=3631" style="font-size:18px">http://acm.hdu.edu.cn/showproblem.php?pid=3631 Shortest Path Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3962 Accepted Submission(s): 9…
Shortest Path Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u SubmitStatus Description When YY was a boy and LMY was a girl, they trained for NOI (National Olympiad in Informatics) in GD team. One day, GD team's coach, Prof. G…
The Shortest Path in Nya Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description This is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que camb…