結果

問題 No.2231 Surprising Flash!
ユーザー umncumnc
提出日時 2023-02-26 17:01:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 64,364 KB
実行使用メモリ 8,856 KB
最終ジャッジ日時 2023-10-12 08:00:44
合計ジャッジ時間 8,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 5 ms
4,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 4 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,352 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 23 ms
4,604 KB
testcase_12 AC 28 ms
5,128 KB
testcase_13 AC 28 ms
5,360 KB
testcase_14 WA -
testcase_15 AC 23 ms
4,608 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 21 ms
4,352 KB
testcase_19 AC 20 ms
4,348 KB
testcase_20 AC 20 ms
4,348 KB
testcase_21 AC 20 ms
4,356 KB
testcase_22 AC 21 ms
4,352 KB
testcase_23 AC 20 ms
4,368 KB
testcase_24 AC 22 ms
4,352 KB
testcase_25 AC 21 ms
4,348 KB
testcase_26 AC 21 ms
4,352 KB
testcase_27 AC 21 ms
4,356 KB
testcase_28 AC 21 ms
4,368 KB
testcase_29 AC 23 ms
4,352 KB
testcase_30 AC 23 ms
4,600 KB
testcase_31 AC 23 ms
4,476 KB
testcase_32 AC 23 ms
4,420 KB
testcase_33 AC 23 ms
4,352 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0