QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#18777. 수열과 쿼리 19

Statistiques

Дана последовательность $A_0, A_1, \ldots, A_{n-1}$ длины $n$. Напишите программу, выполняющую следующие запросы:

  • 1 l r c: Прибавить $c$ ко всем $A_i$ на отрезке $l \le i \le r$.
  • 2 l r d: Заменить все $A_i$ на отрезке $l \le i \le r$ на $\lfloor A_i/d \rfloor$.
  • 3 l r: Вывести минимум среди всех $A_i$ на отрезке $l \le i \le r$.
  • 4 l r: Вывести сумму всех $A_i$ на отрезке $l \le i \le r$.

где $\lfloor x \rfloor$ обозначает наибольшее целое число $y$ такое, что $y \le x$ (например, $\lfloor -2.5 \rfloor = -3$, $\lfloor -7 \rfloor = -7$).

Входные данные

Первая строка содержит два целых числа $n$ и $q$ ($1 \le n, q \le 100{,}000$) — длину последовательности и количество запросов.

Вторая строка содержит $n$ целых чисел $A_0, A_1, \ldots, A_{n-1}$ ($-10^9 \le A_i \le 10^9$).

Каждая из следующих $q$ строк содержит запрос ($0 \le l \le r \le n-1$, $-10^4 \le c \le 10^4$, $2 \le d \le 10^9$).

Выходные данные

При каждом запросе типа 3 или 4 выведите один ответ в отдельной строке.

Примеры

Входные данные 1

10 10
-5 -4 -3 -2 -1 0 1 2 3 4
1 0 4 1
1 5 9 1
2 0 9 3
3 0 9
4 0 9
3 0 1
4 2 3
3 4 5
4 6 7
3 8 9

Выходные данные 1

-2
-2
-2
-2
0
1
1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.