博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SPOJ-Matrices with XOR property,暴力打表!
阅读量:4489 次
发布时间:2019-06-08

本文共 847 字,大约阅读时间需要 2 分钟。

                                        

   应该先去看看这题的,补题的时候发现这题其实挺简单的。。

   题意:n*m的格子用1-n*m的数去填,要求如果一个格子(i1,j1)与另外一个格子(i2,j2)满足(i1^j1)>(i2^j2),则a[i1][j1]>a[i2][j2]。问有多少种方法。

  思路:n和m都在1000以内,我们可以预处理所有的格子的异或值。我们发现只有异或值大小不同的格子上的数有大小要求,而如果异或值相同的格子他们的大小关系是任意的,所以我们把所有异或值相同的数目求出来然后乘以其阶乘即可。

//#pragma comment(linker, "/STACK:102400000,102400000")#include #include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;#define pd(x) printf("%d\n",x)#define plld(x) printf("%lld\n",x)#define pI64d(x) printf("%I64d\n",x)const int INF=1e9;const int MOD=1e9+7;const double eps=1e-7;const int N=1e3+5;int n,m,num[N][N],cnt[N*3];void init(){ memset(cnt,0,sizeof(cnt)); for(int i=1; i



转载于:https://www.cnblogs.com/nyist-TC-LYQ/p/7208099.html

你可能感兴趣的文章
uva 10791
查看>>
openlayers 4快速渲染管网模型数据
查看>>
MySQL相关小技巧
查看>>
SSH整合- 2- add service layout
查看>>
IP地址与UInt之间不得不说的故事
查看>>
【代码笔记】iOS-两个滚动条,上下都能滑动
查看>>
矩阵乘法-洛谷P2233 [HNOI2002] 公交车路线
查看>>
openstack云主机硬盘复制查询
查看>>
写个神经网络,让她认得我`(๑•ᴗ•๑)(Tensorflow,opencv,dlib,cnn,人脸识别)
查看>>
《程序是怎样跑起来的》第三章
查看>>
Jquery回到顶部效果
查看>>
开园第一笔
查看>>
Spark项目之电商用户行为分析大数据平台之(七)数据调研--基本数据结构介绍...
查看>>
原来fb可以在一个工程里面输出多个swf模块
查看>>
Codeforces Round #271 (Div. 2) E. Pillars 线段树优化dp
查看>>
Codeforces Round #FF (Div. 2) D. DZY Loves Modification 优先队列
查看>>
【学习】logger
查看>>
Delphi APP 開發入門(十)REST Client 開發
查看>>
elk
查看>>
.net 模糊匹配路径
查看>>