CSES - HIIT Open 2016 - Results
Submission details
Task:DNA sequence
Sender:Barely Div 1
Submission time:2016-05-28 11:13:33 +0300
Language:C++
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.67 sdetails

Code

#include <iostream>
#include <string>
#include <set>

using namespace std;

int main(){
  string s; cin >> s;
  int n = s.size();
  int nQueries; cin >> nQueries;
  
  set<string> db;
  for(int L = 1; L <= 10; L++){
    for(int i = 0; i < n; i++){
      db.insert(s.substr(i,L));
    }
  }
  
  for(int i = 0; i < nQueries; i++){
    string query; cin >> query;
    if(db.count(query)) cout << "YES\n";
    else cout << "NO\n";
  }
}

Test details

Test 1

Verdict: ACCEPTED

input
ACGCGGGCTCCTAGCGTTAGCAGTTGAGTG...

correct output
YES
YES
NO
NO
YES
...

user output
YES
YES
NO
NO
YES
...