| 2 | |
| 3 | map<int,int> mem; |
| 4 | int lis_dp(const vi &arr, int last) { |
| 5 | if (mem.find(last) != mem.end()) |
| 6 | return mem[last]; |
| 7 | int res = 1; |
| 8 | rep(i,0,last) { |
| 9 | if (arr[i] < arr[last]) { |
| 10 | res = max(res, 1 + lis_dp(arr, i)); |
| 11 | } |
| 12 | } |
| 13 | return mem[last] = res; |
| 14 | } |
| 15 | |
| 16 | void check(int n) { |
| 17 | vi arr(n); |