Submission #914281

#TimeUsernameProblemLanguageResultExecution timeMemory
914281OAleksaSelling RNA Strands (JOI16_selling_rna)C++14
10 / 100
1552 ms10712 KiB
#include <bits/stdc++.h> //ako ovaj vaso daso misli da me pobedjuje..... using namespace std; #define int long long #define f first #define s second const int N = 1e5 + 69; const int p = 31; const int mod = 1e9 + 7; const int B = 750; int trie[N][26], node, n, q; string s[N]; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt = 1; //cin >> tt; while (tt--) { cin >> n >> q; for (int i = 1;i <= n;i++) cin >> s[i]; while (q--) { string p, q; cin >> p >> q; int sz1 = p.size(); int sz2 = q.size(); int ans = 0; for (int i = 1;i <= n;i++) { int ptr1 = 0, ptr2 = q.size() - 1; for (int j = 0;j < s[i].size();j++) { if (ptr1 < sz1 && s[i][j] == p[ptr1]) ptr1++; else break; } if (ptr1 == sz1) { for (int j = s[i].size() - 1;j >= 0;j--) { if (ptr2 >= 0 && s[i][j] == q[ptr2]) ptr2--; else break; } if (ptr2 == -1) ++ans; } } cout << ans << '\n'; } } return 0; }

Compilation message (stderr)

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:32:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |      for (int j = 0;j < s[i].size();j++) {
      |                     ~~^~~~~~~~~~~~~
selling_rna.cpp:28:9: warning: unused variable 'sz2' [-Wunused-variable]
   28 |     int sz2 = q.size();
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...