fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define For(i,n) for(ll i=0;i<n;i++)
  5. #define pb push_back
  6. int main() {
  7. ll n,m;
  8. cin>>n>>m;
  9. ll a[n],b[m];
  10. For(i,n)cin>>a[i];
  11. For(i,m)cin>>b[i];
  12. ll x=0,y=0;
  13. vector<ll>v;
  14. For(i,n+m)
  15. {
  16. if(a[x]<=b[y])v.pb(a[x]),x++;
  17. else v.pb(b[y]),y++;
  18. }
  19. ll mx=1,c=1;
  20. For(i,n+m-1)
  21. {
  22. if(v[i+1]>v[i])c++;
  23. else{
  24. mx=max(mx,c);
  25. c=1;
  26. }
  27. }
  28. cout<<mx<<endl;
  29. }
Runtime error #stdin #stdout 0s 4356KB
stdin
Standard input is empty
stdout
Standard output is empty