4 4 1 1 0 1 1 0 2 1 3 0 0 0 5 1 1 1 1 1 1 1 1 1 0
1 0 0 3 In the first test case, if the queries are processed in the order $(q,i,j)=(1,1,4),$ $(2,1,4),$ $(1,2,4),$ $(2,1,2),$ $(1,1,2),$ $(2,2,3),$ $(2,2,4),$ $(2,3,4),$ $(1,3,4),$ $(1,1,3),$ $(2,1,3),$ $(1,2,3)$, the resulting sequence is $(1,1,0,1,0,1)$, and $B$ can be changed to this sequence by performing the operation once. Also, $(1,1,0,1,1,0)$ is not a special sequence, so the answer is $1$.
{
"problem": {
"name": "Valid Output for DSU Problems",
"description": {
"content": "A sequence that can be obtained as $A$ by performing the following operations is called a **special sequence**: * Prepare an undirected graph consisting of $N$ vertices and $0$ edges, and a sequenc",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc074_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "A sequence that can be obtained as $A$ by performing the following operations is called a **special sequence**:\n\n* Prepare an undirected graph consisting of $N$ vertices and $0$ edges, and a sequenc...",
"is_translate": false,
"language": "English"
}
]
}