結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー UT0911
提出日時 2025-09-06 14:28:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 2,068 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 193,364 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-09-06 14:29:25
合計ジャッジ時間 3,197 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <set>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define coutY cout << "Yes" << endl;
#define coutN cout << "No" << endl;
#define FOR(i,l,r) for(int i=l;i<r;++i)
#define FORrev(i,l,r) for(int i=l;i>r;--i)
#define arrIn(arr, start, N) for (int i = (start); i < (N); ++i) cin >> arr[i];
#define arrOut(arr, start, N) for  (int i = (start); i < (N); ++i) { cout << arr[i] <<" "; } cout << endl;
#define arrCopy(arr1,arr2, start, N) for (int i = (start); i < (N); ++i) arr2[i]= arr1[i];
#define partmax(arr, start, end) *max_element(arr.begin()+start,A.begin()+end);
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
void YN(bool tf) { cout << (tf ? "YES\n" : "NO\n"); }
int CTI(char c){return (int)(c-'0');}
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

//cout << fixed << setprecision(20) <<


int gcd(int a, int b){ //最大公約数
  if(a%b == 0){
    return b;
  }else{
    return gcd(b, a%b);
  }
}

int lcm(int a, int b){ //最小公倍数
  return a*b / gcd(a, b);
}


int nibun(const std::vector<int>& arr, int key, int begin, int end) {
  while (begin <= end) {
    int mid = (begin + end) / 2;
    if (arr[mid] == key) {
      return mid;
    } else if (arr[mid] < key) {
      begin = mid + 1;
    } else {
      end = mid - 1;
    }
  }
  return -1; 
}

int fabs(int a,int b){
  if(a-b>0){
    return a-b;
  }else{
    return b-a;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  #ifndef ONLINE_JUDGE
    ifstream in("c_input.txt");
    cin.rdbuf(in.rdbuf());
  #endif
  ll H,W;
  cin >> H >> W;
  FOR(i,0,H){
    string S;
    cin >> S;
    FOR(j,0,W-5){
      if(S[j]=='y'&&S[j+1]=='i'&&S[j+2]=='w'&&S[j+3]=='i'&&S[j+4]=='y'&&S[j+5]=='9'){
        S[j+4]='Y';
        j+=5;      
      }else if(S[j]=='9'&&S[j+1]=='y'&&S[j+2]=='i'&&S[j+3]=='w'&&S[j+4]=='i'&&S[j+5]=='y'){
        S[j+1]='Y';
        j+=5;    
      }

      
    }
    cout << S << endl;
  }
 
  return 0;
}
0