# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
876275 | 2023-11-21T13:35:06 Z | Nurislam | Selling RNA Strands (JOI16_selling_rna) | C++14 | 1500 ms | 2772 KB |
#include <bits/stdc++.h> using namespace std; /* <<<<It's never too late for a new beginning in your life>>>> Today is hard tomorrow will worse but the day after tomorrow will be the sunshine.. HARD WORK BEATS TALENT WHEN TALENT DOESN'T WORK HARD............ Never give up */ //The most CHALISHKANCHIK #define int long long int unordered_map<string, int> mp; void solve(){ int n, m; cin >> n >> m; for(int i = 0; i < n; i++){ string s; cin >> s; mp[s]++; } for(int i = 0; i < m; i++){ string a, b; cin >> a >> b; int ans = 0; for(auto k:mp){ if(k.first.size() < max(a.size(), b.size()))continue; string res = k.first; if(res.substr(0, a.size()) == a && res.substr(res.size() - b.size()) == b)ans+=k.second; } cout << ans << '\n'; } } main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int t = 1; //~ cin >> t; while(t--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 439 ms | 2688 KB | Output is correct |
2 | Execution timed out | 1559 ms | 2772 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 604 KB | Output is correct |
2 | Correct | 976 ms | 592 KB | Output is correct |
3 | Correct | 924 ms | 764 KB | Output is correct |
4 | Correct | 14 ms | 600 KB | Output is correct |
5 | Correct | 772 ms | 600 KB | Output is correct |
6 | Correct | 763 ms | 644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 439 ms | 2688 KB | Output is correct |
9 | Execution timed out | 1559 ms | 2772 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |