結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー |
|
提出日時 | 2023-02-25 01:01:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 930 bytes |
コンパイル時間 | 1,902 ms |
コンパイル使用メモリ | 174,056 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 06:33:34 |
合計ジャッジ時間 | 2,589 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int,int> P;#define REP(i,n) for(int i=0;i<int(n);i++)int main(void){cin.tie(nullptr); ios_base::sync_with_stdio(false);int i,j,k;int T;cin >> T;REP(tc,T){int N;string S;cin >> N >> S;string x="helloworld",s=S;bool f=false;REP(i,N-9){string y=s.substr(i,10);if(x==y){f=true;break;}}if(f){REP(i,N) if(s[i]=='?') s[i]='a';cout << s << endl;continue;}vector<string> v;for(i=0;i<(1<<10);i++){string t=x;for(j=0;j<10;j++){if(i&(1<<j)) t[j]='?';}v.push_back(t);}int p=-1;REP(i,N-9){string y=s.substr(i,10);REP(j,v.size()){if(y==v[j]){p=i;f=true;}}}if(f){s.replace(p,10,x);REP(i,N) if(s[i]=='?') s[i]='a';cout << s << endl;continue;}cout << -1 << endl;}return 0;}