Print a fixed 4-vertex, 5-edge flow network; there is no input and the output is a single constant graph.
Easy3GraphBrute forceImplementationNo attempts yetTime limit2sMemory limit512 MBJigui always solves flow problems with the Edmond-Karp algorithm. One day Jigui saw a flow problem with 500 vertices and 100000 edges. Jigui built a flow graph, wrote about 2000 bytes of code, and submitted it, but the submission was not accepted. Tired of tuning the code, Jigui found Dinic's algorithm, whose worst-case time complexity is O(V2E).
Dinic's algorithm is as follows.
The O(V2E) bound is justified as follows.
Jigui implemented the algorithm carefully and still did not get an accepted verdict. Dotori looked at the code and pointed out a small mistake: when the search for an augmenting path starts, edges that cannot carry more flow are scanned from the beginning of the adjacency list every time. Jigui will not believe this until a small example graph is shown.
Help Dotori print that example graph. The graph to print is unique.
The problem Jigui is solving sends flow from vertex 1 to vertex N. Edges are stored in a linked list, and a new edge is inserted at the front of the list, so a later input edge is used first.
There is no input.
Print the number of vertices N and the number of edges M on the first line. N is 4 and M is 5.
Then print M lines, each with a start vertex s, an end vertex e, and a capacity f, in this order:
The graph has no duplicate edges. Each line prints the integers s, e, and f in that order, separated by spaces.