摘要: 第一次写博客 ,请多指教! 翻了翻前面的题解发现都是用树状数组来做,这里更新一个 线段树+离散化的做法: 其实这道题是没有必要用线段树的,树状数组就能够解决。但是个人感觉把线段树用熟了会比树状数组更有优势一点 不多废话 http://codeforces.com/contest/1311/probl 阅读全文
posted @ 2020-02-27 21:04 _LH2000 阅读(232) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define rush! ios::sync_with_stdio(false);cin.tie(0); c 阅读全文
posted @ 2020-02-27 16:58 _LH2000 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 有两种方法,只贴出较为简便的一种 stl 实现离散化 #include<algorithm> // 头文件 //n 原数组大小 num 原数组中的元素 lsh 离散化的数组 cnt 离散化后的数组大小 int lsh[MAXN] , cnt , num[MAXN] , n; for(int i=1; 阅读全文
posted @ 2020-02-27 15:11 _LH2000 阅读(156) 评论(0) 推荐(0) 编辑