結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー elphe
提出日時 2025-08-07 10:22:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,056 bytes
コンパイル時間 3,755 ms
コンパイル使用メモリ 277,904 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-07 10:22:27
合計ジャッジ時間 4,721 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

static inline constexpr const std::vector<std::string>& solve(const uint_fast32_t H, const uint_fast32_t W, std::vector<std::string>& S) noexcept
{
	for (uint_fast32_t i = 0; i != H; ++i)
	{
		// 極右の岩井星人さんが右手を上げる
		while (1)
		{
			const auto pos = S[i].find("yiwiy9");
			if (pos != S[i].npos)
				S[i][pos + 4] = 'Y';
			else
				break;
		}

		// 極左の岩井星人さんが右手を上げる
		while (1)
		{
			const auto pos = S[i].find("9yiwiy");
			if (pos != S[i].npos)
				S[i][pos + 1] = 'Y';
			else
				break;
		}
	}

	return S;
}

static inline void output(const uint_fast32_t H, const uint_fast32_t W, const std::vector<std::string>& ans) noexcept
{
	for (uint_fast32_t i = 0; i != H; ++i)
		std::cout << ans[i] << '\n';
}

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

	uint_fast32_t H, W, i;
	std::cin >> H >> W;

	std::vector<std::string> S(H);
	for (i = 0; i != H; ++i)
		S[i].reserve(W), std::cin >> S[i];

	output(H, W, solve(H, W, S));
	return 0;
}
0