Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word: a) Insert a character b) Delete a character c) Repla…
先从后到前做一个最长下降子序列的dp,记录f[i],我这里用的是二分(其实树状数组比较显然) 然后对于询问,超出最长上升子序列的直接输出:否则从前到后扫,f[i]>=x&&a[i]>la(上个选的)就选,因为这时第一个出现的一定是符合条件的中最小的最小的 #include<iostream> #include<cstdio> using namespace std; const int N=10005; int n,a[N],m,x,f[N],p[N],…