import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { int h, w; scan(h, w); auto map = new int[][](h, w); int kuro = h*w; foreach (i ; 0 .. h) { string s = readln.chomp; foreach (int j, ch; s) { if (ch == '.') { map[i][j] = 1; kuro--; } } } if (kuro==0){ writeln("NO"); return; } foreach (x ; -h .. h) { foreach (y ; -w .. w) { if (x == 0 && y == 0) continue; bool ok = 1; auto m = new int[][](h, w); iota(h).each!(i => m[i] = map[i].dup); foreach (i ; 0 .. h) { foreach (j ; 0 .. w) { if (m[i][j]) continue; m[i][j] = 2; if (i + x < 0 || i + x >= h || j + y < 0 || j + y >= w || m[i+x][j+y]) { ok = 0; } else { m[i + x][j + y] = 3; } } } if (ok) { debug { writefln("%(%(%s %)\n%)", m); writeln(x, " ", y); } writeln("YES"); return; } } } writeln("NO"); } void scan(T...)(ref T args) { string[] line = readln.split; foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }