比赛 EYOI与SBOI开学欢乐赛5th 评测结果 AAATEEEEEEAETAAAAAAA
题目名称 卫星覆盖 最终得分 55
用户昵称 HeSn 运行时间 4.547 s
代码语言 C++ 内存使用 85.96 MiB
提交时间 2022-09-16 20:20:56
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int n, m, a[110], b[110], c[110], d[110], ans, maxa, maxb, maxc, maxd;
bool f[510][510][510];
signed main() {
	freopen("satellitecover.in", "r", stdin);
	freopen("satellitecover.out", "w", stdout);
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		maxa = max(maxa, a[i]);
		maxb = max(maxb, b[i]);
		maxc = max(maxc, c[i]);
		maxd = max(maxd, d[i]);
	}
	for(int i = 1; i <= n; i ++) {
		a[i] += maxa + maxd;
		b[i] += maxb + maxd;
		c[i] += maxc + maxd;
		for(int j = a[i] - d[i]; j <= a[i] + d[i] - 1; j ++) {
			for(int k = b[i] - d[i]; k <= b[i] + d[i] - 1; k ++) {
				for(int l = c[i] - d[i]; l <= c[i] + d[i] - 1; l ++) {
					if(!f[j][k][l]) {
						f[j][k][l] = 1;
						ans ++;
					}
				}
			}
		}
	}
	cout << ans;
    return 0;
}