acwing799最长连续不重复子序列 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n; int q[N]; int cnt[N]; int main() { std::ios::sync_with_stdio(0); std::cin.tie…
原题单链接:https://www.luogu.com.cn/training/111#problems AcWing789. 数的范围 #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, q, a[N]; int bs1(i…
原题单链接:https://rentry.org/ozd34yrn 例题 重述问题 找到最后一步 去掉最后一步,是否能划分出子问题 考虑边界 746. 使用最小花费爬楼梯 const int N=1010; class Solution { public: int mem[N]; int dfs(vector<int>& cos…
#include <bits/stdc++.h> using namespace std; const int N = 10010; int fa[N]; inline void init(int n) { for (int i = 1; i <= n; i++) fa[i] = i; } inline int find(int …
#include<bits/stdc++.h> using namespace std; const int N = 10010; int a[N], s[N]; int n; int main(){ cin >> n; for (int i = 1; i <= n; i ++ ){ cin >> a[i]…
01背包问题 #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 1010; int n, m; int v[N], w[N]; int f[N]; int g[N]; int…