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