Code Submission Evaluation System Login

CSES - HIIT Open 2016

HIIT Open 2016

Contest start:2016-05-28 11:00:00
Contest end:2016-05-28 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2016-05-28 11:40:44
Task:DNA sequence
Sender:Spitfire
Submission time:2016-05-28 11:40:44
Status:READY
Result:TIME LIMIT EXCEEDED

Show test data

Code

#include <iostream>
#include <string>

int main()
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);

  std::string str;
  str.reserve(100000);

  std::cin >> str;

  unsigned int q;
  std::cin >> q;

  std::string substr;
  str.reserve(10);

  for (size_t i = 0; i < q; i++) {
    std::cin >> substr;
    if (str.find(substr) == std::string::npos) {
      std::cout << "NO\n";
    } else {
      std::cout << "YES\n";
    }
  }

  return 0;
}