Submission #997874

#TimeUsernameProblemLanguageResultExecution timeMemory
997874irmuunSelling RNA Strands (JOI16_selling_rna)C++17
35 / 100
1556 ms12876 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; string s[n+5],p[m+5],q[m+5]; for(int i=1;i<=n;i++){ cin>>s[i]; } for(int i=1;i<=m;i++){ cin>>p[i]>>q[i]; int ans=0; for(int j=1;j<=n;j++){ if(s[j].size()>=max(p[i].size(),q[i].size())){ if(s[j].substr(0,p[i].size())==p[i]&&s[j].substr(s[j].size()-q[i].size(),q[i].size())==q[i]){ ans++; } } } cout<<ans<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...