結果
| 問題 |
No.3261 yiwiy9 → yiwiY9
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-07 10:53:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,085 bytes |
| コンパイル時間 | 3,457 ms |
| コンパイル使用メモリ | 281,248 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-07 10:53:59 |
| 合計ジャッジ時間 | 4,921 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
static inline constexpr std::vector<std::string> solve(const uint_fast32_t H, const uint_fast32_t W, std::vector<std::string>& S) noexcept
{
std::vector<std::string> ans(H);
for (uint_fast32_t i = 0; i != H; ++i)
{
ans[i].resize(W, '.');
while (1)
{
const auto pos_l = S[i].find("9yiwiy");
const auto pos_r = S[i].find("yiwiy9");
if (std::min(pos_l, pos_r) == S[i].npos)
break;
else if (pos_l < pos_r)
ans[i].replace(pos_l, 6, "9Yiwiy"), S[i].replace(pos_l, 6, "......");
else
ans[i].replace(pos_r, 6, "yiwiY9"), S[i].replace(pos_r, 6, "......");
}
}
return ans;
}
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;
}