結果
問題 | No.2231 Surprising Flash! |
ユーザー |
![]() |
提出日時 | 2023-02-26 17:01:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 999 bytes |
コンパイル時間 | 567 ms |
コンパイル使用メモリ | 65,720 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-09-14 07:08:38 |
合計ジャッジ時間 | 8,058 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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) { 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; }