{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"There are $N\\ (N \\le 20)$ cellars on a map, each containing a certain number of landmines. Meanwhile, the connecting paths between the cellars are given. After the data of the cellars and their connections are provided, a person can start digging for landmines from any location and then can dig down along the specified connection (only one path can be chosen), and the digging work ends when there is no connection. Design a plan for digging landmines so that a person can dig up the most landmines."}},{"title":"Input","value":{"format":"MD","content":"Consists of several lines.\n\nThe $1$th line contains only one number, indicating the number of cellars $N$.\n\nThe $2$th line contains $N$ numbers, indicating the number of landmines in each cellar.\n\nThe $3$th line to the $N+1$th line represent the connection between the cellars:\n\nThe $3$th line contains $n-1$ numbers ($0$ or $1$), indicating whether there is a path connection from the first cellar to the $2$th, $3$th $\\dots$ to the $n$th cellar. If the $3$th line is $11000\\cdots 0$, it means that there is a path from the $1$th cellar to the $2$th cellar, a path to the $3$th cellar, and no path to the $4$th cellar, $5$th $\\dots$ to the $n$th cellar.\n\nThe $4$th line contains $n-2$ numbers, indicating whether there is a path connection from the second cellar to the $3$th, $4$th $\\dots$ to the $n$th cellar.\n\n……\n\nThe $n+1$th line contains $1$ numbers, indicating whether there is a path connection from the $n-1$th cellar to the $n$th cellar. (If $0$, it means no path; if $1$, it means there is a path)."}},{"title":"Output","value":{"format":"MD","content":"The first line represents the order of digging for the most landmines, with the cellar numbers separated by a single space, and no extra spaces are allowed.\n\nThe second line contains only one number, indicating the maximum number of landmines that can be dug up."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n10 8 4 7 6\n1 1 1 0\n0 0 0\n1 1\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 3 4 5\n27\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"**【题目来源】**\n\nNOIP 1996 Advanced Group Third Question"}}]}