- Time limit: N/A
- Memory limit: N/A
Kotivalo haluaa saada paremman käsityksen alueesta ja on lähettänyt sinne $100$ laskuvarjorobottia. Jokainen robotti laskeutuu ensin satunnaiseen ruutuun alueella. Sitten se toistaa $100$ kertaa toiminnon, jossa se ensin lähettää nykyisen ruudun numeron Kotivalolle ja liikkuu sitten satunnaisesti vasemmalle, oikealle, ylöspäin tai alaspäin, mutta ei koskaan alueen ulkopuolelle. Tämän jälkeen robotti tuhoaa itsensä.
Voisitko auttaa Kotivaloa muodostamaan mahdollisimman hyvän kartan alueesta robottien antaman tiedon perusteella?
Syöte
Syötteessä on $100$ riviä, joista jokaisella on $100$ lukua: robotin lähettämät ruutujen numerot siinä järjestyksessä kuin robotti on käynyt niissä.
Tuloste
Tulosta $50$ riviä, joista kullakin on $50$ kokonaislukua: alueen kartta. Jokaisen luvun väliltä $1,2,\ldots,50^2$ tulee esiintyä tarkalleen kerran.
Arvostelu
Tässä tehtävässä on vain yksi syöte, jonka saat ladattua tästä. Sinun tulee palauttaa syötettä vastaava tulostiedosto.
Saat pisteen jokaisesta robotista, jonka lähettämä tieto sopii laatimaasi karttaan. Voit siis saada tehtävästä $0 \ldots 100$ pistettä.
Between Metsälä and Syrjälä there is a fenced area, known by the name Area 50. The area can be described as a $50 \times 50$ grid whose squares are numbered by integers $1,2,\ldots,50^2$. Each number appears in the grid exactly once.
Kotivalo wishes to obtain a better understanding of the area and has thus sent $100$ parachute robots. Each robot initially lands on a random square in the area. Then it repeats a procedure $100$ times, where it first transmits the number of the current square to Kotivalo, and then moves to either left, right, up or down by random, but never outside the area. Finally the robot destructs itself.
Could you help Kotivalo construct the best possible map of the area based on the information received from the robots?
Input
The input consists of $100$ lines, with $100$ integers each: the numbers of the squares reported by the robot in the order that it visited them.
Output
Print $50$ lines, with $50$ integers on each line: a map of Area 50. Each number in $1,2,\ldots,50^2$ must appear exactly once.
Grading
This task has only one input, which you can download here. You should submit the corresponding output file.
You get one point for each robot where the received information corresponds correctly with your map. This means you can obtain $0 \ldots 100$ points from the task.