pku1468 Rectangles
2012-03-01 11:55
274 查看
这道题真是没法说,时间限制是5000ms,而且矩形数还少于5000,
O(n^2)枚举即可啊!!
View Code
O(n^2)枚举即可啊!!
View Code
program pku1468(input,output); type node = record x1,y1,x2,y2 : longint; end; var a : array[0..5001] of node; answer,n : longint; function cover(x,y :longint ):boolean; begin if (a[y].x1<=a[x].x1)and(a[x].x2<=a[y].x2) then if (a[y].y1<=a[x].y1)and(a[x].y2<=a[y].y2) then exit(true); exit(false); end; { cover } procedure init; var i : longint; begin readln(n); for i:=1 to n do readln(a[i].x1,a[i].x2,a[i].y1,a[i].y2); end; { init } procedure main; var i,j : longint; begin answer:=0; for i:=1 to n do begin for j:=1 to n do if i<>j then if cover(i,j) then begin inc(answer); break; end; end; end; { main } begin while not eof do begin init; main; writeln(answer); end; end.
相关文章推荐
- POJ 1468 Rectangles
- POJ 1468 Rectangles 笔记
- 1468 Rectangles
- poj 1468 Rectangles
- poj 1468 Rectangles
- POJ 1468 Rectangles(判定点在平行坐标轴的矩形内)
- zoj 1139 || poj 1468 Rectangles
- poj 1468 Rectangles
- hdu 1159 pku 1936最长公共子序列
- pku acm 1009
- 二分查找扩展——pku3273
- POJ2230 Watchcow——欧拉回路——Pku2230
- pku acm 1017
- POJ1849 Two——贪心——Pku1849
- POJ3101 Astronomy——高精度+分解质因子法求GCD和LCM——Pku3101
- pku acm 1087
- PKU DP专题
- pku 2541
- 线段树专辑——pku 2886 Who Gets the Most Candies?
- pku2479