Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
最长下降子序列#include<cstdio> #include<cstdlib> #include<cstring> #include<iomanip> #include<iostream> #include<algorithm> using namespace std; const int N = 10005; const int INF = 0x3f3f3f3f; int n, cnt = 0, a[N], b[N]; signed main(void) { st: { scanf("%d", &a[n = 0]); if (a[n] == -1)return 0; while (scanf("%d", &a[++n]), a[n] != -1); memset(b, 0x3f, n << 2); for (int i = n - 1; i >= 0; i--)*lower_bound(b, b + n, a[i]) = a[i]; printf("Test #%d:\n", ++cnt); printf(" maximum possible interceptions: %d\n\n", lower_bound(b, b + n, INF) - b); goto st; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator