Hello all, I am getting partially marks in this …plz help me out.

Approach- for this problem ,i have created a set and each time i am adding elements to my set and incrementing the count and as soon as the size of set becomes equal to number of flavours , i remove all elements of set except the last one ,and put count=1…and this loop continues…and i have store the maximum value of count in variable m then printing it at last.

plz. help me

here is my code:

#include <bits/stdc++.h>

using namespace std;

int main() {

```
int t;
cin>>t;
while(t--)
{
int l,f;
cin>>l>>f;
int a[l];
set<int >s;
int count=0;
int m=0;
for (int i=0;i<l;i++)
{
cin>>a[i];
s.insert(a[i]);
if (s.size()<f)
{count++;
m=max(m,count);
}
else if (s.size()==f)
{
s.clear();
s.insert(a[i]);
count=1;
}
}
m=max(m,count);
cout<<m<<endl;
}
return 0;
```

}