#include //#include //#include //#pragma warning(disable:4996) #pragma GCC optimize("O3") #define endl '\n' using namespace std; const int maxn = 1e5 + 3; const long long inf = 1e18; int n, k; double r[maxn], res; long long p[maxn][2]; //void init() //{ // for (int i = 1; i <= n; i++) // pcs[i][0].clear(), pcs[i][1].clear(); //} void solve() { cin >> n >> k; vector speeds; double min = inf; int x, y, pos[maxn][2], a, b, id = 1; for (int i = 0; i < k; i++) { cin >> r[i]; speeds.push_back(r[i]); } for (int i = 0; i < k; i++) { cin >> a >> b; p[i][0] = a; p[i][1] = b; pos[i][0] = a; pos[i][1] = b; } for (int i = k; i < n; i++) { cin >> p[i][0] >> p[i][1]; } for (int i = 0; i < k; i++) { cout << pos[i][0] << ' ' << pos[i][1] << endl; } for (int i = 1; i <= k; i++) { cout << i << endl; } //optimize //every position for (int i = k; i < n; i++) { x = p[i][0], y = p[i][1]; //every runner for (int i = 0; i < k; i++) { res = speeds[i] *(abs(x - pos[i][0]) + abs(y - pos[i][1])); if (res < min) { min = res; id = i+1; } } cout << id << endl; min = inf; id = 1; } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); freopen("runners.in", "r", stdin); freopen("runners.out", "w", stdout); solve(); }