結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
Sarievo
|
| 提出日時 | 2023-02-24 22:23:20 |
| 言語 | cLay (20241019-1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 738 bytes |
| コンパイル時間 | 2,551 ms |
| コンパイル使用メモリ | 176,464 KB |
| 実行使用メモリ | 7,624 KB |
| 最終ジャッジ日時 | 2024-09-13 05:41:23 |
| 合計ジャッジ時間 | 2,807 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
const string t = "helloworld";
const ll sz_t = t.size();
bool contain(string&s, ll x){
ll n = s.size();
rep(i, sz_t){
if (s[i+x]!=t[i]) {return false;}
}
return true;
}
bool imply(string&s, ll x){
ll n = s.size();
rep(i, sz_t){
if (s[i+x] != t[i] && s[i+x] != '?') {return false;}
}
rep(i, sz_t){
if (s[i+x] == '?') s[i+x] = t[i];
}
return true;
}
void fill(string&s) {
for(auto&&x:s) if (x == '?') x = 'a';
}
void solve() {
ll @n;
string @s;
rep(i, (n - sz_t) + 1) {
if (contain(s, i)) {
fill(s);
wt(s);
return;
}
}
rrep(i, (n - sz_t) + 1) {
if (imply(s, i)) {
fill(s);
wt(s);
return;
}
}
wt(-1);
}
{
REP(rd_int()) {solve();}
}
Sarievo