5 5 1 2 1 3 2 3 3 4 4 5 SSDDS
2 3 The dangerous vertices are (in ascending order of vertex number) vertices $3$ and $4$. For vertex $3$, moving from vertex $1$ $\to$ vertex $3$ $\to$ vertex $2$ (for example) satisfies the condition. The time required for this movement is $2$, and this is the minimum. Therefore, print $2$ on the $1$st line. For vertex $4$, moving from vertex $1$ $\to$ vertex $3$ $\to$ vertex $4$ $\to$ vertex $5$ (for example) satisfies the condition. The time required for this movement is $3$, and there is no way to move that satisfies the condition with time $2$ or less, so this is the minimum. Therefore, print $3$ on the $2$nd line.
3 2 1 2 2 3 SSD
3 The dangerous vertex is vertex $3$. Moving from vertex $1$ $\to$ vertex $2$ $\to$ vertex $3$ $\to$ vertex $2$ (for example) satisfies the condition. The time required for this movement is $3$, and this is the minimum. Note that movements such as vertex $2$ $\to$ vertex $3$ $\to$ vertex $2$ do not satisfy the condition that the destination is "different from the starting vertex".
{
"problem": {
"name": "Hit and Away",
"description": {
"content": "You are given a simple connected undirected graph $G$ with $N$ vertices and $M$ edges. The vertices and edges of $G$ are numbered as vertices $1,2,\\ldots,N$ and edges $1,2,\\ldots,M$, respectively, a",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc429_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a simple connected undirected graph $G$ with $N$ vertices and $M$ edges. \nThe vertices and edges of $G$ are numbered as vertices $1,2,\\ldots,N$ and edges $1,2,\\ldots,M$, respectively, a...",
"is_translate": false,
"language": "English"
}
]
}