Two Kilers

아직 제출이 없습니다시간 제한10초메모리 제한512 MB

문제

In famous polish movie Two Kilers, main character Jurek Kiler receives regular deliveries of gold boxes. Each delivery can be described by value of gold boxes inside it, value of ii-th delivery is equal to c_ic\_i.

Recently Jurek has felt concerned about falling value of deliveries. To check if those values are truly falling, he invented a measurement for sequence of deliveries, he calls it a disorder of a sequence.

For sequence of integers c_1,c_2,,c_nc\_1, c\_2, \ldots, c\_n the disorder of a sequence is equal to the length of the longest strictly increasing subsequence. Formally it is the largest integer ss, such that there is an increasing sequence of indices i_1<i_2<<i_si\_1 < i\_2 < \ldots < i\_s fulfilling c_i_1<c_i_2<<c_i_sc\_{i\_1} < c\_{i\_2} < \ldots < c\_{i\_s}.

Jurek thinks that his concerns are irrational if disorder of a sequence is at least kk -- then he is not interested in exact value of disorder. Problem is that it often turns out that some gold boxes from delivery are stolen or sometimes few gold boxes arrive with huge delay, so values of deliveries can change. You task is to calculate value of disorder after each change, or write kk if disorder is at least kk.

입력

In the first line one integer Z10Z \le 10 is given, denoting number of testcases described in following lines. 

The first line contains two integers n,kn, k, denoting number of deliveries and value of parameter kk. The following line contains nn integers c_1,c_2,,c_nc\_1, c\_2, \ldots, c\_n, denoting initial values of the deliveries. The third line contains one integer qq, denoting number of times delivery values change. Following qq lines contains two integers p_j,v_jp\_j, v\_j, denoting that c_p_j=v_jc\_{p\_j} = v\_j.

출력

You should output qq lines, each containing one natural number. If disorder value after jj-th change equals ss, then you should write min(s,k)\min (s, k) in jj-th line.

제한

  • n,q\[1,105]n,q \in \[1,10^5]
  • c_i,v_j\[1,109]c\_i, v\_j \in \[1,10^9]
  • p_j\[1,n]p\_j \in \[1,n]
  • k\[1,20]k \in \[1,20]