結果

問題 No.2226 Hello, Forgotten World!
ユーザー cho435cho435
提出日時 2023-02-24 22:31:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 198,240 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-11 06:32:23
合計ジャッジ時間 2,727 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 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";
    for(int i=n-he.size();i>=0;i--){
      int flg=0;
      for(int j=0;j<he.size();j++){
        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;
      break;
    }
    cout<<ans<<endl;
  }
}
0