結果
| 問題 | 
                            No.2626 Similar But Different Name
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-02-10 20:53:22 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 692 bytes | 
| コンパイル時間 | 4,367 ms | 
| コンパイル使用メモリ | 260,384 KB | 
| 最終ジャッジ日時 | 2025-02-19 04:43:43 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 3 | 
| other | AC * 2 WA * 8 RE * 25 | 
ソースコード
#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;
}