Whitewiz's blog

By Whitewiz, history, 4 months ago, In English

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;

1 <= k <= 1e9;

Note that N is not the length of the array

Any kind of help will be highly appreciated, thanks

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Whitewiz (previous revision, new revision, compare).

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Whitewiz (previous revision, new revision, compare).

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Whitewiz (previous revision, new revision, compare).

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Whitewiz (previous revision, new revision, compare).