How do we solve this problem?

Правка en3, от Eyes_on_me, 2024-07-13 16:53:19

Given an array of infinite length having all elements as 0. 2 numbers N,K. In the next N lines , 3 integers are given : l, r, and x you have to add x to all the elements in the range l to r (inclusive)

Your task is to find a subsequence that satisfies all the given conditions :

  • Subsequence size should be maximum

  • Lexicographically minimum

  • it must form an arithmetic progression i.e [z, z + k, z + 2k, z + 3k,..., z + (l — 1)k] here z is an arbitrary number and k is given in the input (see line 2) and l is the length of the subsequence.

META DATA : 1 <= x <= 1e9;

1 <= l <= r <= 1e9;

1 <= N <= 2e5;

note that N is not the length of the array

Any kind of help will be highly appreciated, thanks

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский Eyes_on_me 2024-07-13 17:40:57 20
en4 Английский Eyes_on_me 2024-07-13 16:54:10 7
en3 Английский Eyes_on_me 2024-07-13 16:53:19 6
en2 Английский Eyes_on_me 2024-07-13 16:52:51 9
en1 Английский Eyes_on_me 2024-07-13 16:51:18 769 Initial revision (published)