摘要: https://www.acwing.com/problem/content/833/ #include<iostream> using namespace std; const int N=100010,M=1000010; int n,m; int ne[N]; //next array cha 阅读全文
posted @ 2022-01-14 10:50 秋月桐 阅读(22) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/832/ #include<iostream> using namespace std; const int N=100010; int stk[N],tt=0;//tt指向当前栈顶,数据区1开始 int main(){ 阅读全文
posted @ 2022-01-07 22:03 秋月桐 阅读(26) 评论(0) 推荐(0) 编辑
摘要: rt 实现任意 b 进制转换 10 进制 注意:b<=10 //秦九邵算法 //b 进制转10 进制 int get(string s,int b){ int res=0; for(auto c:s){ res=res*b+c-'0'; } return res; } 更新: 1-35任意进制 转换 阅读全文
posted @ 2022-01-02 20:57 秋月桐 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=100010; int head,e[N],ne[N],idx; void init(){ head=-1; idx=0; } void add_to_head(int x){ e[idx]=x; 阅读全文
posted @ 2022-01-02 13:43 秋月桐 阅读(41) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=100010; int n,m; int q[N]; int main(){ scanf("%d%d",&n,&m); for(int i=0;i<n;i++) scanf("%d",&q[i]) 阅读全文
posted @ 2022-01-02 13:42 秋月桐 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 序列和 #include<iostream> using namespace std; const int N=100010; int a[N],b[N]; int main(){ int n,m,l,r; cin>>n>>m; for(int i=1;i<=n;i++) cin>>b[i]; fo 阅读全文
posted @ 2022-01-02 13:41 秋月桐 阅读(52) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=100010; int q[N],s[N]; int main(){ int n; cin>>n; for(int i=0;i<n;i++) cin>>q[i]; int res=0; for(i 阅读全文
posted @ 2022-01-02 13:40 秋月桐 阅读(24) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=1e6+10; int n,q[N],tmp[N]; void quick_sort(int q[],int l,int r){ if(l>=r) return; int x=q[l+r>>1], 阅读全文
posted @ 2022-01-02 13:39 秋月桐 阅读(29) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<algorithm> using namespace std; const int N=100010; int q[N],tmp[N]; long int res; void merge_sort(int q[],int l,int r){ i 阅读全文
posted @ 2022-01-02 13:39 秋月桐 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 背景:离散化一词常常见到,甚至很多算法题不自觉的都会用到,比如hashmap,根据value找key等(内置find效率较低),根据acwing的例题总结了一下: 例题:https://www.acwing.com/problem/content/804/ 所谓离散化,就是将一些定义域很大的数,但总 阅读全文
posted @ 2021-12-26 18:45 秋月桐 阅读(59) 评论(0) 推荐(0) 编辑