求助dalao,为什么导弹拦截可以过这题过不了?

P1091 [NOIP2004 提高组] 合唱队形

我也想问 ``` #include<bits/stdc++.h> int ans,anss; int a[100000],down[100000],up[100000]; using namespace std; int main() { int i,j,n; cin>>n; for (i=1; i<=n; i++) cin>>a[n-i+1]; for(i=1;i<=n;i++) { up[i]=down[i]=1; for(j=1;j<i;j++) { if(a[i]<a[j]) down[i]=max(down[i],down[j]+1); } ans=max(ans,down[i]); } cout<<n-ans; return 0; } ```
by RKcer21 @ 2018-07-16 19:58:02


|