Submission #332607

#TimeUsernameProblemLanguageResultExecution timeMemory
332607Kevin_Zhang_TWSelling RNA Strands (JOI16_selling_rna)C++17
10 / 100
1589 ms21868 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmax(T &v, T val) { return v < val ? (v = val, true) : false; } template<class T> bool chmin(T &v, T val) { return val < v ? (v = val, true) : false; } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = "), kout(args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; } #else #define DE(...) 0 #define debug(...) 0 #endif const int MAX_N = 100010; int n, m; string w[MAX_N], p[MAX_N], q[MAX_N]; int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> m; for (int i = 0;i < n;++i) cin >> w[i]; for (int i = 0;i < m;++i) cin >> p[i] >> q[i]; for (int i = 0;i < m;++i) { int res = 0; for (int j = 0;j < n;++j) { if (max(p[i].size(), q[i].size()) > w[j].size()) continue; res += p[i] == w[j].substr(0, p[i].size()) && q[i] == w[j].substr(w[j].size() - q[i].size()); } cout << res << '\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...