第一问的代码:
#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的文件