everyone can compete in IOI 2013 now http://compete.ioi2013.org/

# | User | Rating |
---|---|---|

1 | tourist | 3882 |

2 | maroonrk | 3539 |

3 | Benq | 3513 |

4 | MiracleFaFa | 3466 |

5 | ksun48 | 3462 |

6 | ecnerwala | 3446 |

7 | slime | 3428 |

8 | Um_nik | 3426 |

9 | jiangly | 3401 |

10 | greenheadstrange | 3393 |

# | User | Contrib. |
---|---|---|

1 | awoo | 192 |

2 | -is-this-fft- | 191 |

3 | Monogon | 184 |

4 | YouKn0wWho | 182 |

4 | Um_nik | 182 |

6 | antontrygubO_o | 171 |

7 | maroonrk | 169 |

8 | kostka | 165 |

9 | SecondThread | 164 |

9 | errorgorn | 164 |

everyone can compete in IOI 2013 now http://compete.ioi2013.org/

↑

↓

Codeforces (c) Copyright 2010-2022 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/24/2022 22:19:47 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

The judge is compiling my submissions over 60 minutes. Is it just a problem with me?

same here.

It's simulation of Australian ioi)

I have a execution time out of many tests. I generate a biggest tests and i have no problems on my machine... Is there someone with that problem?

This is IOI... there are many test cases aimed on making some solutions with average complexity sufficient but worst case insufficient. It's likely that your solution is one of those — it works fine on random tests, but a specially prepared one might make it TLE.

I have found one solution in task dreaming, but it wrongs on 3-4 tests from each subtasks and i cant find my mistake...

Solution: From each component i find the middle vertex ( the vertex which is nearest from its farthest vertex ). I think that the optimal answer is when we connect a middle vertexes from each component to middle vertexes from one of two components with most bigger distance. In this case the answer is L + distances from these two components. But if we connect all middle vertexes to other vertex ( not these two with most bigger distance ) — the answer is 2 * L + two components with most bigger distances. Because of we connect the two most bigger components to other vertex and distance increase with L.

I cant found what is incorrect in this solution.. Someone have a idea?

How do you work around a case when you have a path of length 5 and an isolated vertex and all edge weights equal to 1? It's clear that the optimal solution is joining the center of the path and the isolated vertex, yet this has diameter 4, not 3.

I connect an isolated vertex to the center of the path and with a dfs i find the longest distance in graph, which is 5.

Sorry, 5 not 4. But if you're checking the answer after forming the graph, I don't see what's wrong there.

Your ideas seem to be correct, as far as I understand. You connect all middle vertices with the one for the tree with the largest distance (not sure if this is what you meant).

There might be a bug in your code or you don't check some special case, I don't know.

Do you consider the case when the answer is max(maximum distance from a vertex to another, if those 2 vertexes are in the same connected component)? If you have a tree like this: N = 6 (1-based), M = 4, L = 1, an edge from 1 to 2 with cost 10, an edge from 2 to 3 with cost 10, an edge from 4 to 6 with cost 1, an edge from 4 to 5 with cost 1.

If I understand well, you connect these 2 components with an edge from 2 to 4 with cost L = 1. The answer is not 10 (max dist from node 2) + L + 1 (max dist from node 4) = 12. The correct answer is 20, the distance from node 1 to node 3.

My answer is also 20. I connect 2 and 4 with an edge. After that with dfs i calculate the longest distance. I have written this formulas above to prove that is always better to connect all the middle vertexes with a middle vertex with the max distance.

sometimes the diameter of the tree is in a pre-existing compenet

How do you answer this case:

Connect 4 or 5 with 2, and the answer is 20. Maybe is something wrong in my code, but my time expired...

ok.

I think that the optimal answer is when we connect a middle vertexes from each component to middle vertexes from one of two components with most bigger distance_ __sometimes connecting the centers with the node that has second maximum distance is not optimal , you should connect the centers with the node that has maximum distance

I'm connecting with the first maximum, but why the second is not optimal? When you connect all middle-vertexes with second maximum — the first maximum is included also. The smaller maximums are out of the game, because their sum is always smaller than two of the most bigger. I think that the possible answers are always two ( if you connecting two of most bigger distances with L, or you connecting them to other vertex and the answer is increasing with L ).

You are right! Thanks for the explanation :)

The wrong was in my source... Now I have 100 :)

What kind of data structure is needed to obtain full score on Problem "Robots" ? I think it shouldn't be too fancy. My solution passed the first 4 subtasks with a time complexity of

O(T* (A+B)) using only plain arrays as data structures.I only used STL structures. This is not a task focused on data structures, but on algorithms.

Thank you. It seems that my 90-point solution is different from the intended 100-point solution for this task and thus can't be improved.