The biggest stream problem is very bare, but pay attention to the heavy edge. O (negative □negative) O is overcast to WA, and long is used.
# Include <cstdio> # include <cstring> # include <cmath> # include <algorithm> # include <climits> # include <string> # include <iostream> # include <map> # include <cstdlib> # include <list> # include <set> # include <queue> # include <stack> using namespace STD; typedef long ll; const int maxn = 205; const int maxm = 205; const int INF = int_max/2; ll flow [maxn] [maxn], c [maxn] [maxn]; int n, m; void input () {memset (C, 0, size Of (c); For (INT I = 1; I <= m; I ++) {int A, B, C; scanf ("% d", & A, & B, & C); C [a] [B] + = C ;}} ll Alpha [maxn]; int pre [maxn]; int Q [maxn + 20], QS, QE; void solve () {int S = 1, t = n; memset (flow, 0, sizeof (flow); While (1) {for (INT I = S + 1; I <= T; I ++) Pre [I] =-2; pre [s] =-1; Qs = 0; Qe = 1; Q [QS] = s; Alpha [s] = 1e13; while (QS <QE & Pre [T] =-2) {int v = Q [QS]; QS ++; For (INT I = s; I <= T; I ++) {If (PR E [I] =-2 & C [v] [I]-flow [v] [I]! = 0) {Alpha [I] = min (alpha [v], C [v] [I]-flow [v] [I]); Pre [I] = V; Q [QE ++] = I ;}}if (pre [T] =-2) break; For (INT I = T; Pre [I]! =-1; I = pre [I]) {flow [pre [I] [I] + = Alpha [T]; flow [I] [pre [I] =-flow [pre [I] [I] ;}} ll ans = 0; For (INT I = s; I <t; I ++) ans + = flow [I] [T]; printf ("% LLD \ n", ANS);} int main () {While (scanf ("% d", & M, & N )! = EOF) {input (); solve ();} return 0 ;}