//这个是邻接矩阵的#include<iostream> #include<queue> #include<string.h> #include<stdio.h> #include<algorithm> using namespace std; ; const int inf=0x3f3f3f; int N; int depth[maxn]; int a[maxn][maxn]; bool bfs(int s,int e)//广搜求深度 { qu…
洛谷传送门--分糖果 博客--链式前向星 团队中一道题,数据很大,只能用链式前向星存储,spfa求单源最短路. 可做模板. #include <cstdio> #include <queue> #include <cstring> #include <algorithm> using namespace std; int n, p, c, ans, cnt; long long m; struct node { int to, next; }edge[];…
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17065 Accepted Submission(s): 8066 Problem Description Every time it rains on Farmer John's fields, a pond forms over Bessie'…