Processing math: 100%
GCD pairs counting - MarisaOJ: Marisa Online Judge

GCD pairs counting

Time limit: 1000 ms
Memory limit: 256 MB
Given a sequence of integers A consisting of n elements. For each integer i from 1 to n, count how many pairs of integers in sequence A have the greatest common divisor (GCD) equal to i. ### Input - The first line contains an integer n. - The second line contains n integers Ai. ### Output - Output n integers, where the ith integer is the number of pairs of integers with the smallest GCD equal to i. ### Constraints - 1≤n≤106. - 1≤Ai≤n ### Example Input: 851568835 Output: 212103001