結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー | tree_splay |
提出日時 | 2023-02-24 21:36:53 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 669 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 201,768 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 05:12:46 |
合計ジャッジ時間 | 2,549 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define INF 1234567890 #define ll long long int 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; }