Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- using namespace std;
- short constructL(short a[],short n)
- {
- int L[n];
- L[0]=1;
- for(int i=1;i<n;++i)
- {
- L[i]=1;
- for (int j=0;j<i;++j)
- if( a[i]>=a[j]&&L[i]<L[j]+1)
- L[i]=L[j]+1;
- }
- return *max_element(L,L+n);
- }
- int main()
- {
- short n,v[1001];
- ifstream f("radiera.in");
- f>>n;
- for(short i=0;i<=n;++i)
- f>>v[i];
- f.close();
- short m=constructL(v,n);
- ofstream g("radiera.out");
- g<<(n-m);
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement