Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // sequences
- //
- // Created by Ayazhan on 15/09/2019.
- // Copyright © 2019 Ayazhan. All rights reserved.
- //
- #include <iostream>
- #include <cstdlib>
- #include <cstring>
- const int MAX_LENGTH = 2;
- const int MAX_REQUEST = 500000;
- const int MAX_N = 8836;
- const int MAX_M = 100000;
- int main() {
- int n_forbiden;
- int n_requests;
- scanf("%d%d", &n_forbiden, &n_requests);
- char** arr_forbiden_strs = (char**)calloc(n_forbiden, sizeof(*arr_forbiden_strs) );
- for(int i = 0; i < n_forbiden; i++)
- {
- arr_forbiden_strs[i] = (char*)calloc(MAX_LENGTH, sizeof(char));
- std::cin >> arr_forbiden_strs[i];
- }
- char** arr_requests_strs = (char**)calloc(n_requests, sizeof(*arr_requests_strs) );
- for(int i = 0; i < n_requests; i++)
- {
- arr_requests_strs[i] = (char*)calloc(MAX_REQUEST, sizeof(char));
- std::cin >> arr_requests_strs[i];
- }
- for(int i = 0; i < n_requests; i++)
- {
- bool indicator = false;
- for(int j = 0; i < n_forbiden; j++)
- {
- printf("%s %c", arr_requests_strs[i], arr_forbiden_strs[j][0]);
- char* ptr = strchr(arr_requests_strs[i], arr_forbiden_strs[j][0]);
- printf("%s\n", ptr);
- if(ptr)
- {
- if(strchr(ptr, arr_forbiden_strs[j][1])) indicator = true;
- }
- }
- if(indicator) printf("YES\n");
- else printf("NO\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement