Codeforces 1198D Rectangle Painting 1

这篇博客介绍了如何解决Codeforces上的1198D问题——Rectangle Painting 1。通过使用记忆化搜索策略,计算以特定坐标为起点和终点的矩形涂白的最小成本。
摘要由CSDN通过智能技术生成

传送门

思路: 一个比较简单的记忆化搜索,f[x][y][xx][yy]记录涂白以(x,y)为左上角且以(xx,yy)为右下角的矩形的最小花费.

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <time.h>
#include <map>
#include <set>
#define mem(a,x) memset(a,x,sizeof(a))
#define gi(x) scanf("%d",&x)
#define gi2(x,y) scanf("%d%d",&x,&y)
#define gi3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gll(x) scanf("%lld",&x)
#define gll2(x,y) scanf("%lld%lld",&x,&y)
#define random(x) (rand()%x)
using namespace std;
const double eps=1e-8; 
typedef long long ll;
const int MAXN=52;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
char a[MAXN][MAXN];
int 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值