結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-02-24 21:44:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,581 bytes |
| コンパイル時間 | 4,629 ms |
| コンパイル使用メモリ | 255,068 KB |
| 最終ジャッジ日時 | 2025-02-10 20:45:37 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=int;
using ld=double;
ld pie=3.14159265359;
ll mod=998244353;
long long inf=100000000000000001;
int main(){
ll t;
cin >> t;
string h="helloworld";
vector<string>ans;
for (ll o = 0; o < t; o++)
{
ll n;
cin >> n;
string s;
cin >> s;
bool ok=false;
for (ll i = s.size()-10; i>=0; i--)
{
ll now=0;
for (ll j = i; j <i+10; j++)
{
if (s[j]=='?')
{
now+=1;
}else{
if (s[j]==h[now])
{
now+=1;
}
}
}
if (now>=10)
{
ok=true;
ll now=0;
for (ll j = i; j <i+10; j++)
{
if (s[j]=='?')
{
s[j]=h[now];
now+=1;
}else{
now+=1;
}
}
break;
}
}
if (!ok)
{
ans.push_back("-1");
continue;
}
for (ll j = 0; j < s.size(); j++)
{
if (s[j]=='?')
{
s[j]='a';
}
}
ans.push_back(s);
}
for (ll i = 0; i < ans.size(); i++)
{
cout << ans[i] << endl;
}
}
hiro71687k