4 1 2 3 2 2 1 3 4 2 3
4
8
* For the $1$\-st query, insert $3$ balls, with a number $2$ written on each of them, to the right end of the cylinder.
The cylinder has now balls with numbers $(2,2,2)$ written on them, from left to right.
* For the $2$\-nd query, take out the $2$ leftmost balls contained in the cylinder.
The numbers written on the balls taken out are $2,2$, for a sum of $4$, which should be printed. The cylinder has now a ball with a number $(2)$ written on it, from left to right.
* For the $3$\-rd query, insert $4$ balls, with a number $3$ written on each of them, to the right end of the cylinder.
The cylinder has now balls with numbers $(2,3,3,3,3)$ written on them, from left to right.
* For the $4$\-th query, take out the $3$ leftmost balls contained in the cylinder.
The numbers written on the balls taken out are $2,3,3$, for a sum of $8$, which should be printed. The cylinder has now balls with numbers $(3,3)$ written on them, from left to right.2 1 1000000000 1000000000 2 1000000000
1000000000000000000
5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
There may be nothing you should print.
{
"problem": {
"name": "Cylinder",
"description": {
"content": "We have a horizontal cylinder. Given $Q$ queries, process them in the given order. Each query is of one of the following two types. * `1 x c`: Insert $c$ balls, with a number $x$ written on each ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc247_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "We have a horizontal cylinder. Given $Q$ queries, process them in the given order. \nEach query is of one of the following two types.\n\n* `1 x c`: Insert $c$ balls, with a number $x$ written on each ...",
"is_translate": false,
"language": "English"
}
]
}