結果
| 問題 | No.2641 draw X |
| コンテスト | |
| ユーザー |
てんぷら
|
| 提出日時 | 2024-02-19 21:49:52 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,449 ms / 2,000 ms |
| コード長 | 1,387 bytes |
| 記録 | |
| コンパイル時間 | 5,153 ms |
| コンパイル使用メモリ | 311,844 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-09-29 01:48:23 |
| 合計ジャッジ時間 | 10,022 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int h, w;
cin >> h >> w;
vector<string> s(h);
rep(i, h) cin >> s[i];
// rep(i, h) s[i] = string(w, '#');
vector<vector<int>> ok(h, vector<int>(w, 0));
rep(i, h) rep(j, w) {
ok[i][j] = s[i][j] == '.';
}
rep(i, h) rep(j, w) {
if(s[i][j] == '.')
continue;
int u = i - 1, d = i + 1, l = j - 1, r = j + 1;
while(1) {
if(u < 0 || d >= h || l < 0 || r >= w)
break;
if(s[u][l] == '.' || s[u][r] == '.' || s[d][l] == '.' || s[d][r] == '.') {
break;
}
ok[u][l] = ok[u][r] = ok[d][l] = ok[d][r] = 1;
--u;
++d;
--l;
++r;
}
if(d - u > 2) {
ok[i][j] = 1;
}
}
rep(i, h) rep(j, w) {
if(!ok[i][j]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
てんぷら