4 4 1 2 2 2 3 1 2 4 3 3 4 2 1 1 2 3 3
0 1 1 2 The infection spreads as follows. * On the night of day $0$, the person living in room $1$ gets infected. * The distances between room $1$ and rooms $2,3,4$ are $2,3,5$, respectively. Thus, since $X_1=3$, the people living in rooms $2$ and $3$ are newly infected on the night of day $1$. * The distance between rooms $3$ and $4$ is $2$. Thus, since $X_2=3$, the person living in room $4$ also gets infected on the night of day $2$. Therefore, the people living in rooms $1,2,3,4$ were newly infected on days $0,1,1,2$, respectively, so print $0,1,1,2$ in this order on separate lines.
7 7 1 2 2 2 3 3 3 4 1 4 5 1 5 6 3 3 7 1 4 7 1 2 1 6 2 2 3
0 1 2 -1 2 0 -1
5 1 1 2 5 2 1 3 3 3 7 5
0 2 0 -1 -1 Note that it is not always possible to move between any two rooms using only corridors.
{
"problem": {
"name": "Virus 2",
"description": {
"content": "There are $N$ rooms numbered $1$, $2$, $\\ldots$, $N$, each with one person living in it, and $M$ corridors connecting two different rooms. The $i$\\-th corridor connects room $U_i$ and room $V_i$ with ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 4000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc307_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ rooms numbered $1$, $2$, $\\ldots$, $N$, each with one person living in it, and $M$ corridors connecting two different rooms. The $i$\\-th corridor connects room $U_i$ and room $V_i$ with ...",
"is_translate": false,
"language": "English"
}
]
}