~~~~
Find the longest ascending subsequence, and reverse the array. Isn't it the longest ascending subsequence? Qaq ..
Using the nlogn algorithm, unclear please stamp: http://blog.csdn.net/darwin_/article/details/38360997
Question link: http://poj.org/problem? Id = 1887
~~~~
# Include <iostream> # include <cstdio> # include <algorithm> # include <cstring> # define n 10000 using namespace STD; int f [N], a [n]; int main () {int T, C, T = 0; while (~ Scanf ("% d", & T), T! =-1) {c = 0; A [C ++] = T; while (~ Scanf ("% d", & T), T! =-1) A [C ++] = T; int I, j; for (I = 0, j = C-1; I <j; I ++, j --) swap (A [I], a [J]); int CNT = 0; For (int K = 0; k <C; k ++) {If (k = 0) f [++ CNT] = A [k]; else {if (a [k]> F [CNT]) f [++ CNT] = A [k]; else {int Pos = lower_bound (F + 1, F + CNT, a [k])-F; f [POS] = A [k] ;}} printf ("test # % d: \ n", ++ T); printf ("maximum possible interceptions: % d \ n ", CNT);} return 0 ;}