結果
| 問題 |
No.2231 Surprising Flash!
|
| コンテスト | |
| ユーザー |
umnc
|
| 提出日時 | 2023-02-26 17:00:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,043 bytes |
| コンパイル時間 | 548 ms |
| コンパイル使用メモリ | 66,352 KB |
| 実行使用メモリ | 11,344 KB |
| 最終ジャッジ日時 | 2024-09-14 07:08:17 |
| 合計ジャッジ時間 | 8,175 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 24 WA * 9 TLE * 1 -- * 10 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
string s1, s2;
cin >> n >> m >> s1 >> s2;
bool found = false;
int pos = -1;
for (int i = 0; i + m <= n; i++) {
bool match = true;
for (int j = 0; j < m; j++) {
if (s1[i+j] != s2[j] && s1[i+j] != '?') {
match = false;
break;
}
}
if (match) {
found = true;
pos = i;
break;
}
}
if (!found) {
cout << "UNRESTORABLE" << endl;
continue;
}
for (int i = 0; i < n; i++) {
if (i >= pos && i < pos + m) {
cout << s2[i-pos];
} else if (s1[i] == '?') {
cout << 'a';
} else {
cout << s1[i];
}
}
cout << endl;
}
return 0;
}
umnc