Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream f("date.in");
- ofstream g("date.out");
- int n,v[101],st,curent,a,b,dr,lmax;
- int main()
- {
- f>>n;
- for(int i=1;i<=n;i++) f>>v[i];
- st=1; curent=v[1];
- for(int i=2;i<=n+1;i++)
- {
- if(curent<=v[i])
- {
- dr=i;
- curent=v[i];
- }
- else
- {
- if(dr-st+1>lmax)
- {
- lmax=dr-st+1;
- a=st;
- b=dr;
- }
- st=i;
- curent=v[st];
- }
- }
- for(int i=a;i<=b;i++) cout<<v[i]<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement