Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- #define ll long long
- int main()
- {
- fastread()
- ll t ;
- cin>>t;
- while (t--)
- {
- ll n,q;
- cin>>n>>q;
- string s;
- cin>>s;
- map<char,ll>mp;
- for(ll i =0;i<n;i++)mp[s[i]]++;
- while(q--)
- {
- ll x,cnt=0;
- cin>>x;
- map<char,ll>::iterator it=mp.begin();
- while(it!=mp.end())
- {
- if(it->second>x)cnt+=(it->second-x);
- it++;
- }
- cout<<cnt<<endl;
- //cnt=0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement