This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
#define F first
#define S second
using namespace std;
typedef int ll;
ll n,l,q,o,a[10001],c[10001],x,ans;
map<ll,ll>mp;
vector<vector<ll> >v;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>l;
for(ll i=0; i<n; i++)
{
cin>>a[i];
if(!mp[a[i]])
mp[a[i]]=++o;
a[i]=mp[a[i]];
}
mp.clear();
v.resize(o+1);
for(ll i=0; i<n; i++)
v[a[i]].push_back(i);
cin>>q;
while(q--)
{
cin>>x;
x=l-x;
for(ll i=0; i+l-1<n; i++)
{
ans=0;
memset(c,0,sizeof c);
for(ll j=i; j<i+l; j++)
{
for(auto k:v[a[j]])
{
if(k-j+i>=0)
c[k-j+i]++;
}
}
for(ll j=0; j+l-1<n; j++)
if(i!=j)
ans+=(c[j]>=x);
cout<<ans<<" ";
}
cout<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |