結果

問題 No.2626 Similar But Different Name
ユーザー mayocornmayocorn
提出日時 2024-02-09 23:01:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 741 ms / 3,000 ms
コード長 3,277 bytes
コンパイル時間 4,299 ms
コンパイル使用メモリ 267,012 KB
実行使用メモリ 72,860 KB
最終ジャッジ日時 2024-02-09 23:01:20
合計ジャッジ時間 17,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 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 5 ms
6,676 KB
testcase_11 AC 5 ms
6,676 KB
testcase_12 AC 4 ms
6,676 KB
testcase_13 AC 5 ms
6,676 KB
testcase_14 AC 6 ms
6,676 KB
testcase_15 AC 5 ms
6,676 KB
testcase_16 AC 5 ms
6,676 KB
testcase_17 AC 5 ms
6,676 KB
testcase_18 AC 712 ms
72,860 KB
testcase_19 AC 89 ms
41,980 KB
testcase_20 AC 82 ms
41,980 KB
testcase_21 AC 81 ms
41,980 KB
testcase_22 AC 710 ms
56,896 KB
testcase_23 AC 713 ms
57,196 KB
testcase_24 AC 675 ms
53,088 KB
testcase_25 AC 706 ms
54,608 KB
testcase_26 AC 687 ms
57,192 KB
testcase_27 AC 722 ms
57,516 KB
testcase_28 AC 684 ms
55,576 KB
testcase_29 AC 685 ms
53,080 KB
testcase_30 AC 681 ms
54,600 KB
testcase_31 AC 709 ms
56,436 KB
testcase_32 AC 688 ms
57,352 KB
testcase_33 AC 690 ms
57,516 KB
testcase_34 AC 695 ms
53,088 KB
testcase_35 AC 689 ms
56,444 KB
testcase_36 AC 685 ms
53,088 KB
testcase_37 AC 741 ms
72,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

// type
typedef long long ll;
typedef long double ld;
using i128 = __int128_t;
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
template<class T> using v = vector<T>;
#define V vector
#define pl pair<ll, ll>
#define vl v<ll>
#define vp v<pl>
#define vm v<mint>
 
// IN-OUT
#define NYAN ios::sync_with_stdio(false);cin.tie(nullptr);cout<<fixed<<setprecision(15);
ostream &operator<<(ostream &os, const i128 &v) {
    if(v == 0) { return (os << "0"); }
    i128 num = v;
    if(v < 0) { os << '-'; num = -num; }
    string s;
    for(; num > 0; num /= 10) { s.push_back((char)(num % 10) + '0'); }
    reverse(s.begin(), s.end());
    return (os << s);
}
void Yes(bool b=1) { cout << ( b == 1 ? "Yes" : "No" ) << "\n"; }
void YES(bool b=1) { cout << ( b == 1 ? "YES" : "NO" ) << "\n"; }
void No(bool b=1) { cout << ( b == 1 ? "No" : "Yes" ) << "\n"; }
void NO(bool b=1) { cout << ( b == 1 ? "NO" : "YES" ) << "\n"; }
void CIN() {}
template <typename T, class... U> void CIN(T &t, U &...u) { cin >> t; CIN(u...); }
void COUT() { cout << "\n"; }
template <typename T, class... U, char sep = ' '> void COUT(const T &t, const U &...u) { cout << t; if (sizeof...(u)) cout << sep; COUT(u...); }
#define dump(x) cerr << #x << ":"<< x << "\n";
#define vdump(x) rep(repeat, sz(x)) cerr << repeat << ":" << x[repeat] << "\n";
 
// macro
#define bp __builtin_popcountll
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define reps(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define sz(x) (ll)x.size()
ll xd[]={0, 1, 0, -1, 1, 1, -1, -1};
ll yd[]={1, 0, -1, 0, 1, -1, -1, 1};

// function
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>int bl(T x) { int s = 0; while(x) {x >>= 1; s++;} return s; } // bitlength
ll rmax(ll a, ll b){return max(a, b);}
ll rmin(ll a, ll b){return min(a, b);}
ll rsum(ll a, ll b){return a + b;}
ll rzero(){return 0;}

// constant
long double PI = 3.14159265358979;
#define INF32 2147483647
#define INF64 9223372036854775807
#define INF 922337203685477580
using mint = modint998244353;
// using mint = modint1000000007;


/* SOLVE BEGIN ************************************************************************** */

void solve()
{
  ll n, m, k;
  cin >> n >> m >> k;
  string s, t;
  cin >> s >> t;
  string a = "", b = "";
  rep(i, n) a += tolower(s[i]);
  rep(i, m) b += tolower(t[i]);
  
  string S = b + a;
  auto vec = z_algorithm(S);
  vl cnt;
  reps(i, m, n + m) cnt.emplace_back(vec[i]);
  
  vl lows(n), lowt(m), ups(n), upt(m);
  rep(i, n){
    if(isupper(s[i])) ups[i]++;
    else lows[i]++;
  }
  reverse(ALL(t));
  rep(i, m){
    if(isupper(t[i])) upt[i]++;
    else lowt[i]++;
  }
  
  auto low = convolution_ll(lows, lowt);
  auto up = convolution_ll(ups, upt);
  
  ll ans = 0;
  rep(i, n){
    if(cnt[i] < m) continue;
    ll sum = low[i + m - 1] + up[i + m - 1];
    ll dif = m - sum;
    if(1 <= dif && dif <= k) ans++;
  }
  cout << ans << "\n";
}

int main()
{
  NYAN
  solve();
  return 0;
}
0