Submission #933056

# Submission time Handle Problem Language Result Execution time Memory
933056 2024-02-25T00:05:44 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++17
10 / 100
1500 ms 6496 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 (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

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 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 423 ms 2896 KB Output is correct
2 Correct 1142 ms 6048 KB Output is correct
3 Correct 265 ms 5972 KB Output is correct
4 Correct 313 ms 5944 KB Output is correct
5 Correct 152 ms 4012 KB Output is correct
6 Correct 148 ms 4028 KB Output is correct
7 Execution timed out 1517 ms 6496 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1552 ms 2272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 423 ms 2896 KB Output is correct
9 Correct 1142 ms 6048 KB Output is correct
10 Correct 265 ms 5972 KB Output is correct
11 Correct 313 ms 5944 KB Output is correct
12 Correct 152 ms 4012 KB Output is correct
13 Correct 148 ms 4028 KB Output is correct
14 Execution timed out 1517 ms 6496 KB Time limit exceeded
15 Halted 0 ms 0 KB -