Pagini recente » Atasamentele paginii Clasament oni-2015-11-12 | Cod sursa (job #1560921) | Monitorul de evaluare | Istoria paginii runda/monday | Cod sursa (job #1561694)
#include <bits/stdc++.h>
using namespace std;
ifstream in("secv5.in");
ofstream out("secv5.out");
map<unsigned,bool> h;
unsigned a[1111111],n,x,y;
int main()
{
in>>n>>x>>y;
unsigned sol=0;
for(unsigned i=1;i<=n;i++)
in>>a[i];
for(unsigned i=1;i<=n;i++)
{
unsigned cnt=0,j=i;
for(;cnt<=y && j<=n;j++)
{
if(h[a[j]]==false)
cnt++;
h[a[j]]=true;
if(cnt>=x)sol++;
}
while(i<=j)
{
h[a[j]]=false;
j--;
}
}
out<<sol<<'\n';
return 0;
}