poj1068
简单模拟
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream> using namespace std; const int maxn=22; int n,N,p[maxn],le[maxn]; bool first; void init() { int i,j; cin>>n; first=true; for (i=1;i<=n;i++) { cin>>p[i]; le[i]=p[i]-p[i-1]; j=i; while (!le[j]) j--; le[j]--; if (!first) cout<<" "; else first=false; cout<<i-j+1; } } int main() { // freopen("t.txt","r",stdin); cin>>N; while (N--) { init(); cout<<endl; } return 0; }