For any multiset SSS of non-negative integers, define mextext{mex}mex as the smallest non-negative integer that is not in SSS. You are given a sequence of nnn non-negative integers A1,A2,…,An and qqq queries. For any interval [l,r][l,r][l,r] , let its weight be mex=mextext{mex}=text{mex}mex=mex. For each query, you are given an interval [L,R][L, R][L,R] and a positive integer kkk. Find the kkk-th smallest weight among all subintervals of [L,R][L, R][L,R].
For any multiset SSS (SSS may contain duplicated elements) of non-negative integers, define mex(S)text{mex}(S)mex(S) as the smallest non-negative integer that is not in SSS. You are given a sequence of nnn non-negative integers A1,A2,…,AnA_1,A_2,ldots,A_nA1,A2,…,An and qqq queries. For any interval [l,r][l,r][l,r] (1≤l≤r≤n1leq lleq rleq n1≤l≤r≤n), let its weight be mex([l,r])=mex({Al,Al+1,⋯ ,Ar})text{mex}([l,r])=text{mex}(lbrace A_l,A_{l+1},cdots,A_rrbrace)mex([l,r])=mex({Al,Al+1,⋯,Ar}). For each query, you are given an interval [L,R][L, R][L,R] and a positive integer kkk. Find the kkk-th smallest weight among all subintervals of [L,R][L, R][L,R].
标签: HBC236456[TJOI2013]最长上升子序列 二分 动态规划 树状数组 离线算法 递推 数据结构 分治Interval Mex题解