cena能过,在这不能~

var a,b,f:array[0..1000001] of longint;
s:array[0..1000001,1..3] of longint;
n,m,i,j,sum,top,pp:longint;
t:boolean;
begin
assign(input,'p1782.in');assign(output,'p1782.out');
reset(input);rewrite(output);
readln(n,m);top:=m;
for i:=1 to n do read(a[i]);readln;
for i:=1 to m do
begin
readln(s[i,1],s[i,2],s[i,3]);
dec(f[s[i,2]],s[i,1]);inc(f[s[i,3]+1],s[i,1]);
end;
t:=false;
for i:=1 to n do
begin
inc(sum,f[i]);b[i]:=a[i]+sum;
if b[i]<0 then
begin
t:=true;pp:=b[i];
for j:=top downto 1 do
begin
if (s[j,2]<=i) and (s[j,3]>=i) then inc(pp,s[j,1]);
if pp>=0 then break;
end;
top:=j;
end;
end;
if not(t) then write(0)
else begin writeln(-1);write(top);end;
close(output);
end.

疯了,在cenaAC,这里就过2点!!!

5 条评论

  • @ 2015-05-29 22:40:24

    不要加输入输出= =

  • @ 2013-09-29 07:35:32

    我也出现过cena全过,这里只过8点,不存在文件输入输出问题。

  • @ 2013-09-27 22:32:36

    我说的是文件输入输出

  • @ 2013-09-27 22:31:52

    这个。。LZ,在线评测都是不能加输入输出的把。。

  • @ 2013-09-27 20:38:02

    开了文件输入输出还能对两个点?奇迹啊……

  • 1

信息

ID
1782
难度
8
分类
模拟 | 其他 | 二分查找数据结构 | 线段树 点击显示
标签
递交数
8240
已通过
1233
通过率
15%
被复制
12
上传者