Delay Constrained Maximum Capacity Path Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 544    Accepted Submission(s): 192 Problem Description Consider an undirected graph with N vertices, nu…
昨天的题太水了,堆优化跑的不爽,今天换了一个题,1000000个点,1000000条边= = 试一试邻接表 写的过程中遇到了一些问题,由于习惯于把数据结构封装在 struct 里,结果 int [1000000] 导致 struct 爆栈,此问题亟待解决.. 实力碾压SPFA 2500 ms,有图为证 #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #d…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 题目大意:找点1到点n的最短路(无向图) 练一下最短路... dijkstra+队列优化: #include<iostream> #include<functional> #include<vector> #include<queue> using namespace std; typedef pair<int, int> p;//first是…
做这道题感觉异常激动,因为在下第一次接触拓扑排序啊= =,而且看了看解释,猛然发现此题可以用DP优化,然后一次A掉所有样例,整个人激动坏了,哇咔咔咔咔咔咔咔~ 咔咔~哎呀,笑岔了- -|| 旅行商(TSP) 描述 Shrek是一个大山里的邮递员,每天负责给所在地区的n个村庄派发信件.但杯具的是,由于道路狭窄,年久失修,村庄间的道路都只能单向通过,甚至有些村庄无法从任意一个村庄到达.这样我们只能希望尽可能多的村庄可以收到投递的信件. Shrek希望知道如何选定一个村庄A作为起点(我们将他空投到该村…
题目大意: 一共有N (1 ≤ N ≤ 1,000)个电线杆,有P P (1 ≤ P ≤ 10,000)对电线杆是可以连接的, 用几条线连接在一起的电线杆之间都可相互通信,现在想要使得电线杆1和电线杆N能相互通信, 并且电线公司提出KK (0 ≤ K < N)条电线是可以免费使用的, 当使用电线的数量超过K条,超出的电线要收费, 收的总费用为去掉免费使用的K条电线之后最长的那条电线的长度. 问最少费用是多少 Input * Line 1: Three space-separated intege…
Til the Cows Come Home Time Limit: 1000MS   Memory Limit: 65536K       http://poj.org/problem?id=2387 Description Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morni…
确定比赛名次 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 40   Accepted Submission(s) : 31 Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的…
Bessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an R (1 <= R <= 100) by C (1 <= C <= 100) grid of elevations E (-25 <= E <= 25). In order to joi…
//---基于邻接表的bfs #include <stdio.h> #include <string.h> #include <iostream> #include <string> #include <algorithm> #include <queue> using namespace std; struct node { int date; struct node *next; }*head[101], *tail[101];…
Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project. Input Specification: Each input file contains one test case. Each case starts with a line containing two positive integers N…