Pagini recente » Cod sursa (job #3153632) | Cod sursa (job #1983626) | Cod sursa (job #2219813) | Cod sursa (job #2513891) | Cod sursa (job #263839)
Cod sursa(job #263839)
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.