結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct dcin{template<typename T>dcin&operator>>(T&x){return std::cin>>x,x--,*this;}}dcin;

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