# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483338 | MOUF_MAHMALAT | Lottery (CEOI18_lot) | C++14 | 3078 ms | 600 KiB |
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;
const ll mod=1e9+7;
ll n,l,q,o,a[10001],c[10001],x,ans,sz[10001];
map<ll,ll>mp;
vector<vector<ll> >v;
int main()
{
scanf("%d%d",&n,&l);
for(ll i=0; i<n; i++)
{
scanf("%d",&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),sz[a[i]]++;
scanf("%d",&q);
while(q--)
{
scanf("%d",&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(ll k=0; k<sz[a[j]]; k++)
{
if(v[a[j]][k]-j+i>=0)
c[v[a[j]][k]-j+i]++;
}
for(ll j=0; j+l-1<n; j++)
if(i!=j)
ans+=(c[j]>=x);
printf("%d ",ans);
}
printf("\n");
}
return 0;
}
Compilation message (stderr)
# | 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... |