結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー John Doe
提出日時 2025-09-06 15:34:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 989 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 204,532 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-06 15:34:45
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for(int i=(0+s); i < (n+s); i++)

//pair<T, T>-> P<T>
template<class T> using P = pair<T, T>;
template<class T> struct item {T A, B, C;};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int H, W;
    cin >> H >> W;
    vector<string> mygrid(H);
    vector<vector<bool>> flag(H, vector<bool>(W, false));
    rep(i, 0, H) cin >> mygrid[i];
    if(W<6){
        for(int i=0; i<H; i++){
            cout << mygrid[i] << "\n";
        }
        return 0;
    }
    for(int h=0; h<H; h++)for(int w=0; w<=W-6; w++)
    {
        if(mygrid[h].substr(w, 6)=="yiwiy9"){
            flag[h][w+4]=true;
        }else if(mygrid[h].substr(w, 6)=="9yiwiy"){
            flag[h][w+1]=true;
        }
    }
    for(int h=0; h<H; h++)for(int w=0; w<W; w++)
    {
        if(flag[h][w])mygrid[h][w]='Y';
    }
    for(int i=0; i<H; i++){
        cout << mygrid[i] << "\n";
    }
    return 0;
}
0