| 
 | 
Why is the correct answer in the example "uhhdud" and not "uhdudh"?   in terms of lexicographic order, this combination is closer to the original data. It's not next in the book, it's before. d < h < u There is no correct input for N=1. Strange but when i use   printf("%s",s.c_str());   I get WA on test 11, but if change it to   cout<<s;   it's become AC.   Can somebody tell me why? Well, I got WA 3 during the contest but I'm pretty sure my idea is right, ahy tests ? I first, have WA3 too.   That was because I misunderstood the problem statement... I thought that there cannot be two consecutive segments with y=0 which is wrong. Please help me. I still get WA on test 3   I'm a loser :(   Edited by author 31.07.2007 15:38 I don't know why you have WA, but even if you fix all your bugs you definetly get TLE, since next_permutation works in exponential time and the length of string could be 100000! Give me some tests please I've WA #3 P.S. And what about tests with N = 1? Here are some tests   Test 1: 4 uudd   Answer 1: No solution   Test 2: 4 uhhd   Answer 2: uudd   Test 3: 8 udududud   Answer 3: ududuhhd   Test 4: 32 uuuuuuuuuudddddduuuuuudddddddddd   Answer 4: uuuuuuuuuudddddhdddddududududuhd   Test 5: 41 uuuuuuduuuuuddddddduuuuuuuuuhdddddddddddd   Answer 5: uuuuuuduuuuuddddddhddddududududududududud   Test 6: 15 uuuuuuuhddddddd   Answer 6: No solution   p.s.: there is no tests with n=1. EDIT: Test 5 is correct now   Edited by author 13.08.2006 22:01 Thanks for the tests, it turned out that I have misread the problem :(, anyway, thanks for your help Test 5 incorrect!!! Just feed output as input till it's "No solution" and see results. It might help finding bugs. AAAAAAAAAAAAAAAAA!   My wrong program output "No sollution" instead of "No solution"!!! And I has WAed 2 by 4 times!   I tried to solve this task on the contest, but has found this bug just now!  |  
  | 
|