All Tracks Problem

Ross , Rachel and Dilemma
Tag(s):

Easy

Problem
Editorial
Analytics

Ross , Rachel and Dilemma

enter image description here

Ross is in a big tragedy. I hope that you all guessed that it is related to Rachel. Rachel has asked for roses, but then she is extremely picky and she exchanges the gifts she gets , if she does not like them.

Ross does not want Rachel to exchange his gifts. Ross is a scientist and hence is therefore a brainiac. He came up with an extremely good plan. He knows Rachel very well and therefore knows what he has to do in order to give Rachel an extremely good gift. He decided that he will give Rachel flowers.

The problem now is Rachel wants that each of the color of roses occurs a fix number of times. If Ross fails to do so, she will not accept the gifts. She will ask Ross the count of a particular flower, by asking this a number of times she will be able to know whether the flower sequence is ideal or not.

So now Ross, has to give an ideal flower series and hope that this time Rachel does not change her gift for something else and definitely does not change Ross for that matter. Each type of rose is denoted by a number. The input consists of series of numbers A[i] , each denoting a type of rose. Then occurs the count of query q. Then q lines follow each having a certain number denoting a type of rose R. Give the count of each type of rose.

Input:
First line contains T – Number of test cases, each test case conains
N - Number of flowers in series.
Then a line containing N integers followed by an integer Q - Number of queries
Then Q lines each containing a number denoting a kind of rose.

Output:

On each line output of each query.

Constraints:
\( 1 \leq T \leq 10 \)

\( 1 \leq N,Q \leq 10^{5} \)

\( 1 \leq A[i],R \leq 10^{9} \)

Problem Setter - Satyarth

SAMPLE INPUT
1
6
1 1 2 2 2 4
3
1
2
3
SAMPLE OUTPUT
2
3
0
Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), TypeScript, Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:
Notifications
View All Notifications

?