Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя Whitewiz

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

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

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

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

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

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

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

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

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

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

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