Reminder: in case of any technical issues, you can use the lightweight website m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

### saliii's blog

By saliii, 3 years ago, ,

I appreciate if anyone can help me share his good problems of POIs, just list them in the comments and I'll check them all.

Given a string S of size n. We define as follows:

In other hand, is a set of sizes of periods A such that S = AAA...AB(B is a prefix of A).

Now, we want to create the minimum lexicographically string C of size n such that .

There are k such tests.

1 ≤ k ≤ 20, 1 ≤ n ≤ 250000

________________
3
ABIABUABIAB
BABBAB
BABURBAB
________________
01001101001
010010
01000010
________________


Some of hints only make a good look and may not solve the problem. When you look in that way, you'll come close to the solution. And if you didn't look in that way, you won't get the next hints and you'll get confused in 13 spoilers.

hint1
hint2

Some problem just used this idea : 526D - Om Nom and Necklace

hint3
hint4

Tell me if you come up with a easier and shorter answer, I'll become glad.

Code

Hope you enjoy the problem :) and it helped you.

• -19

 » 3 years ago, # |   +5 Auto comment: topic has been updated by ChamrAn (previous revision, new revision, compare).
 » 3 years ago, # |   0 Auto comment: topic has been updated by ChamrAn (previous revision, new revision, compare).