Problem J (Platform Placing) from NAQ 2023

Правка en2, от SAT2020, 2023-02-12 05:31:00

Hi Everyone!

I hope you're all having a great day!

Last week, I participated in NAQ 2023. After the contest, I've been trying to upsolve Problem J (Platform Placing), but I keep getting WA on test case 6.

Here is a link to my code.

And here is a high-level summary of my code (problemB()):

  1. Read the input. Add (1e18) and (-1e18) to the set of platforms to represent extra space for the first and last platforms.

  2. Sort the array.

  3. Iterate through and expand the current platform as much as possible.

  4. Add the length to our result and record the increased size of the platform.

This is similar to the greedy approach that the contest authors offer, but for some reason, it continues to fail! If anyone could help me out with what is going wrong here, it would be very appreciated.

Thanks!

Simon

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский SAT2020 2023-02-12 05:33:18 44
en2 Английский SAT2020 2023-02-12 05:31:00 4 Tiny change: 'ions/10468569).\n\nAnd ' -> 'ions/10468845).\n\nAnd '
en1 Английский SAT2020 2023-02-12 05:20:57 995 Initial revision (published)