Advertisement
Guest User

owoslkkx

a guest
Apr 7th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.53 KB | None | 0 0
  1. int m, n, a, b, c[100],i,j=1 ,st,dr,max=0,amax,bmax;
  2.     f >> m;
  3.     f >> n;
  4.     for (i = 1; i <= m; i++) {
  5.         f >> c[i];
  6.     }
  7.     f >> a;
  8.     while (c[j] < a)
  9.         j++;
  10.     st = j;
  11.     for (i = 2; i <= n; i++) {
  12.         f >> b;
  13.         j = st;
  14.         while (c[j] <= b)
  15.             j++;
  16.         dr = j - 1;
  17.         if ((dr - st + 1) > max)
  18.         {
  19.             max = dr - st + 1;
  20.             amax = a;
  21.             bmax = b;
  22.         }
  23.         a = b;
  24.         st = dr;
  25.     }
  26.     cout << amax << " " << bmax;
  27.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement