This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Problem: C - Selling RNA Strands
// Contest: Virtual Judge - Examen de Práctica PES 2024
// URL: https://vjudge.net/contest/612079#problem/C
// Memory Limit: 1024 MB
// Time Limit: 1500 ms
// Start: 24-02-2024 17:34:55
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define gcd(x, y) __gcd(x, y)
#define mcm(x, y) abs((x) * (y)) / gcd(x, y)
#define all(x) begin(x), end(x)
#define pb(x) push_back(x)
#define endl '\n'
int main() {
#ifdef DEBUG
std::cout << std::unitbuf;
#endif
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vector<string> v(n);
for (string& i : v) cin >> i;
while (m--) {
string p, q;
cin >> p >> q;
ll ans = 0;
for (string& i : v) {
if (max(p.size(), q.size()) > i.size()) continue;
for (int j = 0; j < p.size(); j++)
if (p[j] != i[j]) goto NEXT;
for (int j = 1; j <= q.size(); j++)
if (q[q.size() - j] != i[i.size() - j]) goto NEXT;
ans++;
NEXT:
continue;
}
cout << ans << endl;
}
return 0;
}
Compilation message (stderr)
selling_rna.cpp: In function 'int main()':
selling_rna.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for (int j = 0; j < p.size(); j++)
| ~~^~~~~~~~~~
selling_rna.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for (int j = 1; j <= q.size(); j++)
| ~~^~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |