N, the original values are given. There are M operations, each of them is of one of two types: 1lmrtext{1 l m r}1lmr, means replacingal…r) . 2itext{2 i}2i, means that you need to answer the value aia_iai . Where merge(a,b) means the following code: def merge(a,b): c=[] while a.size() and b.size(): if a[0]
a is a permutation of 1…N1 dots N1…N, the original values are given. There are M operations, each of them is of one of two types: 1 l m rtext{1 l m r}1 l m r, means replacing al…ra_{l dots r}al…r with merge(al…m,am+1…r)merge(a_{l dots m},a_{m+1 dots r})merge(al…m,am+1…r) . 2 itext{2 i}2 i, means that you need to answer the value aia_iai . Where merge(a,b) means the following code: def merge(a,b): c=[] while a.size() and b.size(): if a[0]