### elakstein's blog

By elakstein, history, 4 weeks ago, ,

Problem Statement:- You are given a string S with length N that contains only the 26 lowercase English letters. You are also given a sequence W1,W2,…,W26 of weights corresponding to these letters in the order from 'a' to 'z', i.e. W1 is the weight of 'a', W2 is the weight of 'b' and so on.

We define the weight of a string as the sum of weights of all characters present in it. If a character occurs multiple times in this string, its weight is also counted multiple times.

Next, we define the power of a string s as the sum of weights of all strings r such that s can be represented as r+r+…+r+p, where + denotes string concatenation and p is a prefix of r (possibly empty).

Can anyone explain what does the author mean here by power of the string. Even after reading it 100 times I can't understand the statement. I would also like to know that am I just too dumb to understand it or you also think the problem statement is shit .

Link to problem statement .This problem is a part of live codechef long challenge.

• -18

 » 4 weeks ago, # |   0 aviroop123 can you explain it.
 » 4 weeks ago, # |   +9 It is an ongoing competition, that problem should't be talked about.
•  » » 4 weeks ago, # ^ |   +4 I haven't asked for solution. I just asked what does the author mean by power of string as it isn't clear from the statement.
•  » » 4 weeks ago, # ^ |   +4 Also I have already mentioned that the question is from a live contest.
•  » » » 4 weeks ago, # ^ |   +14 It is good that you mentioned this (thanks for that), but if the problem statement isn't clear, you should submit a clarification request so that all contestants hear the explanation and you don't have an unfair advantage.
•  » » » » 4 weeks ago, # ^ |   0 I waited for 5 hours after posting for the clarification on codechef. When I didn't received ,I used this platform.
•  » » 4 weeks ago, # ^ |   +4 I will be very thankful if you can explain that part of the statement.
•  » » » 4 weeks ago, # ^ | ← Rev. 3 →   0 So, if a string is "ABC", And weight for letters is A: 10, B: 7, C:3. The power of string is power of "ABC" + power of "AB" + power of "A". (10+7+3) + (10 + 7) + (10) = 47Maybe I wrong
•  » » » » 4 weeks ago, # ^ |   0 you are wrong
•  » » 4 weeks ago, # ^ |   0 He hasn't asked for the solution and just wants to understand the problem statement better. Moreover he has explicitly mentioned that this a problem from a live contest. I don't think there's a problem with this unless you mean to say that the problem setter has deliberately written ambiguous statement and wants the ones that are able to understand the statement to have some advantage, which I think is nonsense because then we're not being tested on coding skills but on language proficiency. Also, everything is up to the discretion of the person writing the comment. If you're afraid that he might get unfair advantage and don't want to comment, then don't. No one is forcing you.
•  » » » 4 weeks ago, # ^ |   0 You are right some people just think too high of themselves. And think others as fool. spookywooky currently you have higher ratings this only means that you are doing cp more than specialist. It doesn't mean you are more intelligent or mature.
•  » » » 4 weeks ago, # ^ |   0 "...just wants to understand the problem statement better.". Yes, we all want that. But asking other people while contest is running is not the way to go. It is not allowed, on no CP platform, in no competition, no channel. Simply don't.It is as simple as that.
•  » » » » 4 weeks ago, # ^ |   0 Statement clarification is always acceptable. Although as SecondThread mentioned, it is preferable to mention it in the contest itself first. But at the end it depends on the one posting the blog. He might prefer a different community or there might be delay in the response from the problem setter.You can't decide the "way to go" for others. A little flexibility is essential for learning. And if you can't do that just sit tight and ignore the blog. "It is as simple as that".
•  » » » » » 4 weeks ago, # ^ |   0 "Statement clarification is always acceptable." It is not.If you try this on CF while constest you most likely get a ban.
•  » » » » » » 4 weeks ago, # ^ | ← Rev. 2 →   0 In short challenges, the ability to understand the statement quickly is a part of your skills. Whereas, long challenges don't have points for quick submissions. Moreover it is explicitly mentioned on codechef that clarification of problem statements during live contest is okay. Though, they must've been talking about the codechef comment section, but this means that they accept the need for statement clarification. So don't be so tight-assed and let it go.
•  » » » » » 4 weeks ago, # ^ | ← Rev. 2 →   0 It is actually true. I posted for the clarification here when I didn't received the clarification after 5 hours of posting it on codechef. I can't wait for that long each time because that is the time i get for solving problem. Also i find problem setters and admin to be rude on codechef. Sometimes they dont even reply. If the author thinks that explaining is not required then they can say soo but they simply ignore the message. And it happens when people rarely use the comment section. On codeforces i have asked for clarification of some part of problem in contest from the author through ask question section during the contest and they give it instantaneously.
 » 4 weeks ago, # |   0 For any query use the comments section given at the bottom of the page. Make sure to tag the admin.
 » 4 weeks ago, # |   0 Given a string s think of it as a concatination of another string r like r+r+r ... and at last if some elements are left those elements can be prefix of r. eg s = abaabaab so here r = aba so aba+aba+ab(ie prefix of aba) so power of s is the sum of weights of all possible r. eg for ababab: r1 = ab, r2 = abab, r3 = ababab. so P(s) = W(ab)+W(abab)+W(ababab).