随笔分类 -  思想_贪心

摘要:贪心,很有难度!!! #include<iostream> #include<cstdio> #define ri register int #define u int namespace opt { inline u in() { u x(0),f(1); char s=getchar(); wh 阅读全文
posted @ 2019-11-15 00:38 pai_hoo 阅读(178) 评论(0) 推荐(0)
摘要:比较简单的按一定规则排序后贪心, 用相邻项交换证明 但是要高精,用phy3水了个AC 阅读全文
posted @ 2019-11-14 17:03 pai_hoo 阅读(93) 评论(0) 推荐(0)
摘要:比较难的贪心! 预处理很多东西, 另外,写注释好像有点用!(可能是心理作用?) 反正还是写得挺顺利的??! #include<iostream> #include<cstdio> #define ri register int #define u int namespace opt { inline 阅读全文
posted @ 2019-11-14 16:55 pai_hoo 阅读(119) 评论(0) 推荐(0)
摘要:二分答案+贪心 #include<iostream> #include<cstdio> #define ri register int #define u int namespace opt { inline u in() { u x(0),f(1); char s(getchar()); whil 阅读全文
posted @ 2019-11-10 01:23 pai_hoo 阅读(105) 评论(0) 推荐(0)
摘要:贪心,倍增优化n至log(n) #include<iostream> #include<cstdio> #define ri register int #define u int namespace opt { inline u in() { u x(0),f(1); char s(getchar( 阅读全文
posted @ 2019-11-08 16:28 pai_hoo 阅读(106) 评论(0) 推荐(0)
摘要:写此题时并不会multiset,就写了个树状数组 先把100,000,000的数据离散化了,最多就对映到1-200,000(理由见数据范围 开权值树状数组,即1-200,000的范围 排序后贪心思路是一样的,查询第1个大于等于是什么数时就二分 初始区间为 左端点:当前奶牛花钱最小值 右端点:N+M 阅读全文
posted @ 2019-11-07 17:18 pai_hoo 阅读(121) 评论(0) 推荐(0)
摘要:贪心 第一次用multiset,感觉还有点用好像,就是个自动排序数组,log级(堆:是不是玩不起 开始用的离散花+权值树状数组+二分,是麻烦些 #include<iostream> #include<cstdio> #define ri register int #define u long lon 阅读全文
posted @ 2019-11-07 14:58 pai_hoo 阅读(139) 评论(0) 推荐(0)
摘要:维护单调不上升栈,贪心 阅读全文
posted @ 2019-11-03 15:38 pai_hoo 阅读(121) 评论(0) 推荐(0)
摘要:https://www.luogu.org/problem/P2887 有C个奶牛去晒太阳 (1 <=C <= 2500),每个奶牛各自能够忍受的阳光强度有一个最小值和一个最大值,太大就晒伤了,太小奶牛没感觉。 而刚开始的阳光的强度非常大,奶牛都承受不住,然后奶牛就得涂抹防晒霜,防晒霜的作用是让阳光 阅读全文
posted @ 2019-10-25 09:19 pai_hoo 阅读(162) 评论(0) 推荐(0)