{"problem":{"name":"Equal Hamming Distances","description":{"content":"Below, a $01$\\-sequence is a string consisting of `0` and `1`. You are given two $01$\\-sequences $S$ and $T$ of length $N$ each. Print the lexicographically smallest $01$\\-sequence $U$ of length $N$ t","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc151_a"},"statements":[{"statement_type":"Markdown","content":"Below, a $01$\\-sequence is a string consisting of `0` and `1`.\nYou are given two $01$\\-sequences $S$ and $T$ of length $N$ each. Print the lexicographically smallest $01$\\-sequence $U$ of length $N$ that satisfies the condition below.\n\n*   The Hamming distance between $S$ and $U$ equals the Hamming distance between $T$ and $U$.\n\nIf there is no such $01$\\-sequence $U$ of length $N$, print $-1$ instead.\nWhat is Hamming distance?The **Hamming distance** between $01$\\-sequences $X = X_1X_2\\ldots X_N$ and $Y = Y_1Y_2\\ldots Y_N$ is the number of integers $1 \\leq i \\leq N$ such that $X_i \\neq Y_i$.\nWhat is lexicographical order?A $01$\\-sequence $X = X_1X_2\\ldots X_N$ is **lexicographically smaller** than a $01$\\-sequence $Y = Y_1Y_2\\ldots Y_N$ when there is an integer $1 \\leq i \\leq N$ that satisfies both of the conditions below.\n\n*   $X_1X_2\\ldots X_{i-1} = Y_1Y_2\\ldots Y_{i-1}$.\n*   $X_i =$ `0` and $Y_i = $ `1`.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $N$ is an integer.\n*   $S$ and $T$ are $01$\\-sequences of length $N$ each.\n\n## Input\n\nThe input 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":"arc151_a","tags":[],"sample_group":[["5\n00100\n10011","00001\n\nFor $U = $ `00001`, the Hamming distance between $S$ and $U$ and the Hamming distance between $T$ and $U$ are both $2$. Additionally, this is the lexicographically smallest $01$\\-sequence $U$ of length $N$ that satisfies the condition."],["1\n0\n1","\\-1\n\nNo $01$\\-sequence $U$ of length $N$ satisfies the condition, so $-1$ should be printed."]],"created_at":"2026-03-03 11:01:14"}}