#include <iostream>
#include <cstring>
using namespace std;
const int N=2e5+10;
int a[N],res[N];
int t;
int main(){
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
int k=a[0];
res[0]=1;
int u=-1;
for(int i=1;i<n;i++){
if(u==-1&&k<=a[i]){//前面一段递增序列
res[i]=1;
k=a[i];
}
else if(u==-1&&a[i]<=a[0]){//遇到第一个比开头小的数可作为尾巴
res[i]=1;
u=a[i];
}
else if(u<=a[i]&&a[i]<=a[0]){//求第二端递增序列所有数字均小于开头
res[i]=1;
u=a[i];
}
else res[i]=0;
}
for(int i=0;i<n;i++) cout<<res[i];
cout<<endl;
}
}
标签:Beautiful,150,Educational,Rated,int,res From: https://www.cnblogs.com/liyiyang/p/17486613.html