自己摸索
2024-08-29 21:48:12
发布于:广东
11阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int h[1003]={0};
queue<int>mem;
int main(){
int m,n;
cin >> m >> n;
int cnt=0;
while(n--){
int en;
cin >> en;
if(!h[en]){
cnt++;
mem.push(en);
h[en]=1;
while(mem.size()>m){
h[mem.front()]=0;
mem.pop();
}
}
}
cout << cnt;
return 0;
}
这里空空如也
有帮助,赞一个