5 2 11 01 11 10 00
2 3 2 A teleporter sends you * from city $1$ to cities $2$ and $3$; * from city $2$ to city $4$; * from city $3$ to cities $4$ and $5$; * from city $4$ to city $5$; and * from city $5$ to nowhere. Therefore, there are three paths to travel from city $1$ to city $5$: * path $1$ : city $1$ $\to$ city $2$ $\to$ city $4$ $\to$ city $5$; * path $2$ : city $1$ $\to$ city $3$ $\to$ city $4$ $\to$ city $5$; and * path $3$ : city $1$ $\to$ city $3$ $\to$ city $5$. Among these paths, * two paths, path $2$ and path $3$, do not visit city $2$. Among them, path $3$ requires the minimum number of teleporter uses (twice). * Path $1$ is the only path without city $3$. It requires using a teleporter three times. * Path $3$ is the only path without city $4$. It requires using a teleporter twice. Thus, $2$, $3$, and $2$, separated by spaces, should be printed.
6 3 101 001 101 000 100 000
\-1 3 3 -1 The only path from city $1$ to city $6$ is city $1$ $\to$ city $2$ $\to$ city $5$ $\to$ city $6$. For $k=2,5$, there is no way to travel from city $1$ to city $6$ without visiting city $k$. For $k=3,4$, the path above satisfies the condition; it requires using a teleporter three times. Thus, $-1$, $3$, $3$, and $-1$, separated by spaces, should be printed. Note that a teleporter is one-way; a teleporter can send you from city $3$ to city $4$, but not from city $4$ to city $3$, so the following path, for example, is invalid: city $1$ $\to$ city $4$ $\to$ city $3$ $\to$ city $6$.
{
"problem": {
"name": "Teleporter and Closed off",
"description": {
"content": "There are $N$ cities numbered city $1$, city $2$, $\\ldots$, and city $N$. There are also one-way teleporters that send you to different cities. Whether a teleporter can send you directly from city $",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc291_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ cities numbered city $1$, city $2$, $\\ldots$, and city $N$. \nThere are also one-way teleporters that send you to different cities. Whether a teleporter can send you directly from city $...",
"is_translate": false,
"language": "English"
}
]
}