[arc062E]Building Cubes with AtCoDeer
Description
Solution
这道题直接暴力就好。。毕竟只要枚举了前后两个瓷砖的方向和编号,其他瓷砖的颜色就是确定的了。
然而场上我的去重除了问题qaq。
我们钦定在立方体最前面的块编号最小且不可转(这样就可以做到不重不漏),然后枚举最后面的瓷砖编号和方向。
如此,其他四块瓷砖的颜色就已经确定。当我们找了一块瓷砖,就要在map中把该瓷砖的信息删掉以防重复(听大佬说这里的删除也可以用容斥代替)。
Code
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
int n;
struct node{int col[];
node nxt(){ return node{col[],col[],col[],col[]};}
friend bool operator <(node a,node b)
{
for (int i=;i<;i++)
if (a.col[i]!=b.col[i]) return a.col[i]<b.col[i];
return ;
}
}a[],a1,a2,a3,a4;
map<node,int>mp;
void insert(node x,int v)
{for (int i=;i<;i++,x=x.nxt()) mp[x]+=v;} node xx,yy;
int id1;
ll ans,re;
int main()
{
scanf("%d",&n);
for (int i=;i<=n;i++)
{
scanf("%d%d%d%d",&a[i].col[],&a[i].col[],&a[i].col[],&a[i].col[]);
insert(a[i],);
}
for (int i=;i<=n;i++)
{
insert(a[i],-);
for (int j=i+;j<=n;j++)
{
insert(a[j],-);
for (int t=;t<;t++)
{
a1=node{a[j].col[],a[i].col[],a[i].col[],a[j].col[]};
a2=node{a[i].col[],a[j].col[],a[j].col[],a[i].col[]};
a3=node{a[j].col[],a[j].col[],a[i].col[],a[i].col[]};
a4=node{a[i].col[],a[i].col[],a[j].col[],a[j].col[]};
a[j]=a[j].nxt();
if (mp[a1]==||mp[a2]==||mp[a3]==||mp[a4]==) continue;
re=;
re*=mp[a1];insert(a1,-);
re*=mp[a2];insert(a2,-);
re*=mp[a3];insert(a3,-);
re*=mp[a4];
insert(a1,);insert(a2,);insert(a3,);
ans+=re; }
insert(a[j],);
}
}
cout<<ans;
}
[arc062E]Building Cubes with AtCoDeer的更多相关文章
- 【arc062e】Building Cubes with AtCoDeer
Description STL有n块瓷砖,编号从1到n,并且将这个编号写在瓷砖的正中央: 瓷砖的四个角上分别有四种颜色(可能相等可能不相等),并且用Ci,0,Ci,1,Ci,2,Ci,3分别表示左上. ...
- 2018.09.20 atcoder Building Cubes with AtCoDeer(枚举)
传送门 有个十分显然的结论,只用枚举前后两个面就可以知道所有的面的颜色. 于是可以O(n2)O(n^2)O(n2)枚举前后两个面然后用map乱搞求贡献. 发现这样算出来会多算两倍(打表证明)于是答案除 ...
- AtCoder Regular Contest 062 E - AtCoDeerくんと立方体づくり / Building Cubes with AtCoDeer
题目传送门:https://arc062.contest.atcoder.jp/tasks/arc062_c 题目大意: 给你\(N\)块正方形木板,每块木板四角有四种颜色(可以相同),木板中央有编号 ...
- AtCoder 杂题训练
前言: 因为要普及了,今年没一等就可以退役去学文化课了,所以暑假把历年noip普及组都刷了一遍,离noip还有50+天,想弄点强化训练什么的. 想了想,就这些天学文化课之余有空就把AtCoder之前那 ...
- atcoder题目合集(持续更新中)
Choosing Points 数学 Integers on a Tree 构造 Leftmost Ball 计数dp+组合数学 Painting Graphs with AtCoDeer tarja ...
- NOIp2018模拟赛三十二
继续挂成傻逼 成绩:100+0+10(90)=110 A全场一眼题,C没取模挂八十分,然后没特判特殊情况又挂十分 A:[agc009b]tournament(太简单,咕了) B:[ATC2142]Bu ...
- 【AtCoder】ARC062
ARC062 C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report 每次看看比率至少变成多少倍能大于当前的数 然后就把两个人的票都改成那个数 #incl ...
- Intel® Threading Building Blocks (Intel® TBB) Developer Guide 中文 Parallelizing Data Flow and Dependence Graphs并行化data flow和依赖图
https://www.threadingbuildingblocks.org/docs/help/index.htm Parallelizing Data Flow and Dependency G ...
- Codeforces Round #356 (Div. 2) D. Bear and Tower of Cubes dfs
D. Bear and Tower of Cubes 题目连接: http://www.codeforces.com/contest/680/problem/D Description Limak i ...
随机推荐
- python正则二
在python中,我们可以使用re模块来使用正则表达式. 正则表达式使用\对特殊字符进行转义,因为python本身也是用\作为转义,所以在使用正则的时候会出现这样的情况,'python\\.org', ...
- 【OpenCV】三种方式操作图像像素
OpenCV中,有3种访问每个像素的方法:使用at方法.使用迭代器方法.使用指针 运行如下程序后可以发现使用at方法速度最快. 代码如下: //操作图像像素 #include <opencv2/ ...
- nginx下配置多个web服务
参考 nginx配置详解 nginx反向代理与负载均衡详解 一.nginx简介: Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能 ...
- HttpURLConnection与HttpClient学习
转载HttpURLConnection与HttpClient浅析 一.HttpURLConnection的使用 import org.slf4j.Logger; import org.slf4j.Lo ...
- ServletContextListener在Springboot中的使用
ServletContextListener是servlet容器中的一个API接口, 它用来监听ServletContext的生命周期,也就是相当于用来监听Web应用的生命周期.今天我们就来说说如何在 ...
- 后台npm
后台进程运行 nohupwhich nohup.bash_profile中并source加载 如果没有就安装吧yum provides */nohup nohup npm start &原程序 ...
- CS 20_Overview of Tensorflow
tf.assign(A, new_number): 这个函数的功能主要是把new_number的值向前传递给了A run( fetches, feed_dict=None, options=None, ...
- Luogu[P1108] 低价购买
\(Link\) \(\mathcal{\color{red}{Description}}\) 请你求出一个数列的最长下降子序列长度,并为此求出其方案数. \[1 \leq N \leq 5000\] ...
- The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (0), plus or minus the number of
现象:当删除CollectionView 当中的某个section的时候,报上面的错误 初步分析:当前CollectionView删除前后都不止一个Section,怎么会报那样的错误:猜想可能是相册界 ...
- pThread多线程demo
#import "ViewController.h" #import <pthread.h> @interface ViewController () @end @im ...