結果

問題 No.3850 作門ハッカソン
コンテスト
ユーザー yuunegi
提出日時 2026-12-04 22:43:55
言語 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  
実行時間 473 ms / 2,000 ms
+ 892µs
コード長 868 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,616 ms
コンパイル使用メモリ 337,860 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-12-04 22:44:25
合計ジャッジ時間 6,435 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int t;
    cin>>t;
    while(t--){
        int h,w;
        cin>>h>>w;
        vector<string>s(h);
        for(int i=0;i<h;i++)cin>>s[i];
        int ans=0;
        for(int i=0;i<h-1;i++){
            int cond=0;
            for(int j=0;j<w;j++){
                if((s[i][j]=='#'||s[i][j]=='?')&&s[i+1][j]=='?')cond++;
                else if((s[i][j]=='#'||s[i][j]=='?')&&s[i+1][j]=='#'){
                    if(cond==2)cond=3;
                    else cond=1;
                }else if((s[i][j]=='#'||s[i][j]=='?')&&s[i+1][j]=='.'){
                    if(cond==1||cond==2)cond=2;
                    else cond=0;
                }else{
                    cond=0;
                }
                if(cond==3)ans=1;
            }
        }
        cout<<(ans?"Yes":"No")<<endl;
    }
    return 0;
}
0