“玲珑杯”ACM比赛 Round #11 B题
http://www.ifrog.cc/acm/problem/1097?contest=1013&no=1
1 //LIS的高端写法 2 3 #include <iostream> 4 #include <cstdio> 5 #include <cstring> 6 #include <cassert> 7 #include <algorithm> 8 using namespace std; 9 10 int b[10]; 11 int f[600020]; 12 int n, x; 13 14 int main() { 15 while (scanf("%d", &n) != EOF) { 16 assert(1 <= n && n <= 100000); 17 memset(f, 0x3f, sizeof f); 18 for (int i = 0; i < n; i++) { 19 for (int j = 0; j < 6; j++) { 20 scanf("%d", &b[j]); 21 } 22 sort(b, b + 6); 23 for (int j = 5; j >= 0; j--) { 24 *lower_bound(f, f + n, b[j]) = b[j]; 25 } 26 } 27 printf("%d\n", (int)(lower_bound(f, f + n, 0x3f3f3f3f) - f)); 28 } 29 return 0; 30 }//标程