#include #include #include using namespace std; int lengthStep (pair &sec, pair &inc) { int f = abs(sec.first - inc.first); int s = abs(sec.second - inc.second); if (s > f) { return s; } else { return f; } } int main(int argc, char** argv) { int sec, inc; cin >> sec >> inc; vector> secVec; vector> incVec; for (int i = 0; i < sec; i++) { pair x; cin >> x.first >> x.second; secVec.emplace_back(x); } for (int i = 0; i < inc; i++) { pair x; cin >> x.first >> x.second; incVec.emplace_back(x); } for (auto item : incVec) { int min = 10000; int tmp = 0; for (auto security : secVec) { tmp = lengthStep(security, item); if (min > tmp) min = tmp; } cout << min << endl; } return 0; }