goatgm03's blog

By goatgm03, history, 4 years ago, In English

Hi guys. I finished solving this problem yesterday and for some reason I am getting runtime error ron test 2. Does anyone know why this is the case? My solution basically uses the same principle as the editorial. Basically, I sorted the positions of miners and positions of the mines in ascending order. Then I matched each miner on the y-axis with the mine on the x-axis with the same array index. For example miner[1] with mine[1],miner[2] with mine[2 and so on. Then I got the euclidian distance between the two points which in this problem is stated to be the energy needed for the miner to travel to his mine.

Afterwards, I summed all the energies of each miner to find the minimum total energy for each test case.

Here is my solution. 117154208

  • Vote: I like it
  • -8
  • Vote: I do not like it

| Write comment?