Submission #997874

# Submission time Handle Problem Language Result Execution time Memory
997874 2024-06-13T04:14:04 Z irmuun Selling RNA Strands (JOI16_selling_rna) C++17
35 / 100
1500 ms 12876 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,m;
    cin>>n>>m;
    string s[n+5],p[m+5],q[m+5];
    for(int i=1;i<=n;i++){
        cin>>s[i];
    }
    for(int i=1;i<=m;i++){
        cin>>p[i]>>q[i];
        int ans=0;
        for(int j=1;j<=n;j++){
            if(s[j].size()>=max(p[i].size(),q[i].size())){
                if(s[j].substr(0,p[i].size())==p[i]&&s[j].substr(s[j].size()-q[i].size(),q[i].size())==q[i]){
                    ans++;
                }
            }
        }
        cout<<ans<<"\n";
    }
}
# 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 1 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 456 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 8532 KB Output is correct
2 Correct 498 ms 9056 KB Output is correct
3 Correct 171 ms 8784 KB Output is correct
4 Correct 239 ms 8776 KB Output is correct
5 Correct 433 ms 5964 KB Output is correct
6 Correct 475 ms 6036 KB Output is correct
7 Correct 391 ms 11860 KB Output is correct
8 Correct 874 ms 12876 KB Output is correct
9 Correct 758 ms 12820 KB Output is correct
10 Correct 1451 ms 7936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1556 ms 5496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 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 1 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 456 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 123 ms 8532 KB Output is correct
9 Correct 498 ms 9056 KB Output is correct
10 Correct 171 ms 8784 KB Output is correct
11 Correct 239 ms 8776 KB Output is correct
12 Correct 433 ms 5964 KB Output is correct
13 Correct 475 ms 6036 KB Output is correct
14 Correct 391 ms 11860 KB Output is correct
15 Correct 874 ms 12876 KB Output is correct
16 Correct 758 ms 12820 KB Output is correct
17 Correct 1451 ms 7936 KB Output is correct
18 Execution timed out 1556 ms 5496 KB Time limit exceeded
19 Halted 0 ms 0 KB -