type pt=record
gt,tt:longint;
end;
var n,m,s,i,min1,min2,max,t,x,y,k:longint;
a:array[0..1000005] of longint;
b:array[0..1000100] of pt;
function ss(x,y:pt):boolean;
begin
if x.gt<y.gt then exit(true)
else exit(false);
end;
procedure sort_b(l,r:longint);
var i,j:longint;
tam,x:pt;
begin
x:=b[(l+r) div 2];
i:=l;j:=r;
repeat
while ss(b[i],x)=true do inc(i);
while ss(x,b[j])=true do dec(j);
if i<=j then
begin
tam:=b[i];b[i]:=b[j];b[j]:=tam;
inc(i);dec(j);
end;
until i>j;
if i<r then sort_b(i,r);
if l<j then sort_b(l,j);
end;
function find(l,r,p:longint):longint;
var mid,res:longint;
begin
res:=0;
while l<=r do
begin
mid:=(l+r) div 2;
if b[mid].gt<=p then
begin
res:=mid;
l:=mid+1;
end
else r:=mid-1;
end;
exit(res);
end;
procedure giai;
var max,i,j,imax,jmax:longint;
begin
sort_b(1,m);
max:=0;
for i:=1 to n do
begin
j:=find(1,m,s-a[i]);
if j>0 then
if a[i]+b[j].gt>max then
begin
max:=a[i]+b[j].gt;
imax:=i;
jmax:=j;
end;
end;
if max=0 then write('0 0')
else write(imax,' ',b[jmax].tt);
end;
procedure nhap;
begin
read(n,m,s);
for i:=1 to n do read(a[i]);
for i:=1 to m do
begin
read(b[i].gt);
b[i].tt:=i;
end;
end;
begin
assign(input,'FLOWERS1044.INP');reset(input);
assign(output,'FLOWERS1044.OUT');rewrite(output);
nhap;
giai;
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Thứ Tư, 27 tháng 4, 2022
FLOWER1044 PASCAL
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét
Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.