Strange printf behavior
Послано
it4.kp 12 авг 2006 20:48
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?
Re: Strange printf behavior
Well, I got WA 3 during the contest but I'm pretty sure my idea is right, ahy tests ?
Re: Strange printf behavior
Послано
it4.kp 13 авг 2006 03:27
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.
Re: Strange printf behavior
Please help me.
I still get WA on test 3
Re: Strange printf behavior
I'm a loser :(
Edited by author 31.07.2007 15:38
Re: Strange printf behavior
Послано
it4.kp 13 авг 2006 14:08
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!
Re: Strange printf behavior
Give me some tests please
I've WA #3
P.S. And what about tests with N = 1?
Re: Strange printf behavior
Послано
it4.kp 13 авг 2006 20:34
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
Re: Strange printf behavior
Thanks for the tests, it turned out that I have misread the problem :(, anyway, thanks for your help
Re: Strange printf behavior
Test 5 incorrect!!!
Re: Strange printf behavior
Just feed output as input till it's "No solution" and see results. It might help finding bugs.