HDU - 1400

思路:

轮廓线dp入门题

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head const int N = ;
LL dp[][<<N], n, m, cur;
void update(int a, int b) {
if(b & (<<m))dp[cur][b^(<<m)] += dp[-cur][a];
}
int main() {
while(~ scanf("%d%d", &n, &m) && n && m) {
if(n < m) swap(n, m);
mem(dp, );
cur = ;
dp[][(<<m)-] = ;
for (int i = ; i < n; i++) {
for (int j = ; j < m; j++) {
cur ^= ;
mem(dp[cur], );
for (int k = ; k < (<<m); k++) {
update(k, k<<);
if(i && !(k & (<<m-))) update(k, (k<<)^(<<m)^);
if(j && !(k & )) update(k, (k<<)^);
} }
}
printf("%lld\n", dp[cur][(<<m)-]);
}
return ;
}

HDU - 1400 Mondriaan's Dream的更多相关文章

  1. hdu 1400 Mondriaan's Dream 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1400 题目意思:给出一个h * w的 大 矩形,需要用 1 * 2 的砖块去填充这个大矩形,问填充的方 ...

  2. [ACM] HDU 1400 Mondriaan&#39;s Dream (状态压缩,长2宽1长方形铺满)

    Mondriaan's Dream Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Othe ...

  3. HDU 1400 (POJ 2411 ZOJ 1100)Mondriaan's Dream(DP + 状态压缩)

    Mondriaan's Dream Problem Description Squares and rectangles fascinated the famous Dutch painter Pie ...

  4. POJ 题目2411 Mondriaan's Dream(状压DP)

    Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 13519   Accepted: 787 ...

  5. POJ2411 Mondriaan's Dream(状态压缩)

    Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15295   Accepted: 882 ...

  6. POJ 2411 Mondriaan's Dream -- 状压DP

    题目:Mondriaan's Dream 链接:http://poj.org/problem?id=2411 题意:用 1*2 的瓷砖去填 n*m 的地板,问有多少种填法. 思路: 很久很久以前便做过 ...

  7. POJ2411 铺地砖 Mondriaan's Dream

    Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15962   Accepted: 923 ...

  8. [poj P2411] Mondriaan's Dream

    [poj P2411] Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 18023   A ...

  9. POJ 2411 Mondriaan's Dream 插头dp

    题目链接: http://poj.org/problem?id=2411 Mondriaan's Dream Time Limit: 3000MSMemory Limit: 65536K 问题描述 S ...

随机推荐

  1. 问题:oracle 12c rac数据库服务器的home目录丢失问题解决2018-06-25 18:30

    问题原因:是由于运维粗心,在缩容/home(此目录下挂载了逻辑卷lv_home)时没有先缩小文件系统(resize2fs)也没有备份,导致home数据损坏,重启时系统无法正常启动 解决方案:跳过此ho ...

  2. How to use Junit Listener

    JUnit Listeners If you want to do some operations when your tests are started, passed, finished, fai ...

  3. RabbitMQ 入门指南——初步使用

    MQ的消息持久化 https://www.rabbitmq.com/tutorials/tutorial-two-java.html When RabbitMQ quits or crashes it ...

  4. bzoj1497 [NOI2006]最大获利 最大权闭合子图

    链接 https://www.lydsy.com/JudgeOnline/problem.php?id=1497 思路 最大权闭合子图的裸题 一开始知道是这个最大权闭合子图(虽然我不知道名字),但是我 ...

  5. 网络流24题 P2754 [CTSC1999]家园

    思路 如图,建立分层图跑dinic 每次在残余网络里加边继续跑 跑到ans>=k时候的i就是答案 诶呀啊,忘记弄箭头了,最后一列是向上的箭头,不过聪明的你们应该没啥影响 代码 #include ...

  6. (转)开源项目t-io

    石墨文档:https://shimo.im/docs/tHwJJcvKl2AIiCZD/ (二期)18.开源t-io项目解读 [课程18]BIO....AIO.xmind0.4MB [课程18]t-i ...

  7. 安装ubuntu的坑&RHEL7配置

    1.需要其他设置->分区,分区需要有/根目录分区和swap空间,后者文件系统类型选择swap,其他都是ext4 2.普通配置电脑,安装16.04.5 LTS,不要安装最新的,安装重启后卡在那里, ...

  8. Linux command: grep

    How to use grep to match multiple strings in the same line? grep 'string1\|string2' filename grep -E ...

  9. pip运行错误

    错误: [root@centos64 numpy-1.13.1]# pip install numpy-1.13.1-cp27-cp27m-manylinux1_x86_64.whl Tracebac ...

  10. WinMerge 过滤器用法

    WinMerge是一款开源的文件对比合并工具.http://winmerge.org/WinMerge提供了“过滤器”功能,可以在对比时排除特定的目录或文件. 1.编辑过滤规则工具 -> 过滤器 ...