提交时间:2024-03-30 15:53:54
运行 ID: 140562
#include<bits/stdc++.h> using namespace std; int a[114514],b[114514],maxn,minn,ans,x,sum,qwq,ans1; bool v[114514]; inline void fw(int x){ if (x < 0){ putchar('-'); x = -x; } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } int main(){ while (scanf("%d",&a[++x]) == 1){ maxn = 0; for (int j = 1;j < x;j++){ if (a[j] >= a[x] && b[j] > maxn){ maxn = b[j]; } } b[x] = maxn + 1; ans = max(ans,b[x]); } sum = x; while (qwq != x){ ans1++; minn = 114514; for (int i = 1;i <= x;i++){ if (!v[i] && a[i] <= minn){ minn = a[i]; v[i] = true; qwq++; } } } fw(ans); puts(""); fw(ans1); return 0; }