首页 > 其他分享 >Educational Codeforces Round 150 (Rated for Div. 2) B. Keep it Beautiful

Educational Codeforces Round 150 (Rated for Div. 2) B. Keep it Beautiful

时间:2023-06-16 22:22:22浏览次数:50  
标签:Beautiful 150 Educational Rated int res

#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

相关文章

  • 形容女性漂亮的英文:beautiful、elegant、attractive、lovely、pretty
    形容女性漂亮的英文:beautiful、elegant、attractive、lovely、pretty。1、beautiful英[?bju:t?fl]美[?bjut?f?l]adj.美丽的,美好的;极好的;[例句]Shewasaverybeautifulwoman她是个大美女。2、elegant英[?el?g?nt]美[??l?ɡ?nt]adj.(人或其举止)优美的;漂亮的;简炼的;简洁的;[......
  • beautifulSoup找不到元素
    问题:页面F12可以定位元素,但把网页下载到本地,无法定位2种原因:1、内容在一个标签中,放在json字符串里 #内容在input里inputInfo=soup.find_all('input')[3]['value']#页面所有内容xmInfo=json.loads(inputInfo)Agency=xmInfo['author']xmContent=xmInfo['conte......
  • beautifulSoup查找元素常用汇总
    0、初始化:frombs4importBeautifulSouppageSource=driver.page_sourcesoup=BeautifulSoup(pageSource,'html.parser')1、标签名定位方法1:soup.body方法2:li.select('a')2、查找2.1、单个查找2.1.1、按text内容查找xmSoup.find(text=re.compile(......
  • DC-DC电源模块直流隔离升压变换器高压稳压输出50V/110V/130V/150V/220V/250V/300V/500
    HRB系列隔离宽电压输入高电压稳压输出特点●效率高达 80%以上●1*2英寸标准封装●单电压输出●价格低●稳压输出●工作温度:-40℃~+85℃●阻燃封装,满足UL94-V0要求●温度特性好●可直接焊在PCB上应用HRBW2~40W系列模块电源是一种DC-DC升压变换器。该模块电源的输入......
  • Educational Codeforces Round 150 (Rated for Div. 2) 题解
    https://codeforces.com/contest/1841https://codeforces.com/contest/1841/problemsD.PairsofSegmentshttps://codeforces.com/contest/1841/problem/D因为\(n\)只有\(2000\),所以考虑枚举每一对\((i,j)\)满足区间有交集并且\(i\neqj\)。如果有交集,就合并。然后......
  • Educational Codeforces Round 9-C. The Smallest String Concatenation(字符串排序)
    原题链接C.TheSmallestStringConcatenationtimelimitpertestmemorylimitpertestinputoutputn strings a1, a2, ..., an.You'dliketoconcatenatethemtogetherinsomeordersuchthattheresultings......
  • Educational Codeforces Round 20-C. Maximal GCD
    原题链接C.MaximalGCDtimelimitpertestmemorylimitpertestinputoutputn.Youshouldcreatesuch strictlyincreasing sequenceof k positivenumbers a1, a2, ..., ak,thattheirsumisequalto nGr......
  • Educational Codeforces Round 7-D. Optimal Number Permutation
    原题链接D.OptimalNumberPermutationtimelimitpertestmemorylimitpertestinputoutputYouhavearray a thatcontainsallintegersfrom 1 to n twice.Youcanarbi......
  • Educational Codeforces Round 4-D. The Union of k-Segments
    原题链接D.TheUnionofk-SegmentstimelimitpertestmemorylimitpertestinputoutputYouaregiven n segmentsonthecoordinateaxis Ox andthenumber k.Thepoint......
  • Educational Codeforces Round 5-E. Sum of Remainders
    原题链接E.SumofRemainderstimelimitpertestmemorylimitpertestinputoutputCalculatethevalueofthesum: n mod 1 + n mod 2 + n mod 3 +...+ n mod m......