# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202268 | Segtree | Selling RNA Strands (JOI16_selling_rna) | C++14 | 6 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
string s[110];
int main(){
int n,m;
cin>>n>>m;
if(n>100)return 0;
rep(i,n)cin>>s[i];
rep(i,m){
string p,q;
cin>>p>>q;
ll ans=0;
rep(i,n){
ll ver=0;
if(s[i].size()>=p.size()){
bool ok=1;
rep(j,p.size())ok&=(s[i][j]==p[j]);
ver+=ok;
}
if(s[i].size()>=q.size()){
bool ok=1;
rep(j,q.size())ok&=(s[i][s[i].size()-1-j]==q[q.size()-1-j]);
ver+=ok;
}
if(ver==2)ans++;
}
cout<<ans<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |