Interesting (actually not) range queries problem.

Правка en1, от omoyamo, 2019-11-11 21:03:13

In some close russian circles this task was born. Can you solve it?

You have an array of length N of non-negative integers. Also you have to answer Q queries.

Query (L, R) — you have to find a max[ lcm(A, B) — gcd(A, B) ], where A and B — some elements of segment (L, R) (not necessarily of different index). Consider gcd(0, 0) = 0, lcm(0, 0) = 0.

N <= 10^5, Q <= 10^5

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский omoyamo 2019-11-11 21:06:30 36 Tiny change: ' <= 10^5\n\n' -> ' <= 10^5\n#### Write your ideas in comments.'
ru3 Русский omoyamo 2019-11-11 21:05:31 41 Мелкая правка: ' <= 10^5\n' -> ' <= 10^5\n\n#### Напишите свои идеи в комментариях.'
en1 Английский omoyamo 2019-11-11 21:03:13 472 Initial revision for English translation
ru2 Русский omoyamo 2019-11-11 20:52:11 46 Мелкая правка: ' q <= 10^5' -> ' q <= 10^5\n#### (считать что gcd(0, 0) == 0 и lcm(0, 0) = 0'
ru1 Русский omoyamo 2019-11-11 19:12:46 388 Первая редакция (опубликовано)