在线评测:
http://codevs.cn/problem/3578/
整体思路:
他怎么说,你就怎么做,不要在意n^2*m^2一样能过,
失误之处:
无
体会心得:
水题一定要认证做,不要想noip2015T1那样数组开小什么之类的,
AC代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
using
namespace
std;
int
d,n,x,y,k,mp[150][150],maxn,tot;
queue <
int
> dl;
int
main()
{
scanf
(
"%d%d"
,&d,&n);
for
(
int
i = 1;i <= n;i++)
{
scanf
(
"%d%d%d"
,&x,&y,&k);
mp[x][y] = k;
}
for
(
int
i = 0;i <= 128;i++)
{
for
(
int
j = 0;j <= 128;j++)
{
int
ans = 0;
for
(
int
o = max(0,i - d);o <= min(128,i + d);o++)
{
for
(
int
p = max(0,j - d);p <= min(128,j + d);p++)
{
ans += mp[o][p];
}
}
maxn = max(maxn,ans);
if
(ans == maxn) dl.push(ans);
}
}
while
(!dl.empty())
{
if
(dl.front() == maxn) tot++;
dl.pop();
}
printf
(
"%d %d\n"
,tot,maxn);
return
0;
}
|