#SP0000090. Petya và các ước số (Petya and Divisors)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Petya và các ước số (Petya and Divisors)
Petya and Divisors
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Process queries in order. Query gives . Count the positive divisors of that divide none of the preceding numbers . If , all positive divisors of count. The previous numbers are part of the same query sequence.
Input
The first line contains . The -th of the following lines contains , indexed from .
Output
Print lines; line gives the answer for query .
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
6
4 0
3 1
5 2
6 2
18 4
10000 3
Output
3
1
1
2
2
22
Explanation
Query 1: all divisors of count, giving . Query 2: only divisor of does not divide the preceding , giving . Query 3: only divisor of avoids both and , giving . Query 4: for , the acceptable divisors are , giving . Query 5: for , the acceptable divisors are , giving . Query 6 has divisors of which divide none of .