// I can't believe it. This is the second question of world finals 1994, that is, the simple Lis practice, but there are a lot of things to be aware of, and it needs to be very careful, // you must be able to understand the question! This question uses binary + dp, 0 ms, and the data is still relatively weak! // Both methods for solving LIS are written. The efficiency of the first method is significantly higher than that of the second method. The time complexity of the first method is O (n ^ 2 ), the second time complexity is O (nlgn )! # Include <iostream> # include <memory. h> using namespace STD; int height [100000], TMP [100000]; int main () {int I, n = 0, temp, Tc = 0, ANS = 0, left, right, mid; bool flag = false; while (CIN> temp) {If (temp =-1 & flag) {break ;} else if (temp =-1 &&! Flag) {TC ++; TMP [0] = 32768; for (I = 0; I <n; I ++) {If (height [I] <TMP [ANS]) {TMP [++ ANS] = height [I];} else {left = 1, Right = ans; while (left <= right) {mid = (left + right)/2; If (TMP [Mid]> height [I]) {left = Mid + 1 ;} else {right = mid-1 ;}} TMP [left] = height [I] ;}} cout <"test #" <tc <": "<Endl; cout <" maximum possible interceptions: "<ans <Endl; ans = n = 0; memset (TMP, 0, sizeof (TMP); flag = true;} else {height [N] = temp; n ++; flag = false ;}} system ("pause");}/* # include <iostream> # include <memory. h> using namespace STD; int height [100000], DP [100000]; int main () {int I, j, n = 0, temp, Tc = 0, ans = 0; bool flag = false; while (CIN> temp) {If (temp =-1 & flag) {break ;} else if (temp =-1 &&! Flag) {TC ++; for (I = 0; I <100000; I ++) DP [I] = 1; for (I = 1; I <N; I ++) {for (j = 0; j <I; j ++) {If (height [I]