At a glance, the minimum cut is converted to the maximum stream.
Then we found that the number of points reached 10 ^ 6, so we had to think further.
According to a large number of questions on the Internet, the maximum stream of an image is equal to the shortest path of its dual graph, so Dijkstra is enough.
Creating a graph is a bit disgusting... It took a long time to query...
1 /************************************************************** 2 Problem: 1001 3 User: rausen 4 Language: C++ 5 Result: Accepted 6 Time:520 ms 7 Memory:94588 kb 8 ****************************************************************/ 9 10 #include <cstdio> 11 #include <cstring> 12 #include <algorithm> 13 #include <queue> 14 15 using namespace std; 16 17 struct edges{ 18 int next, to, v; 19 } e[6000005]; 20 21 struct heap_node{ 22 int v, to; 23 }; 24 inline bool operator < (const heap_node &a, const heap_node &b){ 25 return a.v > b.v; 26 } 27 28 priority_queue View code
Bzoj1001 [beijing2006] Wolf catch rabbit