记录编号 335271 评测结果 AAAAAAAAAA
题目名称 [NOIP 2014]无线网路发射器选址 最终得分 100
用户昵称 Gravatarzeppoe 是否通过 通过
代码语言 Pascal 运行时间 0.625 s
提交时间 2016-11-01 23:11:43 内存使用 10.91 MiB
显示代码纯文本
  1. program wz;
  2. var
  3. num:array[-20000..20000]of longint;
  4. w:array[-1000..1000,-1000..1000]of longint;
  5. max,ans,d,n,x,y,k,i,j,p:longint;
  6. begin
  7. assign(input,'wireless.in');
  8. assign(output,'wireless.out');
  9. reset(input);
  10. rewrite(output);
  11.  
  12. readln(d);
  13. readln(n);
  14. fillchar(w,sizeof(w),0);
  15. for i:=1 to n do
  16. begin
  17. readln(x,y,k);
  18. w[x,y]:=k;
  19. end;
  20. for i:=0 to 128 do
  21. for j:=0 to 128 do
  22. begin
  23. ans:=0;
  24. for p:=i-d to i+d do
  25. for k:=j-d to j+d do
  26. ans:=ans+w[p,k];
  27. if ans>max then max:=ans;
  28. if ans=max then inc(num[max]);
  29. end;
  30. writeln(num[max],' ',max);
  31. close(input);
  32. close(output);
  33. end.