problem
solution
codes
//STL大法好
#include<iostream>
#include<set>
#include<queue>
using namespace std;
queue<int>q;
set<int>s;
int main(){
int m, n, ans = 0;
cin>>m>>n;
for(int i = 1; i <= n; i++){
int x; cin>>x;
if(s.count(x))continue;
else{
ans++;
q.push(x); s.insert(x);
if(q.size()> m){
s.erase(q.front());
q.pop();
}
}
}
cout<<ans<<"\n";
return 0;
}
标签:cout,NOIP2010,int,Luogu1540,机器翻译,pop,ans,include
From: https://blog.51cto.com/gwj1314/6043786