当初只会暴力,现在差不多觉得水了
显然离线处理,对输入的数排序然后会发现不管怎么修改都是结果总是单调不降的
对于每次处理,我们只要找到那段越界的即可
显然上线段树,话说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. oracle创建存储过程并返回结果集(附C#调用代码)

    使用存储过程中,最常用的莫过于查询数据表,并返回结果集. 在SQL SERVER 中,这类操作最简单,通过简单的select * from xx 即可完成.但是在Oracle中并不支持这种写法,那么我 ...

  2. sublime text 使用

    一.在sublime text中创建html.css.js文件 ctrl+shift+p(调出控制台)  然后输入 Set Syntax:html(也可以输入:ssh) Set Syntax:css ...

  3. android Locat工作日志的使用

    #3.Logcat日志工具的使用 日志的等级: error:最高等级,错误信息,红色 warn:比较高,警告信息,橙色 debug:较高,调试信息,蓝色 info:一般,一般信息,绿色 verbose ...

  4. 关于MessageBox的用法

    今天编写MFC工程的时候,使用MessageBox函数,老是出错,不断从网上查找解决方案,最后找到了 MessageBox( _T("Help, Something went wrong.& ...

  5. 微软自带iscsi客户端对iqn的要求

    节点名称:Microsoft iSCSI 发起程序严格遵守为 iSCSI 节点名称指定的规则.这些规则也适用于 Microsoft iSCSI 发起程序节点名称以及发现的任何目标节点名称.构建 iSC ...

  6. MySQL5.7 linux二进制安装

    200 ? "200px" : this.width)!important;} --> 介绍 MySQL5.7出来也有大半年了,业内也一直在宣传5.7有多么的N,官网的也是宣 ...

  7. 如何在Linux下创建与解压zip, tar, tar.gz和tar.bz2文件

    这么多年来,数据压缩对我们来说是非常有用的.无论是在邮件中发送的图片用的zip文件还是在服务器压缩数据文件,我们都可以让下载更容易或者有效的节约磁盘空间.某些压缩格式有时允许我们以60%的比率(甚至更 ...

  8. 解决Ubuntu和Windows的文件乱码问题(转载)

    解决Ubuntu和Windows的文件乱码问题(debian也通用) 1.转换文件内容编码   Windows下天生的纯文本文件,其中文编码为GBK,在Ubuntu下显示为乱码,可以使用iconv命令 ...

  9. DevTools:Chrome 内置调试工具

    DevTools:Chrome 内置调试工具 2016-08-29 https://developers.google.com/web/tools/chrome-devtools

  10. c#画正弦波

    /// <summary> /// 画正弦曲线 /// </summary> /// <param name="sender"></par ...