当初只会暴力,现在差不多觉得水了
显然离线处理,对输入的数排序然后会发现不管怎么修改都是结果总是单调不降的
对于每次处理,我们只要找到那段越界的即可
显然上线段树,话说jsoi这么喜欢线段树?
下面在bzoj上过不去,因为pascal编译器处理比较严格,可能某处爆了int64,我也懒得查了,本地是能过的

 type node=record
mi,mx,att,mul,an:int64;
end; var tree:array[..*] of node;
ans,b,c:array[..] of longint;
a:array[..] of int64;
ch:array[..] of char;
m,f,t,i,n:longint; procedure swap(var a,b:longint);
var c:longint;
begin
c:=a;
a:=b;
b:=c;
end; procedure sort(l,r:longint);
var i,j:longint;
x,y:int64; begin
i:=l;
j:=r;
x:=a[(l+r) shr ];
repeat
while a[i]<x do inc(i);
while x<a[j] do dec(j);
if not(i>j) then
begin
y:=a[i]; a[i]:=a[j]; a[j]:=y;
swap(c[i],c[j]);
inc(i);
dec(j);
end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end; procedure cal(i,x,y:longint;x1,x2,x3:int64);
begin
with tree[i] do
begin
mi:=mi*x1+x2*a[x]+x3;
mx:=mx*x1+x2*a[y]+x3;
mul:=mul*x1;
att:=att*x1;
an:=an*x1;
att:=att+x2;
an:=an+x3;
end;
end; procedure build(i,l,r:longint);
var m:longint;
begin
tree[i].mi:=a[l];
tree[i].mx:=a[r];
tree[i].mul:=;
if l<>r then
begin
m:=(l+r) shr ;
build(i*,l,m);
build(i*+,m+,r);
end;
end; procedure push(i,l,r:longint);
var m:longint;
begin
m:=(l+r) shr ;
with tree[i] do
begin
cal(i*,l,m,mul,att,an);
cal(i*+,m+,r,mul,att,an);
mul:=;
att:=;
an:=;
end;
end; procedure max(i,l,r:longint);
var m:longint;
begin
if l=r then cal(i,l,l,,,t)
else begin
m:=(l+r) shr ;
push(i,l,r);
if tree[i*].mx>t then
begin
cal(i*+,m+,r,,,t);
max(i*,l,m);
end
else max(i*+,m+,r);
tree[i].mx:=tree[i*+].mx;
tree[i].mi:=tree[i*].mi;
end;
end; procedure min(i,l,r:longint);
var m:longint;
begin
if l=r then cal(i,l,l,,,f)
else begin
m:=(l+r) shr ;
push(i,l,r);
if tree[i*+].mi<f then
begin
cal(i*,l,m,,,f);
min(i*+,m+,r);
end
else min(i*,l,m);
tree[i].mx:=tree[i*+].mx;
tree[i].mi:=tree[i*].mi;
end;
end; procedure ask(i,l,r:longint);
var m:longint;
begin
if l=r then
ans[c[l]]:=tree[i].mx
else begin
m:=(l+r) shr ;
push(i,l,r);
ask(i*,l,m);
ask(i*+,m+,r);
end;
end; begin
readln(m,f,t);
for i:= to m do
readln(ch[i],b[i]);
readln(n);
for i:= to n do
begin
readln(a[i]);
if a[i]>t then a[i]:=t;
if a[i]<f then a[i]:=f;
c[i]:=i;
end;
sort(,n);
build(,,n);
for i:= to m do
if ch[i]='+' then
begin
cal(,,n,,,b[i]);
if tree[].mx>t then max(,,n);
end
else if ch[i]='-' then
begin
cal(,,n,,,-b[i]);
if tree[].mi<f then min(,,n);
end
else if ch[i]='*' then
begin
cal(,,n,b[i],,);
if tree[].mx>t then max(,,n);
end
else begin
cal(,,n,,b[i],);
if tree[].mx>t then max(,,n);
end;
ask(,,n);
for i:= to n do
writeln(ans[i]);
end.

bzoj3878的更多相关文章

  1. BZOJ3878: [Ahoi2014&Jsoi2014]奇怪的计算器

    BZOJ3878: [Ahoi2014&Jsoi2014]奇怪的计算器 Description [故事背景] JYY有个奇怪的计算器,有一天这个计算器坏了,JYY希望你能帮助他写 一个程序来模 ...

  2. 2018.07.25 bzoj3878: [Ahoi2014&Jsoi2014]奇怪的计算器(线段树)

    传送门 线段树综合. 让我想起一道叫做siano" role="presentation" style="position: relative;"&g ...

  3. [暑假的bzoj刷水记录]

    (这篇我就不信有网站来扣) 这个暑假打算刷刷题啥的 但是写博客好累啊  堆一起算了 隔一段更新一下.  7月27号之前刷的的就不写了 , 写的累 代码不贴了,可以找我要啊.. 2017.8.27upd ...

随机推荐

  1. error C2664 转换错误汇总[转]

    vs2005提示 error C2664: “CWnd::MessageBoxW”: 不能将参数 1 从“const char [17]”转换为“LPCTSTR”. 在用vs2005编写mfc程序的时 ...

  2. 此博客不更新文章,请到www.xiaoxiangyucuo.com看最新文章

    请到www.xiaoxiangyucuo.com看更多资料,包括Linux,JavaScript,Python,MySQL,PHP,HTML,Photoshop,以及各类软件下载. 希望大家支持,提出 ...

  3. Oracle配置

    1.安装Oracle11g--->通过Database Configuration Assistant创建新数据库 建数据库注意记住数据库名和SID,安装最后一步解锁scott[密码填tiger ...

  4. JQuery(一) 入门

    JQuery是一个JS库,可以跨浏览器运行,若开发者面对jQuery编程,则可以在不同的浏览器自由切换. jQuery不再像JS一样面向DOM,而是面向jQuery对象. jQuery提供$()函数, ...

  5. C#使用oledb方式将excel数据导入到datagridview后数据被截断为 255 个字符

    问题描述:在使用oledb方式将excel数据导入到datagridview中,在datagridview单元格中的数据没有显示全,似乎只截取了数据源中的一段 解决方案:1.关于该问题,微软官方答案: ...

  6. memcached完全剖析--1

    memcached的基础 翻译一篇技术评论社的文章,是讲memcached的连载.fcicq同学说这个东西很有用,希望大家喜欢. 发表日:2008/7/2 作者:长野雅广(Masahiro Nagan ...

  7. 挑战Python-20160826

    给你一字典a,如a={1:1,2:2,3:3},输出字典a的key,以','链接,如‘1,2,3'.

  8. 【Ubuntu12.04】安装搜狗输入法

    我的系统版本是Ubuntu12.04 32位 卸载Ibus输入法 sudo apt-get remove ibus 注意: 安装ibus的命令是  sudo apt-get install fcitx ...

  9. Dev-C++之开启装逼效果

    Dev-C++是个不错的C++IDE——在10年前,它是很不错,在现在,它是个以界面丑陋和调试像吃粑粑这两点著称,如下图.

  10. 瑞昱Realtek(Realtek HD Audio Driver)音频声卡驱动R2.49 for Win7_Vista

    不管是在高端系列主板上,还是在低端系列主板上,我们都能看到Realtek瑞昱的身影,Realtek HD Audio Driver能够支持所有的Realtek HD Audio音频驱动.Realtek ...