KFOLD - Editorial

Can anyone please tell me where my code is giving wrong answer.
my code link-
https://www.codechef.com/viewsolution/37111844
Can anycone please provide me the test case where it is giving WA?

Video Explanation : K-Foldable String || CodeChef August Cook-Off 2020 || CODECHEF - YouTube

check the spelling of IMPOSSIBLE

1 Like

I tested the solution and itā€™s giving answer 1.

can someone please tell me whats wrong with my code? And also did we have to sort the string if N==K?
https://www.codechef.com/viewsolution/37110227

np bruh

If any one wants video editorial of this poblem can refer to the following link.

Video editorial of k-Folded String

Can anyone tell me why the solution says ā€œIMPOSSIBLEā€ for this testcase?
1
11 4
00001110000
The ans could be 00000000111 ?

test case is wrong as 11 is not divisible by 4, and in problem statement it is mentioned that N is divisible by K

Oh thanks i got it ,my bad i didnā€™t read the problem statement correctly.

But why according to problem statement the prefix is not possible so no check can be done for condition S[i] == S[2*K-i+1] so there is no collision possible so in this situation the input itself should be the answer as (possibly leaving this string unchanged) is mentioned in problem statement

You need the lexicographically smallest string which will always be like 000ā€¦0011ā€¦111. The input is not always in this form.

OMGā€¦thanks a lot !
Thatā€™s why problems should ask us ti print YES or NO.
Still my mistake shouldā€™ve been careful .

Can any1 tell why my soln CodeChef: Practical coding for everyone is giving WA?

please tell why it is not acceptedā€¦
https://www.codechef.com/viewsolution/37117977

Is it possible that string contains only ā€˜1ā€™ or ā€˜0ā€™ ?

The editorials are awesome but what is wrong in this soulution?
Also i realize that with checking with the while loop i can also check with the factor but at that time according to my solution i got that idea which i think is correct and if wrong then please correct me.
https://www.codechef.com/viewsolution/37111031

I think yes because for k=1 the answer will exist only if all elements are either 1 or 0

Can anyone find the problem in my solution. WA is being shown
[SOLUTION]
https://www.codechef.com/viewsolution/37120153
Thanks in advance.

s=01011010 ,k=8;
our goal is to reorder character of string such that the string is k-foldable, the given string is already k-foldable as no checks are required since length of k and string are equal , but also every permutation of given string will be k-foldable and we need lexicographically smallest string for multiple answers which will be 00001111