随笔分类 -  STL妙用

摘要:考虑某次i的降雨(x[i], p[i]),针对位置pos研究消去i降雨的影响。 假设pos处的n次总降雨量为sum,且pos>x[i],则降雨在pos处为斜率-1的线段,pos处若合法则需满足sum - (p[i] - (pos - x[i])) <= m,也即p[i] + x[i] >= sum 阅读全文
posted @ 2023-07-04 10:02 LegendN 阅读(56) 评论(0) 推荐(0)
摘要:1 multiset<int> mt; 2 mt.clear(); 3 mt.insert(x); // insert one 4 cout << mt.count(x) << endl; // 5 mt.erase(mt.find(x));// delete one 6 mt.erase(x); 阅读全文
posted @ 2022-04-30 11:53 LegendN 阅读(33) 评论(0) 推荐(0)
摘要:unique&erase: https://blog.csdn.net/hellokandy/article/details/51317593 参考博文:https://www.cnblogs.com/DeepJay/p/14115735.html 这个代码是真的简洁清晰,看的太舒服了 https: 阅读全文
posted @ 2021-01-18 11:02 LegendN 阅读(117) 评论(0) 推荐(0)
摘要:巧用队列+树状数组求逆序对 1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 const int N = 2e5 + 10; 5 ll pos[N], t[N]; 6 int n; 7 8 inline 阅读全文
posted @ 2021-01-15 16:48 LegendN 阅读(66) 评论(0) 推荐(0)
摘要:好题 看似线段树的nlogn 实则是multiset + pair 1 #include<bits/stdc++.h> 2 #define fi first 3 #define se second 4 #define ll long long 5 using namespace std; 6 con 阅读全文
posted @ 2021-01-14 16:34 LegendN 阅读(98) 评论(0) 推荐(0)