- 环城旅行
- 2017-03-14 20:03:27 @
var n,m,i,tot,j:longint;
a,aa,bb,aaa:array[0..2000002]of longint;
begin
readln(n,m);
readln(aa[1],bb[1]);
for i:=2 to n do
begin
readln(aa[i],bb[i]);
aa[n+i]:=aa[i]; bb[n+i]:=bb[i];
a[i-1]:=bb[i-1]-aa[i];
a[n+i-1]:=a[i-1];
m:=m-aa[i];
end;
a[n]:=bb[n]-m; a[2*n]:=a[n];
for i:=1 to 2*n do aaa[i]:=a[i];
for i:=1 to n do
for j:=i+1 to i+n do
begin
if j=i+1 then bb[j]:=aaa[j];
if bb[j]>=0 then begin bb[j+1]:=aaa[j+1]+aaa[j];continue end
else begin inc(tot);
if tot=1 then begin write(-1); break;end
else begin write(' ',-1);break;end;end;
inc(tot);
if tot=1 then write(i) else write(' ',i);
end;
end . 为什么WA
0 条评论
目前还没有评论...