Revizia anterioară Revizia următoare
Fişierul intrare/ieşire: | patrol2.in, patrol2.out | Sursă | IIOT 2022-23 Runda I |
Autor | Edoardo Morassutto | Adăugată de | |
Timp execuţie pe test | 0.5 sec | Limită de memorie | 65536 kbytes |
Scorul tău | N/A | Dificultate | N/A |
Vezi solutiile trimise | Statistici
Patrol2
Valerio is robbing a bank, but an alarm started ringing as he was trying to break into the caveau.
He needs to get out as fast as possible through the twisted sewer tunnels running nearby the bank.
The police is already looking for him and has sent K patrols, indexed from 0 to K-1 to guard the manholes connected to the sewer system.
There are N manholes, indexed from 0 to N-1 and M tunnels connecting pairs of them. Valerio's friend Filippo is waiting for him nearby manhole N-1, if he can reach it, he will escape safely.
Valerio starts from manhole 0 and, every minute, he can choose to move to a manhole adjacent to the one he is in or to stay another minute under the same manhole.
Each police patrol guard L i manholes, indexed from 0 to L i-1. Patrol i is initially guarding manhole H i,0, every minute it moves from manhole H i,j to manhole H i,j+1, after reaching manhole H i,Li-1, it return to manhole H ~i,0 .
Date de intrare
Fişierul de intrare patrol2.in ...
Date de ieşire
În fişierul de ieşire patrol2.out ...
Restricţii
- ... ≤ ... ≤ ...
Exemplu
patrol2.in | patrol2.out |
---|---|
This is some text written on multiple lines. | This is another text written on multiple lines. |
Explicaţie
...