結果
問題 |
No.2226 Hello, Forgotten World!
|
ユーザー |
![]() |
提出日時 | 2023-02-24 23:40:46 |
言語 | cLay (20241019-1) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 2,500 ms |
コンパイル使用メモリ | 175,924 KB |
実行使用メモリ | 7,616 KB |
最終ジャッジ日時 | 2024-09-13 06:12:28 |
合計ジャッジ時間 | 2,866 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
const string t = "helloworld"; bool chk(string s, int x) { string cmp = s.substr(x, 10); rep(i, 10) { if (cmp[i] != t[i] && cmp[i] != '?') { return false; } } return true; } void solve() { ll @N; string @S; bool ok = false; string ans(N, 'z'); rep(i, N - 9) { if (chk(S, i)) { ok = true; string now; rep(j, N) { if (S[j] == '?') { if (j >= i && j < i + 10) { now.push_back(t[j - i]); } else now.push_back('a'); } else { now.push_back(S[j]); } } if (now < ans) ans = now; } } if (ok) wt(ans); else wt(-1); } { REP(rd_int()) { solve(); } }