結果

問題 No.2226 Hello, Forgotten World!
ユーザー hiro71687khiro71687k
提出日時 2023-02-24 21:44:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,581 bytes
コンパイル時間 4,466 ms
コンパイル使用メモリ 262,572 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-11 06:02:20
合計ジャッジ時間 5,134 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 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>
#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;
    }
    
}
0