問題一覧 > 教育的問題

No.8016 The One Who Tries Its Best to Break unordered_map

レベル : / AI推定難易度 : 243 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 48 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 86
作問者 : zeosutt
お気に入りにしたユーザー ProblemId : 1148 / 自分の提出
問題文最終更新日: 2026-06-28 05:07:40
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

Notes

  • This problem is intended for C++ only. For certain reasons the memory limit is set quite tight, so depending on the language you will get MLE no matter what (it has been increased from 10MB to 48MB; this should be fine in most cases).
  • This problem is not intended to make code with a custom-defined hash function fail (in the system tests).
Thank you for your understanding.

Problem Statement

You are given $N$ integers $A_1, A_2, \cdots, A_N$ and $M$ integers $B_1, B_2, \cdots, B_M$.
Let $C_i$ be the number of elements among $A_1, A_2, \cdots, A_N$ that are equal to $B_i$.
Find $C_1, C_2, \cdots, C_M$.

Input

The first line contains $N$ and $M$, separated by a space.
The second line contains $A_1, A_2, \cdots, A_N$, separated by spaces.
The third line contains $B_1, B_2, \cdots, B_M$, separated by spaces.

$N\ M$
$A_1\ A_2\ \cdots\ A_N$
$B_1\ B_2\ \cdots\ B_M$

All input values are integers.
$1 \leq N, M \leq 10^5$
$0 \leq A_i \leq 10^{12}\ (i = 1, 2, \cdots, N)$
$0 \leq B_i \leq 10^{12}\ (i = 1, 2, \cdots, M)$

Output

Output $C_1, C_2, \cdots, C_M$, separated by spaces.

Sample

Sample 1
Input
4 3
3 2 4 1
2 10 4
Output
1 0 1
Sample 2
Input
3 5
1 1 1
1 1 1 1 1
Output
3 3 3 3 3
Sample 3
Input
2 2
0 1000000000000
0 1000000000000
Output
1 1

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