# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042236 | 2024-08-02T17:19:43 Z | milo_milkshake | Selling RNA Strands (JOI16_selling_rna) | C++14 | 1500 ms | 11392 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 - l1 + i]) 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 | Correct | 1 ms | 3420 KB | Output is correct |
2 | Correct | 1 ms | 3420 KB | Output is correct |
3 | Correct | 1 ms | 3420 KB | Output is correct |
4 | Correct | 1 ms | 3420 KB | Output is correct |
5 | Correct | 1 ms | 3584 KB | Output is correct |
6 | Correct | 1 ms | 3420 KB | Output is correct |
7 | Correct | 1 ms | 3420 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 365 ms | 5704 KB | Output is correct |
2 | Correct | 1010 ms | 9552 KB | Output is correct |
3 | Correct | 165 ms | 9528 KB | Output is correct |
4 | Correct | 212 ms | 9440 KB | Output is correct |
5 | Correct | 121 ms | 7252 KB | Output is correct |
6 | Correct | 120 ms | 7248 KB | Output is correct |
7 | Correct | 1137 ms | 10500 KB | Output is correct |
8 | Correct | 839 ms | 11344 KB | Output is correct |
9 | Correct | 898 ms | 11392 KB | Output is correct |
10 | Execution timed out | 1524 ms | 8528 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1559 ms | 3596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3420 KB | Output is correct |
2 | Correct | 1 ms | 3420 KB | Output is correct |
3 | Correct | 1 ms | 3420 KB | Output is correct |
4 | Correct | 1 ms | 3420 KB | Output is correct |
5 | Correct | 1 ms | 3584 KB | Output is correct |
6 | Correct | 1 ms | 3420 KB | Output is correct |
7 | Correct | 1 ms | 3420 KB | Output is correct |
8 | Correct | 365 ms | 5704 KB | Output is correct |
9 | Correct | 1010 ms | 9552 KB | Output is correct |
10 | Correct | 165 ms | 9528 KB | Output is correct |
11 | Correct | 212 ms | 9440 KB | Output is correct |
12 | Correct | 121 ms | 7252 KB | Output is correct |
13 | Correct | 120 ms | 7248 KB | Output is correct |
14 | Correct | 1137 ms | 10500 KB | Output is correct |
15 | Correct | 839 ms | 11344 KB | Output is correct |
16 | Correct | 898 ms | 11392 KB | Output is correct |
17 | Execution timed out | 1524 ms | 8528 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |