AC代码

#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
struct Point{
	double x, y;
}p[10];
bool compare1(double a, double b){
	if(a > b && fabs(a - b) > eps) return true;
	if(fabs(a - b) <= eps) return true;
	return false;
}
bool compare2(double a, double b){
	if(a < b && fabs(a - b) > eps) return true;
	if(fabs(a - b) <= eps) return true;
	return false;
}
bool check1(double x1, double y1){
	double x3 = p[3].x;
	double x4 = p[4].x;
	double y3 = p[3].y;
	double y4 = p[4].y;
	if(compare1(x1, x3) && compare2(x1, x4) && compare1(y1, y3) && compare2(y1, y4)) return true;
	return false;
}
bool check2(double x1, double y1){
	double x5 = p[5].x;
	double x6 = p[6].x;
	double y5 = p[5].y;
	double y6 = p[6].y;
	if(compare1(x1, x5) && compare2(x1, x6) && compare1(y1, y5) && compare2(y1, y6))  return true;
	return false;
}
int main(){
    for(int i = 1; i <= 6; i++){
	scanf("%lf%lf", &p[i].x, &p[i].y);
    }
    bool has = false;
    for(double i = p[1].x; i <= p[2].x; i += 0.5){
	if((check1(i, p[1].y) || check2(i, p[1].y)) && (check1(i, p[2].y) || check2(i, p[2].y))) ;
	else has = true;
    }
    for(double i = p[1].y; i <= p[2].y; i += 0.5){
	if((check1(p[1].x, i) || check2(p[1].x, i)) && (check1(p[2].x, i) || check2(p[2].x, i))) ;
	else has = true;
    }
    if(has){
	printf("YES\n");
    }
    else{
	printf("NO\n");
    }
    return 0;
}