# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042233 | 2024-08-02T17:15:05 Z | milo_milkshake | Selling RNA Strands (JOI16_selling_rna) | C++14 | 1500 ms | 9532 KB |
#include <bits/stdc++.h> using namespace std; #define uwu "RNA" typedef long long ll; #define pb push_back #define endl '\n' #define FOR(i, a, b) for(int i = a; i <= b; i++) #define FORD(i, a, b) for(int i = a; i >= b; i--) const int N = 1e5 + 3; const int M = 2e6 + 2; const int INF = 1e9 + 7; int n, q; string s[N]; bool pre(const string& a, const string& b){ if (a.size() > b.size()) return 0; FOR(i, 0, (int) a.size() - 1) if (a[i] != b[i]) return 0; return 1; } bool suf(const string& a, const string& b){ int l1 = a.size(), l2 = b.size(); if (l1 > l2) return 0; FOR(i, 0, l1 - 1) if (a[i] != b[l2 - i - 1]) return 0; return 1; } void solve(void){ while(q--){ string P, S; cin >> P >> S; int res = 0; FOR(i, 1, n) if (pre(P, s[i]) && suf(S, s[i])) res++; cout << res << endl; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(uwu".inp","r")){ freopen(uwu".inp","r",stdin); freopen(uwu".out","w",stdout); } cin >> n >> q; FOR(i, 1, n) cin >> s[i]; solve(); cerr << "\nTime used: " << clock() << "ms\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 691 ms | 9532 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1527 ms | 3928 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |