Page 1 of 1

11793 - Electoral Districts

Posted: Tue May 25, 2010 9:52 am
by SmartMan
Hi, could someone please explain the third sample input for this problem, I must be misunderstanding the problem somehow.
Input:

Code: Select all

3
1 2 1
2 1 2
1 2 1
2 1 2
1 2 1
2 1 2
Output:

Code: Select all

1
It is clear that it is impossible for any of the districts to tie. Thus, A must win 2 of the districts and B must win 1 district. But how can this happen?

The only way I can see that A will win two is if we group them this way (Basically pick two corners as two of the districts, and the third district is the diagonal)

Code: Select all

X X Y
X Y Z
Y Z Z
But this does not fit with the following restraint:
The zones of a district are adjacent, that is, we can reach all the zones of a same district by moving to the left, right, up or down.
Any insights would be appreciated. Thanks.

Re: 11793 - Electoral Districts

Posted: Tue May 25, 2010 2:32 pm
by greve
The answer given in the sample output is not correct. The correct answer is -1. Fortunately the judge data is fine.

Re: 11793 - Electoral Districts

Posted: Tue May 25, 2010 5:34 pm
by SmartMan
Okay! Thank you very much! =)