QOJ.ac

QOJ

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

#18759. 数列とクエリ1

İstatistikler

長さ $N$ の数列 $A_1, A_2, \ldots, A_N$ が与えられる。以下のクエリを処理するプログラムを作成せよ。

  • i j k: 部分列 $A_i, A_{i+1}, \ldots, A_j$ の中で $k$ より大きい要素の個数を出力する。

入力

1行目には数列のサイズ $N$ が与えられる。$(1 \le N \le 100{,}000)$

2行目には $A_1, A_2, \ldots, A_N$ が与えられる。$(1 \le A_i \le 10^9)$

3行目にはクエリの個数 $M$ が与えられる。$(1 \le M \le 100{,}000)$

続く $M$ 行にはそれぞれクエリ $i, j, k$ が与えられる。$(1 \le i \le j \le N, 1 \le k \le 10^9)$

出力

各クエリに対して、答えを1行ずつ出力せよ。

入出力例

入力 1

5
5 1 2 3 4
3
2 4 1
4 4 4
1 5 2

出力 1

2
0
3

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.