Pagini recente » Cod sursa (job #1417358) | Cod sursa (job #513305) | Cod sursa (job #1740333) | Cod sursa (job #212278) | Cod sursa (job #263858)
Cod sursa(job #263858)
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:=5000;c:=10000;
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) and (min<5000) then write(e,c) else write(e,'-1');
close(f);close(e);
END.