結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-25 02:52:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,355 bytes |
| コンパイル時間 | 1,663 ms |
| コンパイル使用メモリ | 193,440 KB |
| 最終ジャッジ日時 | 2025-02-10 23:05:56 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
#define lln \
ll n; \
cin >> n;
#define REP(i, n) for (long long i = 0; i < n; i++)
#define REPIN(v, n) \
for (long long i = 0; i < n; i++) cin >> v[i];
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
int main() {
ll T;
cin >> T;
string hello = "helloworld";
REP(t, T) {
ll n, cnt;
string s;
bool J;
cin >> n >> s;
cnt = -1;
REP(i, n) {
if (s[i] == hello[0] || s[i] == '?') {
J = true;
REP(j, hello.size()) {
if (!(i + j < n)) {
J = false;
break;
}
if (s[i + j] == hello[j] || s[i + j] == '?') {
} else {
J = false;
break;
}
}
if (J) {
cnt = i;
}
}
}
if (cnt == -1) {
cout << -1 << endl;
} else {
REP(i, n) {
if (cnt <= i && i < cnt + hello.size()) {
cout << hello[i - cnt];
} else {
cout << ((s[i] == '?') ? 'a' : s[i]);
}
}
cout << endl;
}
}
return 0;
}