Submission #896923

# Submission time Handle Problem Language Result Execution time Memory
896923 2024-01-02T11:08:18 Z notyourbusiness Selling RNA Strands (JOI16_selling_rna) C++14
0 / 100
56 ms 7032 KB
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
using namespace std;
map<char, int> cmp = {{'A', 0}, {'C', 1}, {'G', 2}, {'U', 3}};
struct T {
    array<T*, 4> nxt;
    vector<int> idx;
    template<class it>
    void insert(it st, it en, int i) {
        idx.push_back(i);
        if (st == en) return;
        auto &x = nxt[cmp[*st]];
        if (!x) x = new T();
        x->insert(next(st), en, i);
    }
 
    template<class it>
    int query(it st, it en, int l, int r) { // [l, r)
        if (st == en)
            return lower_bound(all(idx), r) - lower_bound(all(idx), l);
        auto &x = nxt[cmp[*st]];
        return x ? x->query(next(st), en, l, r) : 0;
    }
} t;

signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector <string> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        
    }
    sort(all(a));
    for(int i=0;i<m;i++){
        string s,q;
        cin>>s>>q;
        auto l=lower_bound(all(a),s)-a.begin();
        s.back()++;
        auto r=lower_bound(all(a),s)-a.begin();
        r--;
        if(l>r){
            cout<<0<<"\n";
            continue;
        }
        
    }
    cout<<"\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 7032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -