n m c the number of rivers, the no. of channels, the no. of confluences DMAX1 DA1 the maximum flow and the present entry flow for the first river ... DMAXn DAn the maximum flow and the present entry flow for the river no. n D1 CIN1 COUT1 the channel no. 1, between the confluences CIN1 and COUT1, with the maximum flow D1 ... Dm CINm COUTm the channel number m, between the confluences CINm and COUTm, with the maximum flow Dm
DR1 the flow of the first river ... DRn the flow of the river no. n DC1 the flow of the first channel ... DCm the flow of the channel no. m
INPUT.TXT 3 3 4 1000 100 1000 1100 500 1000 600 3 4 800 4 1 200 2 4 OUTPUT.TXT 800 900 500 500 700 200
Politehnica University, Bucharest.

n m
Player 1 is in a losing position.
Player 1 has a winning strategy.
x y, where x represents the number of stones extracted from the first heap, and y is the number of stones extracted from the second heap by the first player, at a move that will put the second player in a losing situation.
n1 m1, the number of stones left in the first heap (n1) and the number of stones left in the second heap after the first player's move (m1).
Input: 1 2 Output: Player 1 is in a losing position.
Input: 5 6 Output: Player 1 has a winning strategy. 0 3 5 3
"Grigore Moisil" High School, Iasi.

x1 y1 x2 y2 ... xn yn
NR.IN 7 NR.OUT 1 2