import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
int n = sc.nextInt();
Point1 points[] = new Point1[m];
for (int i = 0; i < m; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
points[i] = new Point1(x,y);
}
Rectangle rects[] = new Rectangle[n];
for (int i = 0; i < n; i++) {
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
rects[i] = new Rectangle(new Point1(x1, y1), new Point1(x2, y2));
}
int lens[] = new int[m];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (rects[j].isInner(points[i])) {
lens[i] = rects[j].perime;
break;
}
}
}
for (int i = 0; i < m; i++) {
for (int j = i+1; j < m; j++) {
if (lens[i]<lens[j]) {
int t = lens[i];
lens[i] = lens[j];
lens[j] = t;
}
}
}
for (int i = 0; i < lens.length; i++) {
System.out.println(lens[i]);
}
sc.close();
}
}
class Point1{
int x;
int y;
public Point1() {
}
public Point1(int x, int y) {
super();
this.x = x;
this.y = y;
}
}
class Rectangle{
Point1 p1;
Point1 p2;
int perime;
public Rectangle() {
}
public Rectangle(Point1 p1, Point1 p2) {
super();
this.p1 = p1;
this.p2 = p2;
perime = perimeter();
}
public int perimeter(){
return (Math.abs(p2.x-p1.x)+Math.abs(p2.y-p1.y))*2;
}
public boolean isInner(Point1 p){
if (p.x<=p2.x&&p.x>=p1.x&&p.y<=p2.y&&p.y>=p1.y) {
return true;
}
return false;
}
}
HDOJ 2555 人人都能参加第30届校田径运动会了
最新推荐文章于 2022-08-24 10:36:30 发布