結果
| 問題 | 
                            No.2226 Hello, Forgotten World!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-02-25 00:14:44 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,220 bytes | 
| コンパイル時間 | 669 ms | 
| コンパイル使用メモリ | 68,704 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-13 06:21:17 | 
| 合計ジャッジ時間 | 1,379 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | WA * 9 | 
ソースコード
#include <iostream>
#include <string>
using namespace std;
void solve(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    bool pos = false;
    string ans;
    for (int i = 0; i < N; i++) ans += 'z';
    string hw = "helloworld";
    for (int i = 0; i < N - 9; i++){
        string Sb = S.substr(i, 10);
        bool can = true;
        for (int j = 0; j < 10; j++){
            if (Sb[j] != hw[j] && Sb[j] != '?'){
                can = false;
            }
        }
        if (!can) continue;
        pos = true;
        string T;
        for (int j = 0; j < N; j++){
            if (S[j] == '?'){
                // 基準点から10以内であれば、helloworldにする
                if (j >= i && j < i + 10){
                    cout << j << " " << i << endl;
                    T += hw[j - i];
                }
                else{
                    T += 'a';
                }
            }
            else{
                T += S[j];
            }
        }
        if (T < ans){
            ans = T;
        }
    }
    if (pos) cout << ans << endl;
    else cout << -1 << endl;
    return;
}
int main(){
    int T;
    cin >> T;
    while(T--){
        solve();
    }
    return 0; 
}