mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 05:12:40 +00:00
adding sample code
This commit is contained in:
parent
9d0f2a1c9d
commit
74e3aee918
22
pr.cpp
Normal file
22
pr.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
bool isOverlap(pair<int,int> p1,pair<int,int> p2,pair<int,int> p3,pair<int,int> p4){
|
||||
if(p1.first>p4.first || p2.first<p3.first) return false;
|
||||
if(p1.second<p4.second || p2.second>p3.second) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(){
|
||||
int t;
|
||||
cin>>t;
|
||||
while(t--){
|
||||
pair<int,int> p1,p2,p3,p4;
|
||||
cin>>p1.first>>p1.second;
|
||||
cin>>p2.first>>p2.second;
|
||||
cin>>p3.first>>p3.second;
|
||||
cin>>p4.first>>p4.second;
|
||||
cout<<isOverlap(p1,p2,p3,p4)<<'\n';
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user