Submission #875803

# Submission time Handle Problem Language Result Execution time Memory
875803 2023-11-20T13:59:10 Z resfast Selling RNA Strands (JOI16_selling_rna) C++14
0 / 100
1500 ms 6740 KB
#include <bits/stdc++.h>
using namespace std;
#define islam_zymchybekov void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define endl '\n'
#define nl cout<<'\n';
#define int long long
#define stg string
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
typedef vector<int> vi;
typedef pair<int,int> pi;
/*
talent is important,
as is the work we have to
do to achieve your goals... <Sorry, looks like I won't be able to go to the moon>©ciberpank

ok,enough quotes it's time to get to work
*/
int c,n,m,i,j,k,x,y,cnt=0,res=0,l=0,mx=-1,sum=0,nx=-1;
islam_zymchybekov{
	string s,s1;
	cin>>n>>m;
	vector<string>v(n);
	for(i=0;i<n;i++){
		cin>>v[i];
	}
	for(i=0;i<m;i++){
		cin>>s>>s1;
		int ans=0;
		for(j=0;j<n;j++){
			if(v[j].substr(0,s.size())==s){
			if( v[j].substr(v[j].size()-s1.size(),s1.size())==s1){
			ans++;
			}	
			}
		}
		cout<<ans;nl;
	}

}
main(){
//    ios;
    int T = 1;
//	    cin >> T;
    while(T--){
        solve();
    }
}

Compilation message

selling_rna.cpp:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 280 ms 3380 KB Output is correct
2 Runtime error 178 ms 6740 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1568 ms 2132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -