## 889 - Islands

Moderator: Board moderators

poti
New poster
Posts: 3
Joined: Mon Mar 06, 2006 5:48 pm

### 889 - Islands

i am stuck on this problem for days.

my solution is like this.

1. find the shortest distance between polygons.

2. Considering polys as veritces and their distance as edges i find the MST

can anyone tell me why i get wrong answer?

p.s. i code pascal and for the rounding i do sth like this
writeln(output, result:0:3)

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
The fact that you recieve "wrong answer" when submitting Pascal code can also mean that you actually get "runtime error"; the judge doesn't handle that properly. So be careful for division by zero and array boundary errors, they both lead to WA.
If you're still desparate, please publish your code, or send it to me by PM.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.

koukaipan
New poster
Posts: 1
Joined: Fri Dec 29, 2006 5:48 pm

### 889 Islands

i am trying to solve this problem,

my algorithm is :
1. find the shortest path between polygons
2. find the minimum spanning tree

but got WA many times..

could someone give some data for test, please??

thank you~

jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia
One more problem can be here, when we try submit Pascal code. I submitted code in Pascal, I got TLE (3.000). I rewrite my code to C and have AC in 1.890. That means, the input is huge and Pascal I/O is too slow for testing input of this problem.

Maybe my algorithm is not effective, but in C it is enough (in Pascal not).