比赛 防止颓废的小练习v0.2 评测结果 AAAAAAAAAA
题目名称 机器翻译 最终得分 100
用户昵称 Ten.X 运行时间 0.003 s
代码语言 Pascal 内存使用 0.20 MiB
提交时间 2016-10-18 14:01:16
显示代码纯文本
var j,n,m,temp,ans,i,x,head,tail:longint;
queue:array[1..10000]of longint;
f:boolean;
begin
assign(input,'translate.in');reset(input);
assign(output,'translate.out');rewrite(output);
ans:=0;
read(n,m);
head:=1;
tail:=head+n-1;
temp:=head;
for i:=head to tail do queue[i]:=-1;
for i:=1 to m do
begin
f:=false;
read(x);
for j:=head to tail do
if queue[j]=x then f:=true;
if not f then
if temp<=tail then begin inc(ans);queue[temp]:=x;inc(temp);end
else if temp>tail then begin inc(temp);inc(ans);inc(head);inc(tail);queue[tail]:=x;end;
end;
write(ans);close(input);close(output);
end.