結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー shinji_mm
提出日時 2025-09-07 12:49:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 4,190 ms
コンパイル使用メモリ 282,452 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-07 12:49:47
合計ジャッジ時間 4,620 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i,a,b) for(ll i = a; i < (ll)(b); i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using VI = vector<int>;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int DX[] = {1,0,-1,0};
const int DY[] = {0,1,0,-1};

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	
	ll h,w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i,h) cin >> s[i];
	
	vector<vector<int>> a(h,vector<int>(w,0));
	rep(i,h)rep(j,w-5){
		string sub = s[i].substr(j,6);
		if((sub == "yiwiy9" || sub == "9yiwiy") && a[i][j]==0){
			if(sub == "yiwiy9"){
				s[i][j+4] = 'Y';
			}
			else{
				s[i][j+1] = 'Y';
			}
			
			rep(jj,6) a[i][j+jj] = 1;
		}
	}
	
	rep(i,h) cout << s[i] << endl;
	return 0;
}
0