結果

問題 No.3850 作門ハッカソン
コンテスト
ユーザー Iroha_3856
提出日時 2026-12-04 21:42:11
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 476 ms / 2,000 ms
+ 467µs
コード長 1,602 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,436 ms
コンパイル使用メモリ 346,744 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-12-04 21:42:18
合計ジャッジ時間 6,078 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define siz(x) (int)x.size()

#define debug(x) cout << #x << " : " << endl; for (auto u : x) cout << u << " "; cout << endl

template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int inf = 1e9;
const ll INF = 4e18;

void solve() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    rep(i, 0, H) cin >> S[i];
    
    rep(u, 0, H - 1) {
        vector<bool> match_side(W, true), match_bet(W, true);
        rep(i, 0, W) {
            if (S[u][i] == '.') match_side[i] = match_bet[i] = false;
        }
        int d = u + 1;
        rep(i, 0, W) {
            if (S[d][i] == '.') match_side[i] = false;
            if (S[d][i] == '#') match_bet[i] = false;
        }
        vector<int> S(W + 1);
        S[0] = 0;
        rep(i, 0, W) S[i + 1] = S[i] + match_bet[i];
        vector<int> oks;
        rep(i, 0, W) {
            if (match_side[i]) oks.push_back(i);
        }
        int n = siz(oks);
        rep(i, 0, n) {
            for (int j = i + 1; j < n; j++) {
                if (oks[j] == oks[i] + 1) continue;
                if (S[oks[j]] - S[oks[i] + 1] == oks[j] - oks[i] - 1) {
                    cout << "Yes\n";
                    return;
                }
                break;
            }
        }
    }
    cout << "No\n";
}

int main() {
    int T; cin >> T;
    while(T--) solve();
}
0