AOJ 0059 - Intersection of Rectangles
色々やったんですがWAだったので,違う方法にしました.
重ならない方から調べます.
#include<iostream> struct P{ double x, y; }; int main(){ P ps[4]; while(std::cin >> ps[0].x >> ps[0].y >> ps[1].x >> ps[1].y >> ps[2].x >> ps[2].y >> ps[3].x >> ps[3].y, !std::cin.eof()){ if(ps[1].x < ps[2].x || ps[3].x < ps[0].x || ps[3].y < ps[0].y || ps[1].y < ps[2].y){ std::cout << "NO" << std::endl; }else{ std::cout << "YES" << std::endl; } } }