标签:多少 algorithm ide href bsp class output blank source
http://acm.hdu.edu.cn/showproblem.php?pid=5256
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2845 Accepted Submission(s): 928
1 #include <cstring> 2 #include <cstdio> 3 #include <cmath> 4 #include <algorithm> 5 #include <iostream> 6 using namespace std; 7 const int K=100000+9; 8 int a[K],c[K]; 9 int main() 10 { 11 int n,cnt; 12 int t; 13 scanf("%d",&t); 14 int co=0; 15 while(t--) 16 { 17 scanf("%d",&n); 18 cnt=0; 19 for(int i=0;i<=n;i++) c[i]=0; 20 for(int i=1; i<=n; i++){ 21 scanf("%d",&a[i]); 22 a[i]-=i; 23 } 24 for(int i=1;i<=n;i++) 25 { 26 int d=upper_bound(c+1,c+1+cnt,a[i])-c; 27 c[d]=a[i]; 28 cnt=max(cnt,d); 29 } 30 printf("Case #%d:\n%d\n",++co,n-cnt); 31 } 32 return 0; 33 }
标签:多少 algorithm ide href bsp class output blank source
原文地址:https://www.cnblogs.com/Fighting-sh/p/10073725.html