Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <bitset>
- #include <cctype>
- #include <cmath>
- #include <complex>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <ctime>
- #include <deque>
- #include <fstream>
- #include <iostream>
- #include <list>
- #include <climits>
- #include <map>
- #include <memory>
- #include <queue>
- #include <set>
- #include <sstream>
- #include <stack>
- #include <string>
- #include <utility>
- #include <vector>
- #include <iomanip>
- using namespace std;
- #define REP(i,n) for(__typeof(n) i=0; i<(n); i++)
- #define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
- #define RFOR(i,a,b) for(__typeof(b) i=(a); i>(b); i--)
- #define RESET(t,value) memset((t), value, sizeof(t))
- #define READ(f) freopen(f, "r", stdin)
- #define WRITE(f) freopen(f, "w", stdout)
- #define PI acos(-1.0)
- #define INF (1<<30)
- #define eps 1e-8
- #define pb push_back
- #define ppb pop_back
- #define pii pair<int, int>
- #define G struct Graph
- typedef long long int64;
- typedef unsigned long long ui64;
- typedef long double d64;
- template< class T > T gcd(T a, T b) {
- return (b != 0 ? gcd<T>(b, a%b) : a);
- }
- template< class T > T lcm(T a, T b) {
- return (a / gcd<T>(a, b) * b);
- }
- template< class T > void setmax(T &a, T b) {
- if(a < b) a = b;
- }
- template< class T > void setmin(T &a, T b) {
- if(b < a) a = b;
- }
- vector < int > pset (1000);
- void initSet(int _size) {
- pset.resize(_size);
- FOR(i,0,_size-1) pset[i] = i;
- }
- int findSet(int i) {
- return (pset[i]== i)? i : (pset[i] = findSet(pset[i]));
- }
- void unionSet(int i,int j) {
- pset[findSet(i)]=findSet(j);
- }
- bool isSameSet(int i,int j) {
- return findSet(i)==findSet(j);
- }
- #define Range 100
- /* @Code starts */
- int dp[Range];
- int x[] = {-7, 10, 9, 2, 3, 8, 8, 1};
- void _reset() {
- RESET(dp, -1);
- }
- int LIS(int index) {
- if(index == 0) return 1;
- if (dp[index] != -1) {
- return dp[index];
- }
- int ans = 1;
- REP( j, index ) {
- if (x[index] > x[j]) {
- ans = max(ans, 1 + LIS(j));
- }
- }
- return dp[index] = ans;
- }
- int main() {
- _reset();
- int lis = -1;
- REP(i, 7) {
- int var = LIS(i);
- if(var > lis) lis = var;
- }
- cout << lis;
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement