結果
| 問題 | No.2226 Hello, Forgotten World! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-24 21:34:38 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 1,106 bytes |
| 記録 | |
| コンパイル時間 | 430 ms |
| コンパイル使用メモリ | 82,504 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-29 16:46:50 |
| 合計ジャッジ時間 | 1,205 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <iostream>
using namespace std;
string hello = "helloworld";
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
string s;
cin >> n >> s;
string ans = "{";
for (int i = 0; i < n - 9; i++)
{
bool f = true;
for (int j = 0; j < 10; j++)
{
if (s[i + j] != '?' && s[i + j] != hello[j])
{
f = false;
break;
}
}
if (f)
{
string t = s;
for (int j = 0; j < n; j++)
{
if (t[j] == '?')
{
t[j] = 'a';
}
}
for (int j = 0; j < 10; j++)
{
t[i + j] = hello[j];
}
ans = min(ans, t);
}
}
if (ans == "{")
{
cout << -1 << endl;
}
else
{
cout << ans << endl;
}
}
}