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 1155. Troubleduons

Is it right?
Posted by Burunduk1 9 May 2005 12:23
My solution:
1. (A+C+F+H)-(B+D+E+G)=const => if const!=0 then IMPOSSIBLE
2. While we have to destroy some we do two operations. (3,4)
   3. If we can do one of (AB, BC, CD, DA, EF, FG, GH, HE, AE, BF, CG, DH)- we do it.
   4. If AG => BF+ AB- GF-
      If BH => CG+ BC- HG-
      If CE => DH+ CD- EH-
      If DF => AE+ DA- FE-

Why it gets WA #5?
Is it wrong algorithm or wrong realization?

My code:

Here was nearly AC code :)

Edited by author 30.05.2005 05:31
Or give me some tests
Posted by Burunduk1 10 May 2005 15:09
Re: Or give me some tests
Posted by bug27 10 May 2005 17:17
though I don't know what "2. While we have to destroy some we do two operations. (3,4)" mean, I think you solution is right,because I got AC in the same way.maybe there's some bugs in your code.
not perfectly
Posted by Dilyan 13 May 2005 23:30
2, 3 and 4 are right.
1 is wrong. const may be different from 0 when there is a solution
Re: not perfectly
Posted by Burunduk1 14 May 2005 02:43
Are you sure? Can you give me example?

I can prove it:
We process operation with pair of vertexes.
The one is in {A,C,F,H} another is in {B,D,E,G}.
So (A+C+F+H)-(B+D+E+G)=const
Supose we already annighilated all 'troubles' then
A=B=C=D=E=F=G=H=0 => const=0 =>
If const is not equal to zero we can't annighilate all 'troubles' => IMPOSSIBLE

What is wrong in it?
Now it is AC
Posted by Burunduk1 30 May 2005 05:29
Algorithm is Ok, but in my code was one misprint.