結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-05-05 00:29:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,017 bytes |
| コンパイル時間 | 1,277 ms |
| コンパイル使用メモリ | 116,316 KB |
| 最終ジャッジ日時 | 2025-02-12 17:02:47 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
using ll = long long;
void solve(){
ll N;
string S, T, U="helloworld";
cin >> N >> S;
for (int i=0; i<N; i++){
if (S[i] == '?') S[i] = 'a';
}
T = S;
vector<string> v;
for (int i=0; i<=N-10; i++){
bool f=1;
for (int j=0; j<10; j++){
if (S[i+j] != 'a' && S[i+j] != U[j]){
f=0;
break;
}
if (S[i+j] == 'a') S[i+j] = U[j];
}
if (f) v.push_back(S);
for (int j=0; j<10; j++) S[i+j] = T[i+j];
}
if (v.size() == 0){
cout << -1 << endl;
return;
}
sort(v.begin(), v.end());
cout << v[0] << endl;
}
int main(){
int T;
cin >> T;
while(T){
T--;
solve();
}
return 0;
}
srjywrdnprkt