玲珑杯 Round #18 A -- 计算几何你瞎暴力



因为坐标都在1-10之间,因此可暴力求解
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll n,m,x,y,z,t;
ll a[][][];
ll b[];
ll sum[];
void init()
{
for(ll i=;i<=;i++)
{
for(ll j=;j<=;j++)
{
for(ll k=;k<=;k++)
{
a[i][j][k]=;
}
}
}
for(ll i=;i<=;i++)
{
b[i]=;
sum[i]=;
}
}
void solve()
{
for(ll i=;i<=;i++)
{
for(ll j=;j<=;j++)
{
for(ll k=;k<=;k++)
{
b[]+=((a[i][j][k]-)*a[i][j][k])/;
}
}
}
for(ll i=;i<=;i++)
{
for(ll j=;j<=;j++)
{
for(ll k=;k<=;k++)
{
for(ll x=;x<=;x++)
{
for(ll y=;y<=;y++)
{
for(ll z=;z<=;z++)
{
if(i==x && j==y && z==k) continue;
ll t=abs(x-i)+abs(y-j)+abs(z-k);
b[t]+=(a[i][j][k]*a[x][y][z]);
}
}
}
}
}
}
sum[]=b[];
for(int i=;i<=;i++)
sum[i]=sum[i-]+b[i]/;
}
int main()
{
scanf("%lld",&t);
while(t--)
{
init();
scanf("%lld%lld",&n,&m);
for(int i=;i<=n;i++)
{
scanf("%lld%lld%lld",&x,&y,&z);
a[x][y][z]++;
}
solve();
while(m--)
{
scanf("%lld",&x);
if(x>) x=;
printf("%lld\n",sum[x]);
}
}
return ;
}
玲珑杯 Round #18 A -- 计算几何你瞎暴力的更多相关文章
- 玲珑杯”ACM比赛 Round #18 A -- 计算几何你瞎暴力(瞎暴力)
题目链接:http://www.ifrog.cc/acm/problem/1143?contest=1020&no=0 题解:就是瞎暴力具体多暴力看一下代码就知道了. #include < ...
- 【玲珑杯 round#18 A】计算几何你瞎暴力
[Link]:http://www.ifrog.cc/acm/problem/1143?contest=1020&no=0 [Description] [Solution] 因为每个点的(xi ...
- 【玲珑杯 round#18 B】图论你先敲完模板
[Link]:http://www.ifrog.cc/acm/problem/1146 [Description] [Solution] 设f[i]表示在第i个点休息的话最少需要的体力值; f[i]= ...
- “玲珑杯”ACM比赛 Round #18
“玲珑杯”ACM比赛 Round #18 Start Time:2017-07-15 12:00:00 End Time:2017-07-15 15:46:00 A -- 计算几何你瞎暴力 Time ...
- LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力
二次联通门 : LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力 /* LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力 叫做计算几 ...
- 汕头市队赛 SRM14 T1 计算几何瞎暴力
计算几何瞎暴力 (easy.pas/c/cpp) 128MB 1s 在平面上,给定起点和终点,有一面墙(看作线段)不能穿过,问从起点走到终点的最短路程. 输入格式 输入一行,包含8个用空格分隔的整数x ...
- loj517 计算几何瞎暴力
在序列上维护4个操作 1.在序列的尾端添加x 2.输出Al~Ar的和 3.将所有数异或x 4.将序列从小到大排序 第一眼看上去是Splay于是头铁硬刚了一发 后来发现splay没法异或 去百度“维护异 ...
- Codeforces Beta Round #18 (Div. 2 Only)
Codeforces Beta Round #18 (Div. 2 Only) http://codeforces.com/contest/18 A 暴力 #include<bits/stdc+ ...
- 题解-CSA Round#18 Randomly Permuted Costs
Problem CSA Round 18 题意概要:给定一个有重边有自环 \(n\) 点 \(m\) 边的有向无环图(DAG),每条边有其权值,每当你走到一个点 \(x\) 时,所有从 \(x\) 连 ...
随机推荐
- mayan 游戏 search
纯搜索,,,模拟,,还不算太难,,就是细节略繁琐 首先因为题目要求保证字典序,所以显然把右边的块换到左边不如把左边的块换到右边优, 所以可以进行不小规模的剪枝,之后显然交换两块相同的色块没有意义,至此 ...
- 实现浮点数的四舍五入RoundOff,保留几位小数
直接上代码,非常简短 double myRound(double d,int n) { d = d*pow(10,n); d += 0.5; d = (long)d; d = d/pow(10,n); ...
- 去除ListView 上下边界蓝色或黄色阴影
默认的情况下,在 ListView 滑动到顶部或者是底部的时候,会有黄色或者蓝色的阴影出现.在不同的版本号上解决办法是不同的,在 2.3 版本号之前能够在 ListView 的属性中通过设置 andr ...
- node tail 日志服务
var http = require('http'), ,spawn = require('child_process').spawn function onRequest(req, res) { v ...
- nodejs02
Node.js没有根目录的概念,因为它根本没有任何的web容器! 让node.js提供一个静态服务,都非常难! 也就是说,node.js中,如果看见一个网址是 1127.0.0.1:3000/fang ...
- 86.express里面的app.configure作用
以下摘自 express 3.0 的 文档 app.configure([env], callback) Conditionally invoke callback when env matches ...
- Random words
To choose a random word from the histogram, the simplest algorithm is to build a list with multiple ...
- Hints
If you played with the Fibonacci function, you might have noticed that the bigger the argument you p ...
- 32.智能指针auto_ptr
#include <iostream> #include <memory> #include <string> #include <vector> us ...
- Glide加载圆形图片第一次只显示默认图片
Glide加载圆形图,又设置了默认图,很多时候第一次加载的时候只显示默认图.下面的方案可以解决.\ Glide.with(AudioDetailActivity.this) .load(cover) ...