結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー sgfc
提出日時 2025-09-07 21:29:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 3,607 ms
コンパイル使用メモリ 275,340 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-09-07 21:29:35
合計ジャッジ時間 5,085 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;

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

	ll h, w;
	cin >> h >> w;
	
	vector<string> s(h);
	for(auto&& x : s) cin >> x;
	
	for (int i=0; i<h; ++i) {
		for (int j=0; j<w; ++j) {
			if (s[i][j] != '9') continue;
			
			if (j > 0 && s[i][j-1] == 'y') {
				s[i][j-1] = 'Y';
				continue;
			}
			if (j < w-1 && s[i][j+1] == 'y') {
				s[i][j+1] = 'Y'; 
				s[i][j+5] = '?';
			}
		}
	}
	for (int i=0; i<h; ++i) {
		for (int j=0; j<w; ++j) {
			if (s[i][j] == '?') s[i][j] = 'y';
		}
	}

	for(auto&& x : s) cout << x << '\n';
	
	
	
}
0