Submission #933054

# Submission time Handle Problem Language Result Execution time Memory
933054 2024-02-24T23:57:03 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++17
0 / 100
1305 ms 5516 KB
// 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 (auto& i : v) cin >> i;

	while (m--) {
		string p, q;
		cin >> p >> q;

		ll ans = 0;
		for (auto& i : v) {
			if (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

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
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 421 ms 5516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1305 ms 2108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -