답안 #933065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933065 2024-02-25T00:43:35 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++17
10 / 100
1500 ms 6488 KB
#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

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++) {
      |                 ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 3420 KB Output is correct
2 Correct 1 ms 3420 KB Output is correct
3 Correct 1 ms 3672 KB Output is correct
4 Correct 2 ms 3420 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 1 ms 3420 KB Output is correct
7 Correct 1 ms 3416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 6412 KB Output is correct
2 Correct 1274 ms 6416 KB Output is correct
3 Correct 1102 ms 6488 KB Output is correct
4 Correct 1250 ms 6428 KB Output is correct
5 Correct 274 ms 5208 KB Output is correct
6 Correct 276 ms 5212 KB Output is correct
7 Correct 1296 ms 5880 KB Output is correct
8 Execution timed out 1549 ms 6224 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1518 ms 3816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 3420 KB Output is correct
2 Correct 1 ms 3420 KB Output is correct
3 Correct 1 ms 3672 KB Output is correct
4 Correct 2 ms 3420 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 1 ms 3420 KB Output is correct
7 Correct 1 ms 3416 KB Output is correct
8 Correct 478 ms 6412 KB Output is correct
9 Correct 1274 ms 6416 KB Output is correct
10 Correct 1102 ms 6488 KB Output is correct
11 Correct 1250 ms 6428 KB Output is correct
12 Correct 274 ms 5208 KB Output is correct
13 Correct 276 ms 5212 KB Output is correct
14 Correct 1296 ms 5880 KB Output is correct
15 Execution timed out 1549 ms 6224 KB Time limit exceeded
16 Halted 0 ms 0 KB -