## bzoj 1028 暴力枚举判断

/**************************************************************
Problem: 1028
Language: Pascal
Result: Accepted
Time:1032 ms
Memory:232 kb
****************************************************************/

var
n, m                        :longint;
count, jud                  :array[0..400] of longint;
i, j, k                     :longint;
x                           :longint;
ans                         :array[0..400] of longint;

function judge:boolean;
var
i                           :longint;
begin
for i:=1 to n+2 do
begin
if jud[i]<0 then exit(false);
jud[i]:=jud[i] mod 3;
if jud[i]>0 then
begin
dec(jud[i+1],jud[i]);
dec(jud[i+2],jud[i]);
jud[i]:=0;
end;
end;
exit(true);
end;

begin
for i:=1 to 3*m+1 do
begin
inc(count[x]);
end;
for i:=1 to n do
begin
for j:=1 to n do jud[j]:=count[j];
inc(jud[i]);
for j:=1 to n do if jud[j]>=2 then
begin
dec(jud[j],2);
if judge then
begin
inc(ans[0]);
ans[ans[0]]:=i;
end;
if ans[ans[0]]=i then break;
for k:=1 to n+2 do jud[k]:=count[k];
inc(jud[i]);
end;
end;
if ans[0]=0 then
begin
writeln('NO');
halt;
end;
write(ans[1]);
for i:=2 to ans[0] do write(' ',ans[i]); writeln;
end.

posted on 2014-01-01 02:22  BLADEVIL  阅读(472)  评论(0编辑  收藏  举报