5 5 3 1 2 1 1 2 2 3 4 1 4 5 1 3 5 2 5 3 1 2 3 1
\-2 inf nan For the first question, if you use road $5$ to move from town $5$ to town $3$, you can have a score $-2$ when you are at town $3$. Since you cannot make the score larger, the answer is $-2$. For the second question, you can have as large a score as you want when you are at town $2$ if you travel as follows: repeatedly "use road $2$ to move from town $1$ to town $2$ and then use road $1$ to move from town $2$ to town $1$" as many times as you want, and finally use road $2$ to move from town $1$ to town $2$. For the third question, you cannot get from town $3$ to town $1$.
2 1 1 1 1 1 1 1
inf The endpoints of a road may be the same, and so may the endpoints given in a question.
9 7 5 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9
inf nan nan inf -9
{
"problem": {
"name": "Pay or Receive",
"description": {
"content": "There are $N$ towns numbered $1,\\ldots,N$ and $M$ roads numbered $1,\\ldots,M$. Road $i$ connects towns $A_i$ and $B_i$. When you use a road, your **score** changes as follows: * when you move from ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc280_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ towns numbered $1,\\ldots,N$ and $M$ roads numbered $1,\\ldots,M$.\nRoad $i$ connects towns $A_i$ and $B_i$. When you use a road, your **score** changes as follows:\n\n* when you move from ...",
"is_translate": false,
"language": "English"
}
]
}