結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2023-02-24 22:23:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,013 bytes |
| コンパイル時間 | 1,592 ms |
| コンパイル使用メモリ | 194,088 KB |
| 最終ジャッジ日時 | 2025-02-10 21:25:54 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string a="helloworld";
int t;
cin>>t;
while(t--){
int n;
string s;
cin>>n>>s;
bool b=false;
rep(i,n-9){
if(s.substr(i,10)==a){
b=true;
break;
}
}
if(b){
rep(i,n){
if(s[i]=='?') cout<<'a';
else cout<<s[i];
}
cout<<'\n';
continue;
}
int k=-1;
for(int i=n-10;i>=0;i--){
bool b=true;
for(int j=0;j<10;j++){
if(s[i+j]=='?') continue;
if(s[i+j]!=a[j]) b=false;
}
if(b){
k=i;
break;
}
}
if(k==-1) cout<<-1<<'\n';
else{
rep(i,n){
if(s[i]!='?') cout<<s[i];
else if(k<=i && i<k+10) cout<<a[i-k];
else cout<<'a';
}
cout<<'\n';
}
}
return 0;
}
umezo