21.01.2015 Views

color version - PET: Python Entre Todos - Python Argentina

color version - PET: Python Entre Todos - Python Argentina

color version - PET: Python Entre Todos - Python Argentina

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Due to privacy concerns the data will be anonymized, you will only get an ID of each<br />

user.<br />

The first line will have two numbers: N and M with the amount of users and the amount<br />

of friendships in the network respectively.<br />

The users are numbered consecutively, without skipping any user, starting with 1. Curly<br />

is number 1. In the following M lines there will be two numbers indicating a relationship<br />

between two users.<br />

Some users have no contacts or have no way to build a chain of contacts back to Curly.<br />

Output<br />

You need to print, through standard output N lines with two numbers separated by a<br />

single white space. The first number will be the user’s id and the second number will be<br />

the minimum distance to Curly.<br />

If there is no way to calculate that distance, the second number should be the character<br />

“X” instead.<br />

8 X<br />

Participants must send their solution as a .py file named pet2-USERNAME.py (replacing<br />

“USERNAME” with a username of your choice) and it will be run with python 2.7 in<br />

Alejandro’s computer. The winner will be the one to get the solution that passes all<br />

specially-crafted tests in the shortest time.<br />

Send your solution to revistapyar@netmanagers.com.ar with DESAFIO2 as the subject of<br />

the mail before 2011-July-31.<br />

Good luck and happy brain squshing!<br />

Clarifications and feedback<br />

Any clarifications, if needed, and feedback for participants will be provided through<br />

PyAr’s wiki at:<br />

http://python.org.ar/pyar/Proyectos/Revista<strong>Python</strong>Comunidad/<strong>PET</strong>2/Desafio<br />

Example<br />

Input:<br />

8 7<br />

1 2<br />

1 3<br />

1 4<br />

2 5<br />

3 5<br />

5 6<br />

4 6<br />

7 8<br />

Output:<br />

1 0<br />

2 1<br />

3 1<br />

4 1<br />

5 2<br />

6 2<br />

7 X

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!