#include #include #include using namespace std; int max(int a, int b){return a>b? a: b;} int main(){ int N,M; cin >> N >> M; vector P(N); for (int i=0; i> P[i]; vector> S; int a,b; for (int i=0; i> a >> b; S.push_back(make_pair(a,b)); } vector> T; set> T_set; int c,d; for (int j=0; j> c >> d; T.push_back(make_pair(c,d)); T_set.insert(make_pair(c,d)); } int X=0,Y=0; int u,v,s,t,x,y; vector> V{make_pair(1,1), make_pair(1,-1), make_pair(-1,1), make_pair(-1,-1)}; for (int i=0; i