map overflow

Revision en1, by farmaan_khan, 2022-11-24 10:35:37

https://codeforces.net/contest/1225/my

include <bits/stdc++.h>

using namespace std; void solve(){ int n,k,d; cin>>n>>k>>d; vectorv(n); int minn =INT_MAX; for(auto &i: v) cin>>i; map<int,int>mp; if(n==1){ cout<<1<<endl; return; } for(int i=0;i<n-1;i++){ int sum=0; for(int g=i;g<d+i;g++) mp[v[g]]++; sum+=mp.size(); minn= min(sum,minn); mp.clear(); } cout<<minn<<'\n'; } int main() { int t; cin>>t; while(t--){ solve(); } }

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English farmaan_khan 2022-11-24 10:36:50 484
en1 English farmaan_khan 2022-11-24 10:35:37 540 Initial revision (published)