제출 #896923

#제출 시각아이디문제언어결과실행 시간메모리
896923notyourbusinessSelling RNA Strands (JOI16_selling_rna)C++14
0 / 100
56 ms7032 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...