結果

問題 No.2226 Hello, Forgotten World!
ユーザー cho435cho435
提出日時 2023-02-24 22:35:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 2,202 ms
コンパイル使用メモリ 200,032 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 06:34:17
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<int(n);i++)
const int MOD = 998244353;

int main(){
  string he="helloworld";
  int t;
  cin>>t;
  rep(Ti,t){
    int n;
    cin>>n;
    string s;
    cin>>s;
    string ans="-1";
    rep(x,2){
      for(int i=n-he.size();i>=0;i--){
        int flg=0;
        for(int j=0;j<he.size();j++){
          if(x==1) if(s.at(i+j)=='?') continue;
          if(s.at(i+j)!=he.at(j)){
            flg=1;
            break;
          }
        }
        if(flg) continue;
        for(int j=0;j<he.size();j++){
          s.at(i+j)=he.at(j);
        }
        for(int j=0;j<n;j++){
          if(s.at(j)=='?') s.at(j)='a';
        }
        ans=s;
        goto end;
      }
    }
    end:;
    cout<<ans<<endl;
  }
}
0