赞
踩
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- using namespace std;
- int num[100005], len[100005];
- int main()
- {
- //freopen("input.txt", "r", stdin);
- int n, ans = 0;
- scanf("%d", &n);
- for (int i = 1; i <= n; ++i)
- scanf("%d", &num[i]);
- for (int i = 1; i <= n; ++i)
- {
- len[num[i]] = len[num[i] - 1] + 1;
- }
- for (int i = 1; i <= n; ++i)
- if (ans < len[i])
- ans = len[i];
- printf("%d\n", n - ans);
- //system("pause");
- //while (1);
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。