結果

問題 No.2626 Similar But Different Name
ユーザー kotatsugamekotatsugame
提出日時 2024-02-09 21:53:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 178 ms / 3,000 ms
コード長 851 bytes
コンパイル時間 2,829 ms
コンパイル使用メモリ 132,020 KB
実行使用メモリ 32,204 KB
最終ジャッジ日時 2024-02-09 21:53:33
合計ジャッジ時間 7,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 3 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 166 ms
32,204 KB
testcase_19 AC 28 ms
13,668 KB
testcase_20 AC 22 ms
13,668 KB
testcase_21 AC 21 ms
13,668 KB
testcase_22 AC 172 ms
28,172 KB
testcase_23 AC 166 ms
28,176 KB
testcase_24 AC 165 ms
27,016 KB
testcase_25 AC 165 ms
27,496 KB
testcase_26 AC 166 ms
28,176 KB
testcase_27 AC 167 ms
28,312 KB
testcase_28 AC 166 ms
27,768 KB
testcase_29 AC 168 ms
27,004 KB
testcase_30 AC 166 ms
27,496 KB
testcase_31 AC 167 ms
28,040 KB
testcase_32 AC 168 ms
28,304 KB
testcase_33 AC 168 ms
28,312 KB
testcase_34 AC 165 ms
27,020 KB
testcase_35 AC 166 ms
28,036 KB
testcase_36 AC 178 ms
27,020 KB
testcase_37 AC 167 ms
32,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/string>
#include<atcoder/modint>
#include<atcoder/convolution>
using namespace std;
using mint=atcoder::modint998244353;
int N,M,K;
string S,T;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M>>K>>S>>T;
	vector<int>Z;
	{
		string a=T+S;
		for(char&c:a)
		{
			if(c>='a')c='A'+(c-'a');
		}
		Z=atcoder::z_algorithm(a);
	}
	vector<mint>sU(N),sL(N),tU(M),tL(M);
	for(int i=0;i<N;i++)
	{
		if(S[i]>='a')sL[i]=1;
		else sU[i]=1;
	}
	for(int i=0;i<M;i++)
	{
		if(T[i]>='a')tL[i]=1;
		else tU[i]=1;
	}
	reverse(tU.begin(),tU.end());
	reverse(tL.begin(),tL.end());
	vector<mint>U=atcoder::convolution(sU,tU),L=atcoder::convolution(sL,tL);
	int ans=0;
	for(int i=0;i<=N-M;i++)if(Z[M+i]>=M)
	{
		int c=U[M-1+i].val()+L[M-1+i].val();
		if(M-c>=1&&M-c<=K)ans++;
	}
	cout<<ans<<endl;
}
0