BUPT OJ 中序遍歷序列

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
      int t,n,x;
	  cin>>t;
      
	while(t--)
	{
		vector<int>BeforeSort;
		vector<int>AfterSort;
		cin>>n;
		while(n--)
		{	cin>>x;
			BeforeSort.push_back(x);
			
			
		}
		AfterSort=BeforeSort;
		sort(AfterSort.begin(),AfterSort.end());
		if(AfterSort==BeforeSort){
			
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}

 
} 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章