发现我都做400多道了水题还是这么多。。。以前肿么没发现呢。。。
也是,没做过贪心分类里的题,汗。
现在刷ZOJ论坛里贪心分类里的题。
这个是DP呀,最长上升子序列,输出序列
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <climits>
#include <cstring>
#include <string>
#include <algorithm>
#define MID(x,y) ( ( x + y ) >> 1 )
#define L(x) ( x << 1 )
#define R(x) ( x << 1 | 1 )
#define FOR(i,s,t) for(int i=(s); i<(t); i++)
#define BUG puts("here!!!")
#define STOP system("pause")
#define file_r(x) freopen(x, "r", stdin)
#define file_w(x) freopen(x, "w", stdout)
using namespace std;
const int MAX = 1010;
struct NODE{
int x, y, id;
bool operator<(const NODE& a) const {
if( a.x == x )
return y < a.y;
return x < a.x;
}
};
NODE a[MAX];
int