#include #define MAX 12345678 struct segTree{ int value[400010]; void setValue(int ind, int val, int l=1, int r=100000, int v=1) { if(l==r) value[v] = val; else { int h = (l+r)/2; if(ind<=h) setValue(ind,val,l,h,2*v); else setValue(ind,val,h+1,r,2*v+1); value[v] = value[2*v]=1;i--) T.setValue(i,T.getMin(i+1,x[i])+1); printf("%d",T.getMin(1,1)); }