num = sqrt(n);//分num块
for (int i = 1; i <= num; i++)
st[i] = n / num * (i - 1) + 1, ed[i] = n / num * i;
//n/num=一个块的长度
ed[num] = n; // n不能整除num时,需要特殊处理最后一个块的终点
for (int i = 1; i <= num; i++) {
for (int j = st[i]; j <= ed[i]; j++) {
belong[j] = i;
}
size[i] = ed[i] - st[i] + 1;
}