結果

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

ソースコード

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>> check(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(check[h][w]) continue;
        if(mygrid[h].substr(w, 6)=="yiwiy9"){
            mygrid[h][w+4]='Y';
            for(int i=0; i<6; i++) check[h][w+i]=true;
        }else if(mygrid[h].substr(w, 6)=="9yiwiy"){
            mygrid[h][w+1]='Y';
            for(int i=0; i<6; i++) check[h][w+i]=true;
        }
    }
    for(int i=0; i<H; i++){
        cout << mygrid[i] << "\n";
    }
    return 0;
}
0