Submit | All submissions | Best solutions | Back to list |
EI20213Q3B - Index of numbers (2) |
You are given n integers and m queries. For each query, you are given a number p, you should output the number of distinct values that each of them occurs at least p times in given integers.
Input
-
The first line contains two integers n, m (1 ≤ n, m ≤ 105).
-
The second line contains n integers (-109 ≤ ai ≤ 109).
-
The third line contains m integers representing m queries 1 ≤ pj ≤ n).
Output
For each query, output the number of distinct values that occurs at least p times.
Sample
Added by: | Ha Minh Ngoc |
Date: | 2021-07-10 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |