CSES - HIIT Open 2016 - Results
Submission details
Task:DNA sequence
Sender:Team Purkka
Submission time:2016-05-28 11:20:46 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.17 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j = 0; j <= s.length() - i; j++) {
                                       ^

Code

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main () {
  string s;
  cin>>s;
  int n;
  cin>>n;
  unordered_map<string, bool> m;
  for (int i = 1; i <= min(10, (int)s.length()); i++) {
    for (int j = 0; j <= s.length() - i; j++) {
      //cout<<i<<" "<<j<<endl;
	m[s.substr(j, j + i)] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
      string x;
      cin>>x;
      if (m[x]) cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
  }
}

Test details

Test 1

Verdict:

input
ACGCGGGCTCCTAGCGTTAGCAGTTGAGTG...

correct output
YES
YES
NO
NO
YES
...

user output
(empty)