CE求调
查看原帖
CE求调
1004026
__Charlie_Chen__楼主2024/4/5 18:16

第一问的代码:

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
struct Node{
	int x;
	bool operator<(const Node &u) const{
		return x>u.x;
	}
}f[maxn];
int a[maxn],g[maxn];
int n;
int main() {
	while(scanf("%d",&a[++n]));
	n--;
	int len=1;
	f[1].x=a[1];
	for(int i=1;i<=n;i++){
		if(a[i]<=f[len].x) f[++len].x=a[i];
		else{
			Node u;
			u.x=a[i];
			int t=upper_bound(f+1,f+len+1,a[i])-f;
			f[t]=u;
		}
	}
	printf("%d\n",len);
	return 0;
}

编译错误后只是弹出了predefined_ops.h的文件

2024/4/5 18:16
加载中...