CF1204D1.Kirk and a Binary String (easy version)
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string s (a string which consists of zeroes and ones) of length n and he is asking you to find a binary string t of the same length which satisfies the following conditions:
- For any l and r ( 1≤l≤r≤n ) the length of the longest non-decreasing subsequence of the substring slsl+1…sr is equal to the length of the longest non-decreasing subsequence of the substring tltl+1…tr ;
- The number of zeroes in t is the maximum possible.
A non-decreasing subsequence of a string p is a sequence of indices i1,i2,…,ik such that i1<i2<…<ik and pi1≤pi2≤…≤pik . The length of the subsequence is k .
If there are multiple substrings which satisfy the conditions, output any.
输入格式
The first line contains a binary string of length not more than 2000 .
输出格式
Output a binary string which satisfied the above conditions. If there are many such strings, output any of them.
输入输出样例
输入#1
110
输出#1
010
输入#2
010
输出#2
010
输入#3
0001111
输出#3
0000000
输入#4
0111001100111011101000
输出#4
0011001100001011101000
说明/提示
In the first example:
- For the substrings of the length 1 the length of the longest non-decreasing subsequnce is 1 ;
- For l=1,r=2 the longest non-decreasing subsequnce of the substring s1s2 is 11 and the longest non-decreasing subsequnce of the substring t1t2 is 01 ;
- For l=1,r=3 the longest non-decreasing subsequnce of the substring s1s3 is 11 and the longest non-decreasing subsequnce of the substring t1t3 is 00 ;
- For l=2,r=3 the longest non-decreasing subsequnce of the substring s2s3 is 1 and the longest non-decreasing subsequnce of the substring t2t3 is 1 ;
The second example is similar to the first one.