Your dis variable is of type "real". So when you compare it to 100 using the <= operator, things will break if dis=100.0000001. I couldn't find any other mistakes on first glance. I've never used pascal, and I don't have a pascal compiler. Otherwise, I could try running your solution on the official input data to see where the mistake is.

If only I had as much free time as I did in college...

I don't think you understood the problem correctly.

"If it is impossible to get from some town to some other town" means "If there exists a pair of towns T and U such that it is impossible to get from T to U".

If only I had as much free time as I did in college...

1. connects all which d<=100 (long)
2. sqrt the distance for them
3. floyd it
4. if its not connected, send kurdy
5. if it is, check for the biggest distance
6. round it, print it

Technobug: When using Floyd-Warshall, the order in which you nest the cycles matters. Yours is wrong. The k-cycle must be the outermost one.

Note that in the correct implementation, after running the k-cycle x times the value in d[p][q] is the shortest p-q path such that all intermediate vertices have numbers not exceeding x. (This is how the algorithm works )

Also, if you initialize d[j] to a sufficiently large value for i!=j, you may omit the con[][] array from your solution completely. Not that this matters but the presence of the con[][] array makes your implementation unnecesarilly complicated.

There is a bug in your rounding. Your code always rounds the answers down to the nearest integer, so if the correct answer is 98.4567, your code will print 98.0000.

If only I had as much free time as I did in college...