Dilworth 定理告诉我们 LDS 等于 LIS 划分的数量。
假设 LIS 最长长度是 ,为了让 LIS 划分数量尽量小所以我们尽量让每一个划分的长度都是 。
那么 LDS 的长度就是 ,我们要最小化 ,取 平衡。
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int x=sqrt(n);
for(int i=1;i<=n;i+=x){
int qwq=i+x-1;
qwq=min(qwq,n);
while(qwq>=i)cout<<qwq<<' ',qwq--;
}
return 0;
}
// 修塔尔克,你见过在天上飞的马车吗?
// 我正坐着呢。