AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

NWERC24-078.Evolving Etymology

Hard · 1 s · 256 MB

  • icpc
  • nwerc
  • 2024

Eelco has recently started to gain interest in the field that studies the origin of words: etymology. He especially likes how words can evolve in many different ways: pronunciation changes over time, words are borrowed from different languages, and the meaning of words can change based on culture. Eelco is eager to attend the Networking With Etymologists: Revolutionary Conference for the first time ever. To make a good first impression, he is going to present a completely new method to make new words from existing words.

To make a new word from an existing word sss, Eelco proposes to take every second letter of s+ss+ss+s, starting with the first letter. For example, applying this method to the word “etymology” would result in “eyooytmlg”. Of course, to design even more words, this process can be repeated many times. Eelco would like to prepare a list of new words to present at the conference, so he writes a program that applies his method some predetermined number of times.

Giriş formatı

The input consists of:

• One line with two integers nnn and kkk (1≤n≤1051 \leq n \leq 10^51≤n≤105, 1≤k≤10181 \leq k \leq 10^{18}1≤k≤1018), the length of the original word and the number of times to apply the method.

• One line with a string sss of length nnn, only consisting of English lowercase letters (a-z), the original word.

Çıxış formatı

Output the resulting word after applying the method to the original word kkk times.

Qeyd

Source: Northwestern Europe Regional Contest (NWERC) 2024 · Author: Nils Gustafsson · License: CC BY-SA 4.0 · Original: https://2024.nwerc.eu · Statement adapted for AlgoLens and shared under the same license. · 10 of the 82 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

9 1
etymology

Çıxış #1

eyooytmlg

Giriş #2

4 1
word

Çıxış #2

wrwr

Giriş #3

5 1000000000000000000
delft

Çıxış #3

delft

Giriş #4

5 5
eceol

Çıxış #4

eelco