Diferente pentru problema/tarnacop intre reviziile #1 si #4

Nu exista diferente intre titluri.

Diferente intre continut:

== include(page="template/taskheader" task_id="tarnacop") ==
Due to excessive mining, the mine shafts near Targu Mures have been flooded by an underground river. The mine shafts can be considered as a graph with $N$ vertices ({$N$} rooms) and $M$ edges ({$M$} corridors between the rooms). The room where the accident occurred (where the underground river enters the mine shafts) is known, and we shall refer to it as room $S$. Giugudel has come to give aid to the mine workers, bringing along his magic pickaxe. Using it, he managed to dig a leak for the underground river, leak which is located in room $D$. Giugudel knows for each corridor the capacity (number of cubic meters of water that **can** pass through it during one second), and the actual quantity of water that passes thorough the corridor. Obviously, this quantity is less or equal to the capacity. Giugudel knows the number of cubic meters of water that pass in each second through the leak in room $D$, and would be interested in knowing for each corridor, if its capacity would be decreased by one, if the water quantity that is flushed through room $D$ would also decrease.
Datorita sapaturilor excesive, galeriile miniere ale orasului Targu Mures au fost inundate de un rau subteran. Galeriile miniere pot fi considerate ca un graf cu $N$ noduri ({$N$} camere) si $M$ muchii ({$M$} coridoare intre camere). Se stie camera unde s-a produs accidentul (pe unde intra raul subteran in galerii), o vom nota pe aceasta cu $S$. Giugudel a venit in ajutorul minerilor impreuna cu tarnacopul sau magic. El a reusit astfel sa sape o gura de scurgere pentru apa din galerii, gura de scurgere aflandu-se in camera $D$. Acum, Giugudel stie pentru fiecare coridor capacitatea (numarul de metri cubi de apa ce **pot** trece intr-o secunda prin acel coridor) si cantitatea de apa ce trece prin acel coridor. Evident, aceasta cantitate va fi mai mica decat capacitatea. Giugudel stie numarul de metri cubi de apa ce se scurg in fiecare secunda prin camera $D$, si este curios sa afle pentru fiecare coridor, daca i-ar scadea capactitatea cu o unitate, daca ar scadea si capacitatea de apa ce se scurge in fiecare secunda prin camera $D$.
h2. Input
h2. Date de intrare
The input file $tarnacop.in$ will contain on the first line four integers $N,M,S,D$, with their meaning described above. Each of the following $M$ lines will contain a quadruplet of the type $X,Y,C,I$, describing a corridor between rooms $X$ and $Y$, of $C$ capacity, through which pass $I m^3^$ of water every second.
Fişierul de intrare $tarnacop.in$, va contine pe prima linie numerele $N,M,S,D$ cu semnificatia din enunt. Pe fiecare dintre urmatoarele $M$ linii se va gasi cate un cvadruplet de forma $X,Y,C,I$, cu semnificatia ca exista un coridor intre camerele $X$ si $Y$, de capacitate $C$, prin care trec in fiecare secunda $I m^3^$ de apa.
h2. Output
h2. Date de ieşire
The output file $tarnacop.out$ will contain on its first line an integer number $K$, describing the number of edges with the property requested in the problem's statement. On each of the following $K$ lines there will be a pair of ingeres $X,Y$ describing the fact that the edge form $X$ to $Y$ has the requested property. The edges must be written in increasing $X$ order, and in case of equal $X-es$, increasing $Y$ order.
Fişierul de ieşire $tarnacop.out$ va contine pe prima linie un numar natural $K$, reprezentand numarul muchiilor cu proprietatea ceruta in enunt. Pe fiecare dintre urmatoarele $K$ linii se va gasi cate o pereche de numere natural $X,Y$, reprezentand faptul ca muchia de la $X$ la $Y$ are proprietatea din enunt. Muchiile trebuie afisate crescator dupa $X$, si in caz de egalitate, crescator dupa $Y$.
h2. Restrictions
h2. Restricţii
* $1 ≤ S, D ≤ N ≤ M ≤ 100 000$
* $1 ≤ S, D ≤ N ≤ 100 000$
* $1 ≤ M ≤ 300 000$
* $S ≠ D$
* $0 ≤ I ≤ C ≤ 5 000 000$
* Water can flow through a corridor only in the direction given in the input (for an edge $X,Y$, water will always flow from $X$ to $Y$)
* There won't be more than one edge between any two vertexes
* There won't be an edge from a vertex to itself
* Muchiile de capacitate $0$ nu pot fi micsorate
* Pentru orice camera diferita de $S$ si $D$, suma cantitatilor de apa care intra in camera este egala cu suma cantitatilor de apa care ies.
* Apa poate curge pe un coridor doar in directia precizata in input (pentru o muchie $X,Y$ apa va curge tot timpul dinspre $X$ spre $Y$)
* Cantitatea de apa ce se scurge prin $D$ este maxim posibila
* Nu vor exista mai multe muchii intre doua noduri
* Nu va exista o muchie de la un nod la el insusi
h2. Example
h2. Exemplu
table(example). |_. tarnacop.in |_. tarnacop.out |
| 4 4 1 4
1 2
|
== include(page="template/taskfooter" task_id="tarnacop") ==
== include(page="template/taskfooter" task_id="tarnacop") ==
 

Nu exista diferente intre securitate.

Diferente intre topic forum:

 
7760