type line=record x,y,pos:longint; end; var n, a,i, b,sl:longint; d:array[0..100001] of line; res:array[0..10000000] of longint; procedure nhap; begin readln(n,a,b); for i:=1 to n do begin readln(d[i].x,d[i].y); d[i].pos:= i; end; end; function ss(t1,t2:line):boolean; begin if t1.y<t2.y then exit(true); if t1.y>t2.y then exit(false); if t1.x>t2.x then exit(true); if(t1.x<t2.x) then exit(false); exit(false); end; procedure xuat; begin writeln(sl); for i:=1 to sl do writeln(res[i]); end; procedure quicksort(l,r:longint); var i,j:longint; p,t:line; begin i:=l;j:=r; p:=d[(l+r) div 2]; repeat while ss(d[i],p)=true do inc(i); while ss(p,d[j])=true do dec(j); if i<=j then begin t:=d[i];d[i]:=d[j];d[j]:=t; inc(i);dec(j); end; until i>j; if l<j then quicksort(l,j); if i<r then quicksort(i,r); end; procedure giai; var v,k,j:longint; ok,co:boolean; begin quicksort(1,n); v:=a; k:=1; ok=false; while (v<b) or (ok=false) do begin ok:=true; co:=false; for j:=n downto k do begin if d[j].x<=v then begin inc(sl); res[sl]:=d[j].pos; v:=d[j].y; k:=j+1; co:=true; break; end; end; if co=false then begin write('-1'); exit; end; end; xuat; end; begin assign(input,'cover.inp');reset(input); assign(output,'cover.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ứ Ba, 3 tháng 5, 2022
COVER 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.