```cpp
var
x,y,z,n,m,i,ans:longint;
u,c:array[0..30000] of longint;
begin
readln(n,m);
for i:=1 to n do
read(u[i]);
for i:=1 to n do
read(c[i]);
for x:=1 to n-1 do
for y:=x+1 to n do
begin
z:=2*y-x;
if c[x]=c[z] then ans:=(ans+(x+z)*(u[x]+u[z])) mod 10007;
end;
writeln(ans);
end.
做出来了!伟大
```
by LeoZ725 @ 2017-10-29 16:39:07
@[LeoZ725](/space/show?uid=37870) 你很像我班级的一个同学,动不动就伟大的。。。
by Altria_Pendragon_ @ 2017-11-09 21:45:22