2 4 0 1 0 1 5 0 0 1 1 1
2
AABA
BBBB
0
For the first test case, the goal can be achieved in two operations as follows, which is the minimum number of operations:
* First operation: Use $s_1$\=`AABA`. Since $(X_1,X_2,X_4)$ are in group `A`, reverse their order, resulting in $(X_1,X_2,X_4)=(1,1,0)$. Similarly, since $(X_3)$ is in group `B`, reverse their order, resulting in $(X_3)=(0)$. Thus, overall we get $X=(1,1,0,0)$.
* Second operation: Use $s_2$\=`BBBB`. Since $()$ are in group `A`, reverse their order, resulting in $()=()$. Similarly, since $(X_1,X_2,X_3,X_4)$ are in group `B`, reverse their order, resulting in $(X_1,X_2,X_3,X_4)=(0,0,1,1)$. Thus, overall we get $X=(0,0,1,1)$.
For the second test case, the goal can be achieved by performing the operation zero times.{
"problem": {
"name": "Split and Reverse",
"description": {
"content": "You are given an integer sequence $X=(X_1,X_2,\\cdots,X_N)$ of length $N$ consisting of $0$ and $1$. You can perform the following operation zero or more times: * Classify each element of $X$ into g",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc076_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given an integer sequence $X=(X_1,X_2,\\cdots,X_N)$ of length $N$ consisting of $0$ and $1$.\nYou can perform the following operation zero or more times:\n\n* Classify each element of $X$ into g...",
"is_translate": false,
"language": "English"
}
]
}