Page 1 of 1

11325 - This Means War!

Posted: Tue Oct 30, 2007 11:45 am
by rio
This problem looks simple, and the coding was not so complex, but getting WA..
Re-read the problem description few times, but I think my interpretation of the game rule is correct..

Is there a tricky test case ?

Thanks in advance.
----
Rio

Posted: Tue Oct 30, 2007 10:05 pm
by sclo
The most tricky thing is the end condition:
Normally, when a war is started, the current and the next 3 cards of each player are discarded into the center.

Note that war can't be started with the very last card.
Otherwise if a war is started with the last i card i>=2, then the next min(i-2,3) cards are discarded.

Other than that, I just used backtracking with some greedy stuff.

Posted: Wed Oct 31, 2007 3:46 am
by rio
Thanks sclo. I got AC.

I am stupid :oops: I was discarding min(3,i-2) week cards when war occur.
After all, I noticed that this choice is not optimal, and also there was no need to actually discard.

----
Rio

Posted: Fri Nov 09, 2007 1:15 pm
by Vendetta
would you please give me a random input and output ? :( (the bigger, the better)
i can't understand why i'm getting wrong answer

Posted: Sat Nov 10, 2007 5:52 am
by Vendetta
got AC
a real stupid mistake :oops:

Re: 11325 - This Means War!

Posted: Tue Oct 13, 2015 12:28 pm
by red_apricot
The judge I/O is incomplete. For example, for input

Code: Select all

1
3S 7H KD 4S 6S AD 7D 4C AS JD 2H 3C 4H 2C 7C AH 5S 2D 6C 8S AC 5C 7S KS QC TD
my Accepted program outputs "no", but uvatoolkit yields "yes".