11793 - Electoral Districts
Posted: Tue May 25, 2010 9:52 am
Hi, could someone please explain the third sample input for this problem, I must be misunderstanding the problem somehow.
Input:
Output:
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)
But this does not fit with the following restraint:
Input:
Code: Select all
3
1 2 1
2 1 2
1 2 1
2 1 2
1 2 1
2 1 2
Code: Select all
1
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
Any insights would be appreciated. Thanks.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.