#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> using namespace std; int dx[] = { 1,-1,0,0 }; int dy[] = { 0,0,-1,1 }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector&...