{"problem":{"name":"Flip Digits","description":{"content":"Given are length-$N$ strings $S$ and $T$ consisting of `0` and `1`. You can do the following operation on $S$ any number of times: *   Choose $i$ ($2 \\leq i \\leq N$) such that $S_i=$`1`, and replace ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc049_b"},"statements":[{"statement_type":"Markdown","content":"Given are length-$N$ strings $S$ and $T$ consisting of `0` and `1`. You can do the following operation on $S$ any number of times:\n\n*   Choose $i$ ($2 \\leq i \\leq N$) such that $S_i=$`1`, and replace $S_i$ with `0`. Additionally, invert $S_{i-1}$, that is, change it to `1` if it is `0` now and vice versa.\n\nIs it possible to make $S$ exactly match $T$? If it is possible, how many operations does it take at least?\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $S$ is a string of length $N$ consisting of `0` and `1`.\n*   $T$ is a string of length $N$ consisting of `0` and `1`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S$\n$T$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc049_b","tags":[],"sample_group":[["3\n001\n100","2\n\nWe can do as follows: `001` → (choose $i=3$) → `010` → (choose $i=2$) → `100`."],["3\n001\n110","\\-1"],["5\n10111\n01010","5"]],"created_at":"2026-03-03 11:01:14"}}