Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int m, n, a, b, c[100],i,j=1 ,st,dr,max=0,amax,bmax;
- f >> m;
- f >> n;
- for (i = 1; i <= m; i++) {
- f >> c[i];
- }
- f >> a;
- while (c[j] < a)
- j++;
- st = j;
- for (i = 2; i <= n; i++) {
- f >> b;
- j = st;
- while (c[j] <= b)
- j++;
- dr = j - 1;
- if ((dr - st + 1) > max)
- {
- max = dr - st + 1;
- amax = a;
- bmax = b;
- }
- a = b;
- st = dr;
- }
- cout << amax << " " << bmax;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement