PBIGNUM - Big number only

no tags 

We call:
F1(x,y) is x*y. F2(x,y) is x/y if x/y is an integer, else it is 1. F3(x,y) is the max number k that x/k,y/k are integer. F4(x,y) is the min number k that more than 0 and k/x,k/y are integer. For S is an array of integer. First, all of them are one. We have Q query that one forms of: 1 x y k: Change a[x] become Fk(a[x],y). 2 x y k: Change a[x] become Fk(a[x],a[y]). 3 x y: Let 4 number: F1(a[x],a[y]); F2(a[x],a[y]); F3(a[x],a[y]); F4(a[x],a[y]). Input: The first line: Two integer,n is the size of S and number Q. One of Q line next is a query. Output: Many line, one of them is result of a query that type 3. Example: Input: 2 4 1 2 100 1 3 1 2 1 2 1000 2 3 1 2 Output: 100 1 1 100 1 1 1 1 Note: 0<n,Q<10001; In the query of type 1: 0<x<n+1; 0<k<5; 0<y<10001. In the query of type 2: 0<x,y<n+1; 0<k<5. In the query of type 3: 0<x,y<n+1.


Added by:Phạm Bá Thái
Date:2013-09-11
Time limit:1s-2.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:mine