結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー |
![]() |
提出日時 | 2023-02-24 21:36:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 669 bytes |
コンパイル時間 | 1,807 ms |
コンパイル使用メモリ | 195,040 KB |
最終ジャッジ日時 | 2025-02-10 20:39:20 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define INF 1234567890#define ll long longint T;int N;string s;string H = "helloworld";int main(){ios::sync_with_stdio(0); cin.tie(0);cin.exceptions(ios::badbit | ios::failbit);cin >> T;while(T--){cin >> N >> s;string res = string(1, '~');for(int i=0; i+9<N; i++){string t = s;int die = 0;for(int j=0; j<10; j++){if (t[i+j] == '?')t[i+j] = H[j];else if (t[i+j] != H[j])die = 1;}if (die) continue;for(char &c : t)if (c == '?')c = 'a';res = min(res, t);}if (res == "~") res = "-1";cout << res << "\n";}return 0;}