int RMQ(int L,int R){ int k=0; while((1<<(k+1))<=R-L+1) ++k; return max(f[L][K],f[R-(1<<k)+1][K]); }