結果

問題 No.2226 Hello, Forgotten World!
ユーザー SarievoSarievo
提出日時 2023-02-24 23:40:46
言語 cLay
(20240104-1)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 164,028 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-11 07:01:33
合計ジャッジ時間 2,832 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 25 ms
4,368 KB
testcase_02 AC 5 ms
4,368 KB
testcase_03 AC 5 ms
4,368 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 6 ms
4,368 KB
testcase_06 AC 3 ms
4,368 KB
testcase_07 AC 4 ms
4,368 KB
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 4 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(); }
}
0