UVA 1469 Sudoku Extension【加强版数独 DLX】

该博客介绍了如何基于DLX算法解决加强版数独问题,包括处理0~9的常规情况,以及特殊字符O和E的限制。对于O,允许填入2468;对于E,允许填入13579。对于其他字母,通过构建新列来表示各种可能的数字分配,并将这些列应用到DLX算法中,以此求解问题。
摘要由CSDN通过智能技术生成

大多数参照我写的上一篇博客,这次多了一些条件


对于0~9的情况,处理方法几乎一样。


对于O,处理方法则略加修改,相当于只能填写2468

E则为13579


对于其他字母,则构建新一些列,表示【A字母,写1,A字母是2,A字母是3 …… Z字母是1,Z字母是2,Z字母是3】


然后把这些列对应上去,直接跑DLX就能AC了。


#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
#include <tr1/unordered_map>
#include <ctime>
using std::tr1::unordered_map;
using std::sort;
using std::bitset;
using std::max;
using std::cout;
using std::stack;
using std::cin;
using std::endl;
using std::swap;
using std::pair;
using std::vector;
using std::set;
using std::map;
using std::multiset;
using std::queue;
using std::greater;
using std::string;
using std::priority_queue;
using std::max_element;
using std::min_element;
using __gnu_pbds::pairing_heap_tag;
__gnu_pbds::priority_queue
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值