7 5 4 3 1 1 4 5 2 1 7 2 4 3 5 1 5 4 7
10 5 6 9 8 Let us explain the first query. We have $B=(4,3,1,1,4,5,2)$. If you divide it into $(4,3),(1,1),(4,5,2)$, the maximum values of the contiguous subsequences are $4,1,5$, respectively, and their sum is $10$. There is no way to make this sum smaller, so the answer to this query is $10$.
10 15 8 3 8 10 1 5 3 1 6 4 4 6 2 5 6 9 8 10 2 9 4 10 1 5 1 8 1 3 4 8 1 10 2 10 6 10 2 6 2 6
16 14 12 11 17 17 19 14 19 14 17 17 12 16 16
{
"problem": {
"name": "Division into 3",
"description": {
"content": "You are given an integer sequence $A=(A_1,A_2,\\cdots,A_N)$ of length $N$. Answer the following $Q$ queries. * The $i$\\-th query: You are given integers $L_i$ and $R_i$. Solve the following problem ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc180_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given an integer sequence $A=(A_1,A_2,\\cdots,A_N)$ of length $N$. Answer the following $Q$ queries.\n\n* The $i$\\-th query: You are given integers $L_i$ and $R_i$. Solve the following problem ...",
"is_translate": false,
"language": "English"
}
]
}