https://codeup.kr/problem.php?id=1097
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define N 19
using namespace std;
int main() {
int arr[N][N];
int cnt;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
int n;
cin >> n;
arr[i][j] = n;
}
}
cin >> cnt;
while (cnt--) {
int x, y;
cin >> x >> y;
--x;
--y;
for (int i = 0; i < N; i++) {
arr[x][i] = !arr[x][i];
}
for (int i = 0; i < N; i++) {
arr[i][y] = !arr[i][y];
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cout << arr[i][j] << ' ';
}
cout << endl;
}
return 0;
}