比赛 EYOI与SBOI开学欢乐赛5th 评测结果 AWWWWWWWWWWAWAAAWWAW
题目名称 卫星覆盖 最终得分 30
用户昵称 遥时_彼方 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-09-16 20:39:41
显示代码纯文本
#include<bits/stdc++.h>
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define drep(x,y,z) for(int x=y;x>=z;x--)
#define ull unsigned long long
#define ll long long
using namespace std;
inline ll read()
{
	ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
} 
inline void write(ll x)
{
	if(x<0) {x=~(x-1);putchar('-');}
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
/////////////////////////////////// 
int nc;
struct S
{
	ll x;
	ll y;
	ll z;
	ll r;
}a[105];
ll ans;
int main()
{
    freopen("satellitecover.in","r",stdin);
	freopen("satellitecover.out","w",stdout);
    nc=read();
    rep(i,1,nc) 
	{
		a[i].x=read(),a[i].y=read(),a[i].z=read(),a[i].r=read();
		ans+=(a[i].r*a[i].r*a[i].r)<<3;
//		cout<<i<<":"<<((a[i].r*a[i].r*a[i].r)<<3)<<endl;
		rep(o,1,i-1)
		{
			if(min(a[i].x+a[i].r,a[o].x+a[o].r)>max(a[i].x-a[i].r,a[o].x-a[o].r)&&min(a[i].y+a[i].r,a[o].y+a[o].r)>max(a[i].y-a[i].r,a[o].y-a[o].r)&&min(a[i].z+a[i].r,a[o].z+a[o].r)>max(a[i].z-a[i].r,a[o].z-a[o].r))
			{
//				cout<<i<<"|"<<o<<" ks:"<<ans<<" "<<a[i].x-a[i].r<<" "<<a[o].x<<endl;
				ans-=(min(a[i].x+a[i].r,a[o].x+a[o].r)-max(a[i].x-a[i].r,a[o].x-a[o].r))*(min(a[i].y+a[i].r,a[o].y+a[o].r)-max(a[i].y-a[i].r,a[o].y-a[o].r))*(min(a[i].z+a[i].r,a[o].z+a[o].r)-max(a[i].z-a[i].r,a[o].z-a[o].r));
//				cout<<i<<"|"<<o<<" ed:"<<ans<<endl;
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}