[CEOI2018]Global warming】的更多相关文章

[CEOI2018]Global warming 题目大意: 给定\(n(n\le2\times10^5)\),你可以将任意\(a_{l\sim r}(1\le l\le r\le n)\)每一个元素加上一个\(d(|d|\le x)\),求\(a\)的LIS长度. 思路: 不难发现区间加一个数是为了使得LIS中间一段比左边一段大,而右边一段本来就比中间的大,那么我们给右边一段同时加上也不会影响答案.因此我们可以给一个后缀加上\(x\)求LIS即可. 用两个树状数组分别维护,当前是否是已被增加过…
BZOJ5442: [Ceoi2018]Global warming https://lydsy.com/JudgeOnline/problem.php?id=5442 分析: 等价于后缀加(前缀减也可以转化成后缀加). 求\(L_i\)表示\(i\)这个位置被加了\(x\)与前面的\(lis\),\(R_i\)表示后缀加\(x\)后的\(lis\). 代码: #include <cstdio> #include <cstring> #include <algorithm&g…
[l,r]+x不如[l,n]+x [l,r]-x不如(r,n)+x 所以等价于只有[l,n]+x 枚举断点树状数组合并 难度在于想到这个贪心 #include<cstdio> #include<algorithm> using namespace std; int cnt,n,x,A[1000005],stack[1000005],F[1000005],E[1000005],S[1000005],T[1000005],a[1000005],tree[1000005]; void s…
时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCC Description Global warming is a big problem, isn't it? It is reported that the ice of Antarctica is melting. It results that oceans are glowing and more and more places are flooded. Now the…
[BZOJ4149][AMPPZ2014]Global Warming Description 给定一个序列a[1],a[2],...,a[n].请从中选出一段连续子序列,使得该区间最小值唯一.最大值也唯一. 输出选出的子序列的长度的最大值以及取到最大值时左端点的最小值. Input 第一行包含一个正整数n(1<=n<=500000),表示序列长度. 第二行包含n个正整数,依次表示a[1],a[2],...,a[n](-10^9<=a[i]<=10^9). Output 包含一行两…
头都烂了怎么头疼啊 考虑先做出对于一个位置以它作为唯一最小值的最远区间,这个可以单调栈上二分搞出来 那么对于一个位置这个区间而言,一定是选择这个区间的最大数是作为最终的唯一最大数最优的 为什么呢?我们可以把区间起止和区间之中的最大数下标弄出来,那么当前位置一定位于某两个弄出来的编号之间,其他数的答案不会大于这个区间大小,而假如是最大数除了包含这个区间以外还可以向一边拓展直到遇到下一个最大数 那么二分找出这两个编号就好了,RMQ上个st表 #include<cstdio> #include<…
Emergency Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Kudo’s real name is not Kudo. Her name is Kudryavka Anatolyevna Strugatskia, and Kudo is only her nickname.Now, she is facing an emergency in her hometown:Her mother is developing a…
A. As Easy As Possible 每个点往右贪心找最近的点,可以得到一棵树,然后倍增查询即可. 时间复杂度$O((n+m)\log n)$. #include <bits/stdc++.h> using namespace std ; typedef long long LL ; typedef long long Int ; typedef pair < int , int > pi ; #define clr(a,x) memset ( a , x , sizeof…
第四部分     推理题 1.世界上每个角落的每个人都有立场,都有背景,都有推理性,能推理出一个人语言的真意,才成就了真正的推理能力: 2.换言之,如果你能通过一个人的说话推理出其身份职业,你的推理能力更上一层楼. 一 . 临门一脚 1. “I believe in human ingenuity – that when we decide on a task to be done, no matter how daunting it may seem at the beginning, we…
[AMPPZ2014]The Lawyer 记录每天结束的最早的会议以及开始的最晚的会议即可. #include<cstdio> #define N 500010 int n,m,i,d,a[N],b[N],st[21],en[21]; inline void read(int&a){char c;while(!(((c=getchar())>='0')&&(c<='9')));a=c-'0';while(((c=getchar())>='0')&am…