Submission #954269

#TimeUsernameProblemLanguageResultExecution timeMemory
954269MuntherCarrotSelling RNA Strands (JOI16_selling_rna)C++14
35 / 100
1568 ms8424 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define all(x) x.begin(), x.end() #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3f const int MOD = 1e9 + 7; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, q; cin >> n >> q; string s[n]; for(auto &i : s){ cin >> i; } auto solve = [](string &s, string &a, string &b) -> bool{ if(a.size() > s.size() || b.size() > s.size()){ return 0; } if(s.substr(0, a.size()) != a) return 0; if(s.substr(s.size() - b.size(), b.size()) != b) return 0; return 1; }; while(q--){ string a, b; cin >> a >> b; int ans = 0; for(auto &i : s){ ans += solve(i, a, b); } cout << ans << endl; } return 0; } // by me
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...