4 1 2 3
2 Below, we will write $A → B$ to denote the fact that Member $A$ is the direct boss of Member $B$. In this case, the hierarchy of the members is $1 → 2 → 3 → 4$. There are two ways for them to stand in a line that satisfy their desires: * $2, 4, 1, 3$ * $3, 1, 4, 2$ Note that the latter is the reverse of the former, but we count them individually.
3 1 2
0 The hierarchy of the members is $1 → 2 → 3$. No matter what order they stand in, at least one of the desires of Member $2$ and $3$ is not satisfied, so the answer is $0$.
5 1 1 3 3
8 The hierarchy of the members is shown below:  There are eight ways for them to stand in a line that satisfy their desires: * $1, 4, 5, 2, 3$ * $1, 5, 4, 2, 3$ * $3, 2, 4, 1, 5$ * $3, 2, 4, 5, 1$ * $3, 2, 5, 1, 4$ * $3, 2, 5, 4, 1$ * $4, 1, 5, 2, 3$ * $5, 1, 4, 2, 3$
15 1 2 3 1 4 2 7 1 8 2 8 1 8 2
97193524
{
"problem": {
"name": "Awkward",
"description": {
"content": "_ButCoder Inc._ is a startup company whose main business is the development and operation of the programming competition site \"_ButCoder_\". There are $N$ members of the company including the president",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "cf17_exhibition_a"
},
"statements": [
{
"statement_type": "Markdown",
"content": "_ButCoder Inc._ is a startup company whose main business is the development and operation of the programming competition site \"_ButCoder_\".\nThere are $N$ members of the company including the president...",
"is_translate": false,
"language": "English"
}
]
}