比赛 |
20120711 |
评测结果 |
EWEEEEEEEEEE |
题目名称 |
平衡奶牛 |
最终得分 |
0 |
用户昵称 |
wo shi 刘畅 |
运行时间 |
0.007 s |
代码语言 |
Pascal |
内存使用 |
63.49 MiB |
提交时间 |
2012-07-11 11:54:26 |
显示代码纯文本
var
l,r,i,j,x,n,k,time,ans:longint;
s,a:array[0..200000,0..40]of longint;
b:array[0..200000]of longint;
procedure er(k,x:longint);
var
i:longint;
begin
while x>0 do
begin
inc(i);
a[k,i]:=x mod 2;
x:=x div 2;
end;
end;
function yes:boolean;
var
i:longint;
begin
for i:=2 to k do
if b[i]<>b[i-1] then yes:=false
else yes:=true;
end;
begin
assign(input,'balline.in'); reset(input);
assign(output,'balline.out'); rewrite(output);
readln(n,k);
for i:=1 to n do
begin
read(x);
er(i,x);
end;
if n=1 then
begin
writeln(0);
close(input);
close(output);
halt;
end;
for i:=1 to n do
for j:=1 to k do
s[i,j]:=s[i-1,j]+a[i,j];
r:=0;
for l:=0 to n-1 do
begin
for i:=n downto r do
begin
for j:=1 to k do
b[j]:=s[i,j]-s[l,j];
if yes then break;
end;
r:=i;
if r-l>ans then ans:=r-l;
inc(r);
end;
writeln(ans);
close(input);
close(output);
end.