text: Output For each query output the answer for this query, or -1 if j-th permutation does not exist in her list.Examples Input 2 3 1 9 1 2 3 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 3 3 6 4 4 6 5 4 3 1 2 1 1 3 14 1 59 2 6 Output 1 2 3 1 3 2 2 1 3 1 4 -1 5 Input 1 12 4 2 1 2 3 4 5 6 7 8 9 10 11 12 2 20 2 21 Output 2 2 Note In the first test case, Alice wrote down the following permutations: [1, 2, 3], [1, 3, 2], [2, 1, 3].Note that, for a permutation [3, 2, 1] Alice would have to reverse the whole array, and it would cost her 2, which is greater than the specified value c=1.The other two permutations can not be obtained by performing exactly one operation described in the problem statement.# Solution #pragma GCC optimize ("Ofast") #include<bits/stdc++.h> using namespace std; void*wmem; char memarr[96000000]; template<class S, class T> inline S min_L(S a,T b){ return a<=b?a:b; } template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){ static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] ); (*arr)=(T*)(*mem); (*mem)=((*arr)+x); } template<class T> inline void walloc1d(T **arr, int x1, int x2, void **mem = &wmem){ walloc1d(arr, x2-x1, mem); (*arr) -= x1; } template<class T1> void sortA_L(int N, T1 a[], void *mem = wmem){ sort(a, a+N); } template<class T1, class T2> void sortA_L(int N, T1 a[], T2 b[], void *mem = wmem){ int i; pair<T1, T2>*arr; walloc1d(&arr, N, &mem); for(i=(0);i<(N);i++){ arr[i].first = a[i]; arr[i].second = b[i]; } sort(arr, arr+N); for(i=(0);i<(N);i++){ a[i] = arr[i].first; b[i] = arr[i].