Submission #245706

# Submission time Handle Problem Language Result Execution time Memory
245706 2020-07-07T08:24:21 Z yasseenkamel Selling RNA Strands (JOI16_selling_rna) C++14
0 / 100
1500 ms 6260 KB
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>

using namespace std;

typedef int in;
#define int long long
const long double EPS=1e-9;
const int MOD=1e9+7;
const int N=1e6;

int n,m;
vector<string> s;

in main(){
	cin >> n >> m;
	string x;
	for(int i = 0 ; i < n ; i ++){
		cin >> x;
		s.push_back(x);
	}
	while(m --){
		string s1,s2;
		cin >> s1 >> s2;
		int ans = 0;
		for(int i = 0 ; i < n ; i ++){
			bool b = 1;
			for(int j = 0 ; j < s1.size() && j < s[i].size() ; j ++){
				if(s[i][j] != s1[j]){
					b = 0;
					break;
				}
			}
			if(!b){
				continue;
			}
			int idx = s2.size() - 1;
			for(int j = s[i].size() - 1 ; j >= 0 && idx >= 0 ; j --){
				if(s[i][j] != s2[idx]){
					b = 0;
					break;
				}
				idx --;
			}
			ans += b;
		}
		cout << ans << endl;
	}
	return 0;
}

Compilation message

selling_rna.cpp: In function 'in main()':
selling_rna.cpp:30:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = 0 ; j < s1.size() && j < s[i].size() ; j ++){
                    ~~^~~~~~~~~~~
selling_rna.cpp:30:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = 0 ; j < s1.size() && j < s[i].size() ; j ++){
                                     ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1591 ms 6260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1584 ms 2804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -