{"problem":{"name":"Swap 0^X and 1^Y","description":{"content":"You are given two strings $S$ and $T$, each of length $N$ and consisting of `0` and `1`, as well as two positive integers $X$ and $Y$. For $i = 1, 2, \\ldots, N$, let $S_i$ denote the $i$\\-th character","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc194_e"},"statements":[{"statement_type":"Markdown","content":"You are given two strings $S$ and $T$, each of length $N$ and consisting of `0` and `1`, as well as two positive integers $X$ and $Y$. For $i = 1, 2, \\ldots, N$, let $S_i$ denote the $i$\\-th character of $S$.\nDetermine whether it is possible to make $S$ identical to $T$ by repeatedly performing Operations A and B below any number of times (possibly zero) in any order:\n\n*   (Operation A) Choose an integer $i$ satisfying $1 \\leq i \\leq N-(X+Y)+1$, $S_{i} = S_{i+1} = \\cdots = S_{i+X-1} =$ `0`, and $S_{i+X} = S_{i+X+1} = \\cdots = S_{i+X+Y-1} =$ `1`, then change each of $S_{i}, S_{i+1}, \\ldots, S_{i+Y-1}$ to `1` and each of $S_{i+Y}, S_{i+Y+1}, \\ldots, S_{i+Y+X-1}$ to `0`.\n    \n*   (Operation B) Choose an integer $i$ satisfying $1 \\leq i \\leq N-(X+Y)+1$, $S_{i} = S_{i+1} = \\cdots = S_{i+Y-1} =$ `1`, and $S_{i+Y} = S_{i+Y+1} = \\cdots = S_{i+Y+X-1} =$ `0`, then change each of $S_{i}, S_{i+1}, \\ldots, S_{i+X-1}$ to `0` and each of $S_{i+X}, S_{i+X+1}, \\ldots, S_{i+X+Y-1}$ to `1`.\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq X, Y \\leq N$\n*   $S$ and $T$ are strings of length $N$ consisting of `0` and `1`.\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $X$ $Y$\n$S$\n$T$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc194_e","tags":[],"sample_group":[["9 2 1\n000111001\n011000011","Yes\n\nThe following procedure can transform $S$ into $T$:\n\n*   First, perform Operation A with $i = 2$. Now, $S =$ `010011001`.\n*   Next, perform Operation B with $i = 6$. Now, $S =$ `010010011`.\n*   Finally, perform Operation A with $i = 3$. Now, $S =$ `011000011`.\n\nThus, print `Yes`."],["1 1 1\n0\n1","No\n\nIt is impossible to make $S$ identical to $T$. Thus, print `No`."]],"created_at":"2026-03-03 11:01:14"}}