洛谷传送门--分糖果 博客--链式前向星 团队中一道题,数据很大,只能用链式前向星存储,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'…