Full score: 100 Input file name: in.txt or standard input stream Output file name:…
- User
Full score: 100 Input file name: in.txt or standard input stream Output file name: out.txt or standard output stream Time limit: 1s Physical memory limit: 256M Stack size limit: 256M Divide by target! Time limit per test: 1 second Memory limit per test: 256 megabytes Olya loves reading books, so she was incredibly excited when she heard about a new promotion at the bookstore “The Whole part. The store sells n books, the i-th of which has a theme indicated by the number ai. The promotion is as follows: the administration of the store will name the number x, after which Olya can come and get some books for free. According to the terms of the promotion, the books chosen by Olya must be sufficiently uniform, i.e. they must have the same value of bi = [ai/x], (ai divided by x). Olya is interested in the largest number of books she can get for free. Since the number x is not known in advance, Olya asks you to calculate the answer for q possible options. Input data The first line of input contains a single integer n - the number of books in the store. (1 <= n <= 300000) The second line of input contains n integers ai - topics of books. (1 <= ai <= 300000). The third input line contains a single integer q - the number of requests. (1 <= q <= 300000). The fourth input line contains q integers xi - values of x, in which Olya is interested. (1 <= x <= 300000). Output data Print q numbers separated by spaces - the largest possible number of books that Olya can get in each case. Evaluation system Solutions that work correctly when n,q <= 100 will get at least 36 points. Solutions that work correctly when x <= 100 will receive at least 24 points.
Example Input data: 5 1 2 3 4 5 4 1 2 5 6 Output data: 1 2 4 5
Note In the example, the array b will have the following values depending on x:
- When x = 1 b = [1, 2, 3, 4, 5]
- When x = 2 b =[0, 1, 1, 1, 2, 2]
- At x = 5 b =[0, 0, 0, 0, 0, 1]
- At x = 6 b = [0, 0, 0, 0, 0, 0]
- Assistant