SHARE
TWEET

Untitled

a guest Jul 17th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits\stdc++.h>
  2.  
  3. #ifdef LOCAL
  4. #define dbg(x) cerr << #x << " = " << (x) << endl;
  5. #else
  6. #define dbg(x)
  7. #endif
  8. #define int long long
  9. #define endl "\n"
  10. #define x first
  11. #define y second
  12. #define len(x) ((int)(x).size())
  13.  
  14. using namespace std;
  15.  
  16. void solve(); signed main() {
  17. #ifdef LOCAL
  18.     freopen("input.txt", "r", stdin);
  19.     freopen("output.txt", "w", stdout);
  20. #endif
  21.     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  22.     cout.setf(ios::fixed); cout.precision(15);
  23.     solve();
  24. }
  25.  
  26. void solve() {
  27.     int n, k;
  28.     cin >> n >> k;
  29.     string s = "";
  30.     for (int i = 0; i < n; ++i) {
  31.         int num; cin >> num;
  32.         s.push_back(num + 'a');
  33.     }
  34.  
  35.     cin >> s;
  36.     int ans, length;
  37.     string t;
  38.     cin >> ans >> length >> t;
  39.     int cnt = 0;
  40.     for (int i = 0; i < len(s) - len(t) + 1; ++i) {
  41.         string curr = s.substr(i, length);
  42.         if (curr == t) {
  43.             cnt++;
  44.         }
  45.     }
  46.  
  47.     cout << (ans == (cnt * len(t))) << endl;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top