题目比较长 , 就是给出 一些点的连线, 要求留下最多的线让他们不相交
数据量比较大, 用二分的LIS
题目:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 9862 | Accepted: 5397 |
Description
Input
Output
Sample Input
4 6 4 2 6 3 1 5 10 2 3 4 5 6 7 8 9 10 1 8 8 7 6 5 4 3 2 1 9 5 8 9 2 3 1 7 4 6
Sample Output
3 9 1 4
Source
1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 using namespace std; 5 #define INF 9999999 6 int num[40000+10]; 7 int main() 8 { 9 int tst; 10 scanf("%d",&tst); 11 while(tst--) 12 { 13 int n; 14 scanf("%d",&n); 15 for(int i=0;i<=n;i++)num[i] = INF; 16 for(int i=0;i<n;i++) 17 { 18 int t; 19 scanf("%d",&t); 20 *lower_bound(num,num+n,t) = t; 21 } 22 printf("%d\n", lower_bound(num,num+n,INF)-num); 23 } 24 25 return 0; 26 }
poj1631Bridging signals ( LIS)
原文:http://www.cnblogs.com/doubleshik/p/3538918.html