QOJ.ac

QOJ

Süre Sınırı: 1 s Bellek Sınırı: 1024 MB Toplam puan: 100

#18803. Ciąg i Zapytania 45

İstatistikler

Dana jest tablica $A$ o długości $2 \times 10^9 + 1$. Indeksy $A$ są liczbami całkowitymi z zakresu $[-10^9, 10^9]$. Początkowo wszystkie elementy $A$ są równe $0$ (tzn. $A[-10^9] = A[-10^9+1] = \ldots = A[10^9] = 0$).

Tablica otrzymuje $q$ zapytań następujących dwóch typów:

  • 1 x y: Dla wszystkich $-10^9 \le i \le 10^9$ ustaw $A[i] = A[i] + |i - x| + y$.
  • 2: Wypisz indeks $m$ pierwszego wystąpienia minimalnej wartości $A$ oraz $A[m]$. (Pierwsze wystąpienie oznacza najmniejszy indeks.)

Wejście

Pierwszy wiersz zawiera liczbę całkowitą $q$ ($1 \le q \le 2 \times 10^5$).

Następne $q$ wierszy zawiera po jednym zapytaniu w jednej z powyższych postaci ($-10^9 \le a, b \le 10^9$).

Pierwsze zapytanie jest zawsze postaci 1 x y.

Wyjście

Dla każdego zapytania typu 2 wypisz indeks $m$ pierwszego wystąpienia minimalnej wartości $A$ oraz $A[m]$, oddzielone spacją.

Przykład

Wejście 1

4
1 4 2
2
1 1 -8
2

Wyjście 1

4 2
1 -3

Wejście 2

4
1 -1000000000 1000000000
1 -1000000000 1000000000
1 -1000000000 1000000000
2

Wyjście 2

-1000000000 3000000000

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.