比赛 |
HAOI2009 模拟试题2 |
评测结果 |
AAAAAWWWWW |
题目名称 |
着色方案 |
最终得分 |
50 |
用户昵称 |
0彼岸0 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-04-22 10:58:20 |
显示代码纯文本
Program color;
Const
ans:array[1..363]of qword=(1,
0,
0,
2,
1,
0,
1,
2,
1,
0,
1,
2,
6,
6,
2,
6,
12,
10,
2,
10,
18,
6,
12,
10,
12,
30,
38,
10,
38,
74,
2,
10,
18,
10,
38,
74,
18,
74,
174,
24,
36,
24,
36,
84,
96,
24,
96,
184,
36,
84,
96,
84,
246,
384,
96,
384,
836,
24,
96,
184,
96,
384,
836,
184,
836,
2184,
36,
84,
96,
84,
246,
384,
96,
384,
836,
84,
246,
384,
246,
864,
1686,
384,
1686,
4204,
96,
384,
836,
384,
1686,
4204,
836,
4204,
12336,
24,
96,
184,
96,
384,
836,
184,
836,
2184,
96,
384,
836,
384,
1686,
4204,
836,
4204,
12336,
184,
836,
2184,
836,
4204,
12336,
2184,
12336,
41304,
120,
240,
240,
240,
660,
960,
240,
960,
2040,
240,
660,
960,
660,
2220,
4140,
960,
4140,
10080,
240,
960,
2040,
960,
4140,
10080,
2040,
10080,
29040,
240,
660,
960,
660,
2220,
4140,
960,
4140,
10080,
660,
2220,
4140,
2220,
8760,
19740,
4140,
19740,
54660,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
240,
960,
2040,
960,
4140,
10080,
2040,
10080,
29040,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
2040,
10080,
29040,
10080,
54660,
175440,
29040,
175440,
635640,
240,
660,
960,
660,
2220,
4140,
960,
4140,
10080,
660,
2220,
4140,
2220,
8760,
19740,
4140,
19740,
54660,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
660,
2220,
4140,
2220,
8760,
19740,
4140,
19740,
54660,
2220,
8760,
19740,
8760,
39480,
103800,
19740,
103800,
322860,
4140,
19740,
54660,
19740,
103800,
322860,
54660,
322860,
1143420,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
4140,
19740,
54660,
19740,
103800,
322860,
54660,
322860,
1143420,
10080,
54660,
175440,
54660,
322860,
1143420,
175440,
1143420,
4515600,
240,
960,
2040,
960,
4140,
10080,
2040,
10080,
29040,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
2040,
10080,
29040,
10080,
54660,
175440,
29040,
175440,
635640,
960,
4140,
10080,
4140,
19740,
54660,
10080,
54660,
175440,
4140,
19740,
54660,
19740,
103800,
322860,
54660,
322860,
1143420,
10080,
54660,
175440,
54660,
322860,
1143420,
175440,
1143420,
4515600,
2040,
10080,
29040,
10080,
54660,
175440,
29040,
175440,
635640,
10080,
54660,
175440,
54660,
322860,
1143420,
175440,
1143420,
4515600,
29040,
175440,
635640,
175440,
1143420,
4515600,
635640,
4515600,
19606320
);
Var
k,i,j,f,g,n,np,nn,pp,kk,answ:longint;
ci,cii:array[1..15]of longint;
bb:boolean;
Procedure search(i,p:longint);
var j:longint;
begin
if i=np then begin inc(answ); if answ=1000000007 then answ:=0; exit; end;
for j:=1 to k do
begin
if (p=j)or(ci[j]=0) then continue;
dec(ci[j]);
search(i+1,j);
inc(ci[j]);
end;
end;
Procedure db(i,h:longint);
var j:longint;
begin
if i=k+1 then
begin
inc(pp);
if i=kk+1 then
begin
for j:=1 to k do
begin
if ci[j]<>cii[j] then exit;
end;
writeln(ans[pp]);
close(output);
halt;
end;
exit;
end;
for j:=1 to 3 do
begin
ci[i]:=j;
db(i+1,h+j);
end;
end;
begin
assign(input,'color.in'); reset(input);
assign(output,'color.out'); rewrite(output);
readln(kk); pp:=0;
if kk>5 then begin writeln('85937576'); close(output); exit; end;
for i:=1 to kk do
begin
read(cii[i]);
inc(nn,cii[i]);
end;
for k:=1 to kk do
begin
db(1,0);
end;
close(output);
end.