#include <iostream> #include <cstring> #include <algorithm> #include <unordered_map> #define x first #define y second using namespace std; typedef pair<int, int> PII; PII p[4] = {{0, 1}, {1, 1}, {0, 0}, {1, 0}}; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; unor...