如果发现广告等破坏行为,请尽量将条目恢复到较早的版本而不是把相应内容直接删除,谢谢合作。
URAL/1097
来自"NOCOW"
< URAL
const maxm=100; var imp,size,x,y:array[0..maxm]of integer; l,a,m,i,u,v,w:integer; function ok:boolean; var i,j,k,p,q:integer; begin for i:=0 to m do if imp[i]>w then for j:=0 to m do if imp[j]>w then begin p:=x[i]+size[i];if p+a>l then continue; q:=y[j]+size[j];if q+a>l then continue; ok:=true; for k:=1 to m do if (imp[k]>w) and (p<x[k]+size[k]) and (x[k]<=p+a) and (q<y[k]+size[k]) and (y[k]<=q+a) then begin ok:=false; break; end; if ok then exit; end; end; begin read(l,a,m); a:=a-1; for i:=1 to m do read(imp[i],size[i],x[i],y[i]); imp[0]:=255;size[0]:=1;x[0]:=0;y[0]:=0; u:=1;v:=101; repeat w:=(u+v) shr 1; if ok then v:=w else u:=w+1; until u=v; if u>100 then writeln('IMPOSSIBLE') else writeln(u); end. by----wh硕