結果

問題 No.2626 Similar But Different Name
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2024-02-10 20:53:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 692 bytes
コンパイル時間 4,627 ms
コンパイル使用メモリ 271,728 KB
実行使用メモリ 56,500 KB
最終ジャッジ日時 2024-02-10 20:53:35
合計ジャッジ時間 12,676 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 WA -
testcase_04 AC 2 ms
6,676 KB
testcase_05 RE -
testcase_06 AC 2 ms
6,676 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
int main () {
	int N, M, K;
	cin >> N >> M >> K;
	string s, t;
	cin >> s >> t;
	string x = t + s;
	auto v = z_algorithm(x);
	std::vector<long long> s1(N, 0), s2(N, 0), t1(M, 0), t2(M, 0);
	for (int i = 0; i < N; i ++) {
		('A' <= s[i] && s[i] <= 'Z' ? s1 : s2)[i] ++;
	}
	for (int i = 0; i < M; i ++) {
		('A' <= t[i] && t[i] <= 'Z' ? t1 : t2)[M - i + 1] ++;
	}
	auto c1 = convolution(s1, t2);
	auto c2 = convolution(s2, t1);
	int ans = 0;
	for (int i = 0; i + M <= N; i ++) {
		int c = (c1[i + M - 1] + c2[i + M - 1]);
		ans += ((v[i + M] >= M) && (1 <= c) && (c <= K));
	}
	cout << ans << endl;
}
0