11793 - Electoral Districts

All about problems in Volume 117. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
SmartMan
New poster
Posts: 3
Joined: Sun Nov 15, 2009 8:17 am

11793 - Electoral Districts

Post 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.
greve
New poster
Posts: 27
Joined: Tue May 29, 2007 8:52 pm
Contact:

Re: 11793 - Electoral Districts

Post by greve »

The answer given in the sample output is not correct. The correct answer is -1. Fortunately the judge data is fine.
For help with problems, visit http://www.uvatoolkit.com/
SmartMan
New poster
Posts: 3
Joined: Sun Nov 15, 2009 8:17 am

Re: 11793 - Electoral Districts

Post by SmartMan »

Okay! Thank you very much! =)
Post Reply

Return to “Volume 117 (11700-11799)”