记录编号 | 545700 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 518.[NOIP 2010]机器翻译 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.000 s | ||
提交时间 | 2019-10-31 20:12:17 | 内存使用 | 0.00 MiB | ||
#include<cstdio> #include<iostream> #include<queue> using namespace std; bool check[1005]; int Main(){ freopen("translate.in","r",stdin); freopen("translate.out","w",stdout); queue<short> q; short m,n; scanf("%d %d",&m,&n); short temp; short tot=0,size=0; for(short i = 1;i<=n;++i){ scanf("%d",&temp); if(!check[temp]){ tot++; if(size==m){ check[q.front()]=false; q.pop(); } else size++; check[temp]=true; q.push(temp); } } printf("%d",tot); return 0; } int work=Main(); int main(){; }