11 2023 档案

摘要:用vector模拟队列:贪心+二分--最后vct.size()则为最长子序列的长度 1.Lis(最长上升子序列): 遍历每一个数字x,若x>vct中最后一个数字,直接加入;否则lower_bound找到第一个>=x的数字,并替换为x; 2.Lnds(最长非降子序列): 遍历每一个数字x,若x>=vc 阅读全文
posted @ 2023-11-30 10:40 osir 阅读(0) 评论(0) 推荐(0) 编辑
摘要:从左往右遍历每一个数字,并且记录和。如果当前的和比原本数字更大,则继续走。否则如果当前和比当前数字更小,那么当前和改为当前数字,从当前数字往后走接着遍历。 阅读全文
posted @ 2023-11-29 12:36 osir 阅读(0) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; map<int,int> prifac; for(int i=2;i<=n;i++){ int x=36; for(int j=2;j<=x/j;j+ 阅读全文
posted @ 2023-11-23 13:10 osir 阅读(0) 评论(0) 推荐(0) 编辑
摘要:int quickpow(int x,int n,int p){ //o(logn) //x的n次方mod p int res=1; while(n){ if(n&1) res=res*x%p; x=x*x%p; n=n>>1; } return res; } 阅读全文
posted @ 2023-11-22 22:46 osir 阅读(0) 评论(0) 推荐(0) 编辑
摘要:①建树 o(n) ②单点修改 o(logn) ③区间查询 o(logn) ④区间修改 o(logn) //线段树 #include <bits/stdc++.h> using namespace std; #define int long long #define lc p<<1 #define r 阅读全文
posted @ 2023-11-14 20:54 osir 阅读(0) 评论(0) 推荐(0) 编辑