{"problem":{"name":"Vacation Query","description":{"content":"You are given a string $S$ of length $N$ consisting of `0` and `1`. Let $S_i$ denote the $i$\\-th character of $S$. Process $Q$ queries in the order they are given.   Each query is represented by a tup","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc322_f"},"statements":[{"statement_type":"Markdown","content":"You are given a string $S$ of length $N$ consisting of `0` and `1`. Let $S_i$ denote the $i$\\-th character of $S$.\nProcess $Q$ queries in the order they are given.  \nEach query is represented by a tuple of three integers $(c, L, R)$, where $c$ represents the type of the query.\n\n*   When $c=1$: For each integer $i$ such that $L \\leq i \\leq R$, if $S_i$ is `1`, change it to `0`; if it is `0`, change it to `1`.\n*   When $c=2$: Let $T$ be the string obtained by extracting the $L$\\-th through $R$\\-th characters of $S$. Print the maximum number of consecutive `1`s in $T$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq Q \\leq 10^5$\n*   $S$ is a string of length $N$ consisting of `0` and `1`.\n*   $c \\in \\lbrace 1, 2 \\rbrace$\n*   $1 \\leq L \\leq R \\leq N$\n*   $N$, $Q$, $c$, $L$, and $R$ are all integers.\n\n## Input\n\nThe input is given from Standard Input in the following format, where $\\mathrm{query}_i$ represents the $i$\\-th query:\n\n$N$ $Q$\n$S$\n$\\mathrm{query}_1$\n$\\mathrm{query}_2$\n$\\vdots$\n$\\mathrm{query}_Q$\n\nEach query is given in the following format:\n\n$c$ $L$ $R$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc322_f","tags":[],"sample_group":[["7 6\n1101110\n2 1 7\n2 2 4\n1 3 6\n2 5 6\n1 4 7\n2 1 7","3\n1\n0\n7\n\nThe queries are processed as follows.\n\n*   Initially, $S=$ `1101110`.\n*   For the first query, $T =$ `1101110`. The longest sequence of consecutive `1`s in $T$ is `111` from the $4$\\-th character to $6$\\-th character, so the answer is $3$.\n*   For the second query, $T =$ `101`. The longest sequence of consecutive `1`s in $T$ is `1` at the $1$\\-st or $3$\\-rd character, so the answer is $1$.\n*   For the third query, the operation changes $S$ to `1110000`.\n*   For the fourth query, $T =$ `00`. $T$ does not contain `1`, so the answer is $0$.\n*   For the fifth query, the operation changes $S$ to `1111111`.\n*   For the sixth query, $T =$ `1111111`. The longest sequence of consecutive `1`s in $T$ is `1111111` from the $1$\\-st to $7$\\-th characters, so the answer is $7$."]],"created_at":"2026-03-03 11:01:14"}}