标签:
Time Limit: 1000MS | Memory Limit: 10000KB | 64bit IO Format: %I64d & %I64u |
Description
Input
Output
Sample Input
3 3 2 1 1 2 3 5 4 2 2 4 3 3 1 1 5 5 0
Sample Output
2 3 *
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; typedef long long LL; #define CLR(x,y) memset((x),(y),sizeof((x))) #define FOR(x,y,z) for(int (x)=(y);(x)<(z);++(x)) #define FORD(x,y,z) for(int (x)=(y);(x)>=(z);--(x)) #define FOR2(x,y,z) int (x);for((x)=(y);(x)<(z);++(x)) #define FORD2(x,y,z) int (x);for((x)=(y);(x)>=(z);--(x)) typedef pair<int,int> Point; #define x first #define y second const int maxn = 10000 + 10; int dp[maxn]; Point a[maxn]; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n; while(~scanf("%d",&n) && n){ FOR(i,0,n){ scanf("%d%d",&a[i].x ,&a[i].y); } memset(dp,0,sizeof(dp)); sort(a,a+n); CLR(dp,0); FOR(i,0,n){ dp[i] = 1; FOR(j,0,i){ if(a[i].y >= a[j].y){ dp[i] = max(dp[i],dp[j] + 1); } } } int ans = 0; FOR(i,0,n){ ans = max(ans,dp[i]); } printf("%d\n",ans); } puts("*"); return 0; } |
[2016-03-11][POJ][1609][Tiling Up Blocks]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/5267001.html