字典翻译 问答 其它 Giveyouanumbersequence,canyoutellmebetweenthei-thnumberandthej-thnumber,whichisthemaximumandwhichistheminimum?InputThefirstlineoftheinputisNandQ.N(N<2^17)isthenumberofintegersandQ(Q<2^17)isthenumberofqu
问题标题:
Giveyouanumbersequence,canyoutellmebetweenthei-thnumberandthej-thnumber,whichisthemaximumandwhichistheminimum?InputThefirstlineoftheinputisNandQ.N(N<2^17)isthenumberofintegersandQ(Q<2^17)isthenumberofqu
问题描述:

Giveyouanumbersequence,canyoutellmebetweenthei-thnumberandthej-thnumber,whichisthemaximumandwhichistheminimum?

Input

ThefirstlineoftheinputisNandQ.N(N

沈忠杰回答:
  区间最值RMQ   ST算法或者线段树   提供一个ST代码   /*   RangeMinimumQuery   SparseTable(ST)algorithm   */   #include   #include   #definemin(x,y)(x)(y)?(x):(y)   #defineN100005   intn,s[N],dp[N][25],MAX[N][25],MIN[N][25];   voidslove()//psotion   {   inti,j;   for(i=0;i
点击显示
其它推荐
热门其它推荐
  • 其它