How do we solve this problem?

Revision en4, by Eyes_on_me, 2024-07-13 16:54:10

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English Eyes_on_me 2024-07-13 17:40:57 20
en4 English Eyes_on_me 2024-07-13 16:54:10 7
en3 English Eyes_on_me 2024-07-13 16:53:19 6
en2 English Eyes_on_me 2024-07-13 16:52:51 9
en1 English Eyes_on_me 2024-07-13 16:51:18 769 Initial revision (published)