CF938F.Erasing Substrings

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a string s, initially consisting of n lowercase Latin letters. After that, you perform k operations with it, where . 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.

给你一个字符串 ss,初始时由 nn 个小写拉丁字母组成。之后,你将对它执行 kk 次操作,其中 。在第 ii 次操作中,你必须从 ss 中删除一个长度恰好为 2i−12^i - 1 的子串。

输出执行完 kk 次此类操作后可能得到的字典序最小的字符串。

输入格式

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

仅有一行,包含一个由 nn 个小写拉丁字母组成的字符串 ss(1 ≤ n ≤ 50001 ≤ n ≤ 5000)。

输出格式

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

执行 k 次操作后,输出你能得到的字典序最小的字符串。

输入输出样例

  • 输入#1

    adcbca

    输出#1

    aba
  • 输入#2

    abacabadabacaba

    输出#2

    aabacaba

说明/提示

Possible operations in examples:

  1. adcbca adcba aba;
  2. abacabadabacaba abcabadabacaba aabadabacaba aabacaba.

示例中的可能操作:

  1. adcbca adcba aba;
  2. abacabadabacaba abcabadabacaba aabadabacaba aabacaba。

输入解题思路,AI测评打分。不知道怎么写?

首页