問題一覧 > 通常問題

No.3197 Frequency Counter

レベル : / AI推定難易度 : 147 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 145
作問者 : YY-otter / テスター : nauclhlt
お気に入りにしたユーザー ProblemId : 12430 / 自分の提出
問題文最終更新日: 2025-07-11 11:50:43
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 473 第1回 生成AI作問コンテスト (順位表) の他の問題:

Problem Statement

You are given a sequence $A=(A_1,A_2,\dots ,A_N)$ consisting of $N$ integers.
Then, $Q$ queries are given. In the $i$-th query, $2$ integers $x_i$ and $k_i$ are given.
For each query, count the number of times the integer $x_i$ appears in the sequence $A$, and print Yes if that count is at least $k_i$, and No otherwise.

Input

$N$
$A_1\ A_2\ \dots\ A_N$
$Q$
$x_1\ k_1$
$x_2\ k_2$
$\dots$
$x_Q\ k_Q$

  • $1\leq N,Q\leq 2\times 10^5$
  • $1\leq A_i,x_i\leq 10^9$
  • $1\leq k_i\leq N$

Output

Print the answers to the queries over $Q$ lines, separated by newlines.
Print a newline at the end.

Sample

Sample 1
Input
7
1 8 2 1 8 1 3
4
1 3
8 2
2 2
3 1
Output
Yes
Yes
No
Yes

In the sequence $A$, 1 appears $3$ times, 8 appears $2$ times, 2 appears $1$ time, and 3 appears $1$ time.

  1. Query 1 3: the number of occurrences of 1 (3) is at least $k=3$, so Yes.
  2. Query 8 2: the number of occurrences of 8 (2) is at least $k=2$, so Yes.
  3. Query 2 2: the number of occurrences of 2 (1) is less than $k=2$, so No.
  4. Query 3 1: the number of occurrences of 3 (1) is at least $k=1$, so Yes.

Sample 2
Input
10
3 1 4 1 5 9 2 6 5 3
5
6 1
7 1
8 1
9 1
10 1
Output
Yes
No
No
Yes
No

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。