Submission #933065

#TimeUsernameProblemLanguageResultExecution timeMemory
933065vjudge1Selling RNA Strands (JOI16_selling_rna)C++17
10 / 100
1549 ms6488 KiB
#include <bits/stdc++.h> using namespace std; string arr[100005]; int main() { int n, m; string a, b; bool flag; cin >> n >> m; for(int i=0; i<n; i++) { cin >> arr[i]; } int res; while(m--) { cin >> a >> b; res = 0; for(int i=0; i<n; i++) { flag = true; if(arr[i].length() < a.length() || arr[i].length() < b.length()) { continue; } for(int j=0; j<a.length(); j++) { if(a[j] != arr[i][j]) { flag = false; break; } } for(int j=0; j<b.length(); j++) { if(b[j] != arr[i][arr[i].length()-b.length()+j]) { flag = false; break; } } if(flag) res++; } cout << res << "\n"; } }

Compilation message (stderr)

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |    for(int j=0; j<a.length(); j++) {
      |                 ~^~~~~~~~~~~
selling_rna.cpp:42:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |    for(int j=0; j<b.length(); j++) {
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...