CF1743D.Problem with Random Tests
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a string s consisting of n characters. Each character of s is either 0 or 1.
A substring of s is a contiguous subsequence of its characters.
You have to choose two substrings of s (possibly intersecting, possibly the same, possibly non-intersecting — just any two substrings). After choosing them, you calculate the value of the chosen pair of substrings as follows:
- let s1 be the first substring, s2 be the second chosen substring, and f(si) be the integer such that si is its binary representation (for example, if si is 11010, f(si)=26 );
- the value is the bitwise OR of f(s1) and f(s2) .
Calculate the maximum possible value you can get, and print it in binary representation without leading zeroes.
输入格式
The first line contains one integer n — the number of characters in s .
The second line contains s itself, consisting of exactly n characters 0 and/or 1.
All non-example tests in this problem are generated randomly: every character of s is chosen independently of other characters; for each character, the probability of it being 1 is exactly 21 .
This problem has exactly 40 tests. Tests from 1 to 3 are the examples; tests from 4 to 40 are generated randomly. In tests from 4 to 10 , n=5 ; in tests from 11 to 20 , n=1000 ; in tests from 21 to 40 , n=106 .
Hacks are forbidden in this problem.
输出格式
Print the maximum possible value you can get in binary representation without leading zeroes.
输入输出样例
输入#1
5 11010
输出#1
11111
输入#2
7 1110010
输出#2
1111110
输入#3
4 0000
输出#3
0
说明/提示
In the first example, you can choose the substrings 11010 and 101. f(s1)=26 , f(s2)=5 , their bitwise OR is 31 , and the binary representation of 31 is 11111.
In the second example, you can choose the substrings 1110010 and 11100.