L2-014 列车调度 (25分)【17行极短代码】

在这里插入图片描述

#include<bits/stdc++.h>
using namespace std;
int n,x;
set<int>s;
int main()
{
	cin>>n>>x;
	s.insert(x);
	while(--n)
	{
		cin>>x;
		auto it=s.upper_bound(x);
		if(it!=s.end())	s.erase(*it);
		s.insert(x);
	}
	cout<<s.size();
}

发布了180 篇原创文章 · 获赞 22 · 访问量 8998

猜你喜欢

转载自blog.csdn.net/qq_44622401/article/details/104405410