Codeforces Beta Round 85 (Div. 2 Only)
D
Petya and Divisors
Codeforces
未评级
原题
← CE →
翻译中…

Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:

翻译中…

You are given $*n*$ queries in the form "$*x*_{*i*}$ $*y*_{*i*}$". For each query Petya should count how many divisors of number $*x*_{*i*}$ divide none of the numbers $*x*_{*i* - *y*_{*i*}}, *x*_{*i* - *y*_{*i*} + 1}, ..., *x*_{*i* - 1}$. Help him.

翻译中…

Input

翻译中…

The first line contains an integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$). Each of the following $*n*$ lines contain two space-separated integers $*x*_{*i*}$ and $*y*_{*i*}$ ($1 ≤ *x*_{*i*} ≤ 10^{5}$, $0 ≤ *y*_{*i*} ≤ *i* - 1$, where $*i*$ is the query's ordinal number; the numeration starts with $1$).

翻译中…

If $*y*_{*i*} = 0$ for the query, then the answer to the query will be the number of divisors of the number $*x*_{*i*}$. In this case you do not need to take the previous numbers $*x*$ into consideration.

翻译中…

Output

翻译中…

For each query print the answer on a single line: the number of positive integers $*k*$ such that image

翻译中…

Note

翻译中…

Let's write out the divisors that give answers for the first 5 queries:

翻译中…
  1. 1, 2, 4
翻译中…
  1. 3
翻译中…
  1. 5
翻译中…
  1. 2, 6
翻译中…
  1. 9, 18
翻译中…

样例

Input #1
6
4 0
3 1
5 2
6 2
18 4
10000 3
Output #1
3
1
1
2
2
22
InputCopy OutputCopy
题目信息
题号
112D
时间限制
5 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。