int main() { int runs; scanf("%d", &runs); while (runs--) { scanf("%d%d", &n, &m); for (int i = 0; i < n; ++i) scanf("%s", mat[i]); bool ans = true; memset(vis, 0, sizeof(vis)); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (mat[i][j] == 'F') { if (!check_x(i, j)) { ans = false; break; } } else { if (count_f(i, j) != mat[i][j] - '0') { ans = false; break; } } } if (!ans) break; } int cnt_vis = 0, cnt_flag = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (vis[i][j]) ++cnt_vis; if (mat[i][j] == 'F') ++cnt_flag; } } if (ans && cnt_vis != cnt_flag) ans = false; puts(ans ? "Well done Clark!" : "Please sweep the mine again!"); } return 0; }
inline bool check_dist_and_x(const char* function, const RealType& alpha, const RealType& beta, RealType x, RealType* result, const Policy& pol) { return check_dist(function, alpha, beta, result, pol) && check_x(function, x, result, pol); } // bool check_dist_and_x