ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1461. Christmas Garland

Strange printf behavior
Posted by it4.kp 12 Aug 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
Posted by Todor Tsonkov 13 Aug 2006 02:22
Well, I got WA 3 during the contest but I'm pretty sure my idea is right, ahy tests ?
Re: Strange printf behavior
Posted by it4.kp 13 Aug 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
Posted by butterfly 13 Aug 2006 08:02
Please help me.
I still get WA on test 3
Re: Strange printf behavior
Posted by Todor Tsonkov 13 Aug 2006 11:05
I'm a loser :(

Edited by author 31.07.2007 15:38
Re: Strange printf behavior
Posted by it4.kp 13 Aug 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
Posted by Anton [SUrSU] 13 Aug 2006 19:51
Give me some tests please
I've WA #3
P.S. And what about tests with N = 1?
Re: Strange printf behavior
Posted by it4.kp 13 Aug 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
Posted by Todor Tsonkov 13 Aug 2006 21:30
Thanks for the tests, it turned out that I have misread the problem :(, anyway, thanks for your help
Re: Strange printf behavior
Posted by Pio (Pio@mail.by) 13 Aug 2006 21:44
Test 5 incorrect!!!
Re: Strange printf behavior
Posted by Denis Koshman 12 Aug 2008 04:17
Just feed output as input till it's "No solution" and see results. It might help finding bugs.