Pagini recente » Cod sursa (job #1514430) | Cod sursa (job #2728529) | Cod sursa (job #1316818) | Cod sursa (job #2325547) | Cod sursa (job #263843)
Cod sursa(job #263843)
var g,w,min,a,b,i,c:integer;
f,e:text;
BEGIN
assign(f,'energii.in');reset(f);assign(e,'energii.out');rewrite(e);
read(f,g);read(f,w);min:=5001;c:=10001;
for i:=1 to g do
begin
readln(f,a,b);
if (a<=min) and (a>=w) then
begin
if min<>a then
begin
min:=a;
c:=b;
end;
if b<c then c:=b;
end;
end;
if min>=w then write(e,c) else write(e,'-1');
close(f);close(e);
END.