普通的最短路...dijkstra水过.. ------------------------------------------------------------------------------ #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include<queue>   #define rep( i , n ) for( int i…
3408: [Usaco2009 Oct]Heat Wave 热浪 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 67  Solved: 55[Submit][Status][Discuss] Description Input  第1行:4个由空格隔开的整数T,C,Ts,Te.  第2到第C+1行:第i+l行描述第i条道路.有3个由空格隔开的整数Rs,Re,Ci. Output     一个单独的整数表示Ts到Te的最小费用.数据保证至少存在一条…
链接:https://ac.nowcoder.com/acm/contest/1082/F来源:牛客网 题目描述 The good folks in Texas are having a heatwave this summer. Their Texas Longhorn cows make for good eating but are not so adept at creating creamy delicious dairy products. Farmer John is leadin…
水题,裸的最短路. ; type link=^node; node=record t,d:longint; f:link; end; var n,m,s,i,j,u,v,w,max:longint; adj:array[..] of link; f:array[..] of longint; d,val:array[..] of longint; went:array[..] of boolean; procedure insert(f,t,d:longint); var p:link; beg…
最短路模板.选迪杰. #include<stdio.h> #include<string.h> #include<stdlib.h> #include<algorithm> #include<queue> //#include<iostream> using namespace std; int n,m,s,t; #define maxn 2511 #define maxm 12411 const int inf=0x3f3f3f3f…
01背包... ----------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<iostream>   #define rep( i , n ) for( int i = 0 ; i < n ; i++ ) #define clr( x , c )…
嗯... 题目链接:https://www.luogu.org/problem/P1339 这道题是水的不能在水的裸最短路问题...这里用的dijkstra 但是自己进了一个坑—— 因为有些城市之间可能还没有道路,自己只是将其初始化为0,而应该初始化为0x3f3f,从而表示两个城市之间没有道路... AC代码: #include<cstdio> #include<iostream> #include<algorithm> #include<cstring>…
AC代码 #include<bits/stdc++.h> using namespace std; const int MAXN=62000+10,INF=999999; struct Edge{ int u,v,w,next; }edge[MAXN]; int head[MAXN],n,m,s,t,dist[MAXN],cnt; bool vis[MAXN]; void addedge(int x,int y,int z){ edge[cnt].u=x; edge[cnt].v=y; edg…
P1339 [USACO09OCT]热浪Heat Wave 题目描述 The good folks in Texas are having a heatwave this summer. Their Texas Longhorn cows make for good eating but are not so adept at creating creamy delicious dairy products. Farmer John is leading the charge to delive…
Luogu P1339 热浪Heat Wave 裸·单源最短路. 但是! 有以下坑点: 算过复杂度发现Floyd跑不过去就不要用了. 如果建边是双向边,边的数组大小要开两倍! 考场上如果再把初始化的$dis[i]=INF$写成$dis[n]=INF$,或者忘记$dis[s]=0$之类的话,就直接火葬场了-- #include<bits/stdc++.h> #define N 2510 #define M 6210 #define INF 0x3f3f3f3f using namespace s…