/* * Solution Template for Human LCD II * * Australian Informatics Olympiad 2026 Invitationals * * 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 /* R and C are the dimensions of the display; R * C is at most 1000. */ int R; int C; /* A and B contain the initial and target colours. Both arrays start from 0. */ int A[1005][1005]; int B[1005][1005]; /* * The ith instruction changes cell (X[i], Y[i]) to colour V[i]; coordinates * are 1-based. */ int L; int X[1000005]; int Y[1000005]; int V[1000005]; int main(void) { /* Read the two R by C grids. */ scanf("%d%d", &R, &C); for (int i = 0; i < R; i++) { for (int j = 0; j < C; j++) { scanf("%d", &A[i][j]); } } for (int i = 0; i < R; i++) { for (int j = 0; j < C; j++) { scanf("%d", &B[i][j]); } } /* * TODO: Construct at most one million legal instructions transforming A into * B. * For full marks, minimise the number of instructions. */ /* * An empty instruction sequence is shown below; it is correct only when A * equals B. */ printf("%d\n", L); for (int i = 0; i < L; i++) { printf("%d %d %d\n", X[i], Y[i], V[i]); } return 0; }