{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eYou are given a string \u003cspan class\u003d\"tex2jax_process\"\u003e$s$\u003c/span\u003e and an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e. You can remove at most\n \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e non-intersecting\n substrings from \u003cspan class\u003d\"tex2jax_process\"\u003e$s$\u003c/span\u003e. Your\n task is to find the alphabetically (i.e., dictionary order)\n largest resulting string.\u003c/p\u003e\n \u003cp\u003eFor example, with string \u003cb class\u003d\"bfseries\"\u003eabcdcada\u003c/b\u003e\n and \u003cspan class\u003d\"tex2jax_process\"\u003e$k{\u003d}2$\u003c/span\u003e, you can\n choose the substrings \u003cb class\u003d\"bfseries\"\u003e[abc]d[ca]da\u003c/b\u003e and\n remove them to get \u003cb class\u003d\"bfseries\"\u003edda\u003c/b\u003e.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eEach input will begin with a line with a single integer\n \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\\! \\le \\! c\\! \\le \\! 2{\\cdot\n }10^5$\u003c/span\u003e), which is the number of cases you must\n solve.\u003c/p\u003e\n \u003cp\u003eEach of the next \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e\n lines will contain an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e and a string \u003cspan class\u003d\"tex2jax_process\"\u003e$s$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\\! \\le \\! k\\! \\le \\! |s|\\! \\le \\! 10^5, s\\!\n \\in \\! [a{-}z]^*$\u003c/span\u003e), separated by a space.\u003c/p\u003e\n \u003cp\u003eThe total length of all strings in the input will be at most\n \u003cspan class\u003d\"tex2jax_process\"\u003e$10^6$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eOutput the largest string, alphabetically, that you can get\n by removing \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e or fewer\n non-intersecting substrings from \u003cspan class\u003d\"tex2jax_process\"\u003e$s$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\n2 abcdcada\n1 ababb\n2 ababb\n1 dadbdcdbdad\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003edda\nbb\nbbb\nddcdbdad\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}