304943: CF938F. Erasing Substrings

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Erasing Substrings

题意翻译

给你一个字符集是小写字母长度是$n$ 的字符串 令$k=\lfloor\log_2n\rfloor$ ,你可以依次进行$k$ 次操作 第$i$ 操作删除当前串$s$ 中一个长度是$2^{i-1}$ 的子串 你需要使得最终的字符串字典序最小,请输出这个最小的串 感谢@Kelin 提供的翻译

题目描述

You are given a string $ s $ , initially consisting of $ n $ lowercase Latin letters. After that, you perform $ k $ operations with it, where ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/c757249d7b8bdc7808476dd4f682a6142a6f6a1c.png). During $ i $ -th operation you must erase some substring of length exactly $ 2^{i-1} $ from $ s $ . Print the lexicographically minimal string you may obtain after performing $ k $ such operations.

输入输出格式

输入格式


The only line contains one string $ s $ consisting of $ n $ lowercase Latin letters ( $ 1<=n<=5000 $ ).

输出格式


Print the lexicographically minimal string you may obtain after performing $ k $ operations.

输入输出样例

输入样例 #1

adcbca

输出样例 #1

aba

输入样例 #2

abacabadabacaba

输出样例 #2

aabacaba

说明

Possible operations in examples: 1. adcbca ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/5a518872d8942914aef6c33d251688a64a8d6d74.png) adcba ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/5a518872d8942914aef6c33d251688a64a8d6d74.png) aba; 2. abacabadabacaba ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/5a518872d8942914aef6c33d251688a64a8d6d74.png) abcabadabacaba ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/5a518872d8942914aef6c33d251688a64a8d6d74.png) aabadabacaba ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF938F/5a518872d8942914aef6c33d251688a64a8d6d74.png) aabacaba.

Input

题意翻译

给你一个字符集是小写字母长度是$n$ 的字符串 令$k=\lfloor\log_2n\rfloor$ ,你可以依次进行$k$ 次操作 第$i$ 操作删除当前串$s$ 中一个长度是$2^{i-1}$ 的子串 你需要使得最终的字符串字典序最小,请输出这个最小的串 感谢@Kelin 提供的翻译

加入题单

上一题 下一题 算法标签: