记录编号 |
173117 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2014]无线网路发射器选址 |
最终得分 |
100 |
用户昵称 |
啊吧啦吧啦吧 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.009 s |
提交时间 |
2015-07-28 06:15:54 |
内存使用 |
0.34 MiB |
显示代码纯文本
#include <iostream>
#include <fstream>
using namespace std;
int g[129][129], n, d, ans1 = 0, ans2 = 0;
main()
{
ifstream fin("wireless.in");
ofstream fout("wireless.out");
#define cin fin
#define cout fout
ios::sync_with_stdio(false);
cin >> d >> n;
for (int i = 1; i <= n; ++i){
int a, b, c, x1, x2, y1, y2;
cin >> a >> b >> c;
x1 = max(a - d, 0);
y1 = max(b - d, 0);
x2 = min(a + d, 128);
y2 = min(b + d, 128);
for (int j = x1; j <= x2; ++j)
for (int k = y1; k <= y2; ++k)
g[j][k] += c;
}
for (int i = 0; i < 129; ++i)
for (int j = 0; j < 129; ++j)
if(ans2 < g[i][j]){
ans2 = g[i][j];
ans1 = 1;
}
else if(ans2 == g[i][j])
ans1++;
cout << ans1 << ' ' << ans2;
}