Submission details
Task:DNA sequence
Sender:Maxim
Submission time:2016-10-22 15:50:15 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1--details

Code

#include <iostream>
#include <string>
#include <vector>
#define _ ios_base::sync_with_stdio(0);
#include <unordered_set>


int main() {
//	

//		
	std::string a;
	std::cin >> a;
	int strl = a.length();
	int len;
	std::cin >> len;
	std::vector<std::string> vec;

	for(int j = 0; j < len; j ++ ) {
		std::unordered_set<std::string> myset;
		
		std::string str;
		std::cin >> str;
		
		int cur = str.length();
		//std::cout << here << strl,
		for(int i = 0; i <= (strl - cur); i ++ ) {
			myset.insert(a.substr(i, cur));
			
		}
		if(myset.count(str) > 0) {
			vec.push_back("YES");		
		} else {
						vec.push_back("NO");		
		}
	}
	for(int i = 0; i < len; i ++ ) {
		std::cout << vec.at(i) <<std::endl;
	}

};


Test details

Test 1

Verdict:

input
ACGCGGGCTCCTAGCGTTAGCAGTTGAGTG...

correct output
YES
YES
NO
NO
YES
...

user output
(empty)