Блог пользователя Failure-Man

Автор Failure-Man, история, 10 лет назад, По-английски

there are many problems like. https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3743

but every time i failed to solve this type. is there any algorithm to solve this type of problem????

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It's a greedy algorithm task. I used the following approach: sort intervals by their left border, and keep up the value of maximal prefix of covered points. To update it, find a new interval that will continue the prefix without no gaps, with maximal right border.

The code I got accepted with: #code.