2 1 2
9 First, we will consider the order "Block $1$ -> Block $2$". In the first operation, the cost of the operation is $1+2=3$, as Block $1$ and $2$ are connected. In the second operation, the cost of the operation is $2$, as only Block $2$ remains. Thus, the total cost of the two operations for this order is $3+2=5$. Then, we will consider the order "Block $2$ -> Block $1$". In the first operation, the cost of the operation is $1+2=3$, as Block $1$ and $2$ are connected. In the second operation, the cost of the operation is $1$, as only Block $1$ remains. Thus, the total cost of the two operations for this order is $3+1=4$. Therefore, the answer is $5+4=9$.
4 1 1 1 1
212
10 1 2 4 8 16 32 64 128 256 512
880971923
{
"problem": {
"name": "Removing Blocks",
"description": {
"content": "There are $N$ blocks arranged in a row, numbered $1$ to $N$ from left to right. Each block has a weight, and the weight of Block $i$ is $A_i$. Snuke will perform the following operation on these block",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc028_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ blocks arranged in a row, numbered $1$ to $N$ from left to right. Each block has a weight, and the weight of Block $i$ is $A_i$. Snuke will perform the following operation on these block...",
"is_translate": false,
"language": "English"
}
]
}