1. 程式人生 > >HDU 6136 優先佇列 模擬

HDU 6136 優先佇列 模擬

> During the Trade Federation invasion of Naboo, Anakin Skywalker won the Boonta Eve Classic on Tatooine, securing his freedom from a life of slavery. Betting on the races was a popular pastime with many of the watchers on Tatooine and it was through Qui-Gon Jinn's bet with Watto that Skywalker would win the race that Skywalker was freed.
>
> — Wookieepedia

Here comes the most awesome racing in the universe! Little Anakin sits in his own podracer, breathing deeply. He must win.

The real podracing is deadly. In this circular track (again L in length), participants start in distinct locations and race with distinct speeds (the speed can be positive and minus, which means running clockwise and counterclockwise). Every podracer is equipped with a powerful weapon system respectively -- all for triumphing over enemies!!! yes! enemies!

If two competitors meet, which means that they reach an identical location simultaneously, the one with less powerful weapon system will be destroyed and be knocked out of the racing -- dead or alive. The power of the i
-th participant is exactly i, and because each person runs with a distinct speed, so there must be a winner. 

The racing stops when there is only one person still running in the track -- our winner! The others are crushed into pieces.

Little Anakin wants to know, when the racing will stop.