CF1493E.Enormous XOR
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given two integers l and r in binary representation. Let g(x,y) be equal to the bitwise XOR of all integers from x to y inclusive (that is x⊕(x+1)⊕⋯⊕(y−1)⊕y ). Let's define f(l,r) as the maximum of all values of g(x,y) satisfying l≤x≤y≤r .
Output f(l,r) .
输入格式
The first line contains a single integer n ( 1≤n≤106 ) — the length of the binary representation of r .
The second line contains the binary representation of l — a string of length n consisting of digits 0 and 1 ( 0≤l<2n ).
The third line contains the binary representation of r — a string of length n consisting of digits 0 and 1 ( 0≤r<2n ).
It is guaranteed that l≤r . The binary representation of r does not contain any extra leading zeros (if r=0 , the binary representation of it consists of a single zero). The binary representation of l is preceded with leading zeros so that its length is equal to n .
输出格式
In a single line output the value of f(l,r) for the given pair of l and r in binary representation without extra leading zeros.
输入输出样例
输入#1
7 0010011 1111010
输出#1
1111111
输入#2
4 1010 1101
输出#2
1101
说明/提示
In sample test case l=19 , r=122 . f(x,y) is maximal and is equal to 127 , with x=27 , y=100 , for example.