Skip to content

Instantly share code, notes, and snippets.

@towwa
Created September 12, 2020 14:42
Show Gist options
  • Save towwa/96c61b12284aae3226ccccd9a5208a15 to your computer and use it in GitHub Desktop.
Save towwa/96c61b12284aae3226ccccd9a5208a15 to your computer and use it in GitHub Desktop.
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
class Solution {
public: // leetcode endgame
int lis(vector<int>& seq) {
if (seq.size() == 0) return 0;
vector<int> dp(seq.size(), 1);
for (int i = 0; i < seq.size(); i++) {
for (int j = 0; j < i; j++) {
if (seq[i] > seq[j] && dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
}
}
}
return *max_element(dp.begin(), dp.end());
}
};
int main() {
auto s = new Solution();
vector<int> in = {4, 5, 6, 2, 3, 5, 6};
int n;
cin >> n;
trace(in[1], n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment