提交时间:2024-04-02 13:31:15

运行 ID: 141110

#include<bits/stdc++.h> using namespace std; int a[10010],g[10010]; int j = 1,c = 0,b = 0; signed main(){ while(cin >> a[j]){ j++; } for(int i = 1;i <= j;i++){ int k =1; while(k <= c && g[k]>= a[i]){ k++; } if(k > c){ c++; g[c] = a[i]; }else{ g[k] = a[i]; } } cout << c-1 << ' '; for(int i = 1;i < j;i++){ int h =1; while(h <= b && g[h] < a[i]){ h++; } if(h > b){ b++; g[b] = a[i]; }else{ g[h] = a[i]; } } cout << b; return 0; }