/* * Solution Template for Shoptimality * * Australian Informatics Olympiad 2023 * * This file is provided to assist with reading of input and writing of output * for the problem. You may modify this file however you wish, or * you may choose not to use this file at all. */ #include /* N is the number of houses. */ int N; /* M is the number of supermarkets. */ int M; /* * H contains the locations of the houses. Note that here the houses are * numbered starting from 0. */ int H[100005]; /* * S contains the locations of the supermarkets. Note that here the * supermarkets are numbered starting from 0. */ int S[100005]; /* * P contains the price factors of the supermarkets. Note that here the * supermarkets are numbered starting from 0. */ int P[100005]; /* * answers[i] should store the badness of the best supermarket for the i-th * house. Note that here the houses are numbered starting from 0. */ int answers[100005]; int main(void) { /* Read the values of N, M, H, S and P. */ scanf("%d%d", &N, &M); for (int i = 0; i < N; i++) { scanf("%d", &H[i]); } for (int i = 0; i < M; i++) { scanf("%d", &S[i]); } for (int i = 0; i < M; i++) { scanf("%d", &P[i]); } /* * TODO: This is where you should compute your solution. For each house, * find the badness of the best supermarket, and store these values into * the array answers. */ /* Write the answers. */ for (int i = 0; i < N; i++) { printf("%d ", answers[i]); } printf("\n"); return 0; }