#include <cstdio> int a[11111], n; int main(int argc, char const *argv[]) { while(~scanf("%d", &n)){ int m = 0; a[1] = -1; for(int i = 1, x; i <= n; ++i){ scanf("%d", &x); int j = 1; for(; j <= m; ++j){ if(a[j] >= x){ a[j] = x; break; } } if(j > m) a[++m] = x; } printf("%d\n", m); } return 0; }
时间: 2024-12-23 00:30:44