POJ - 1128 Frame Stacking (拓扑排序+dfs)

该博客详细解析了POJ 1128题目的解决方案,通过拓扑排序和深度优先搜索(DFS)算法,确定由大写字母组成的方框从下到上的所有可能排列顺序。重点在于理解如何处理入度为0的框,并反向操作拓扑排序以满足题目中从下到上的字典序要求。
摘要由CSDN通过智能技术生成

题目链接:http://poj.org/problem?id=1128点击打开链接

Frame Stacking
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 5646   Accepted: 1973

Description

Consider the following 5 picture frames placed on an 9 x 8 array. 
........ ........ ........ ........ .CCC....

EEEEEE.. ........ ........ ..BBBB.. .C.C....

E....E.. DDDDDD.. ........ ..B..B.. .C.C....

E....E.. D....D.. ........ ..B..B.. .CCC....

E....E.. D....D.. ....AAAA ..B..B.. ........

E....E.. D....D.. ....A..A ..BBBB.. ........

E....E.. DDDDDD.. ....A..A ........ ........

E....E.. ........ ....AAAA ........ ........

EEEEEE.. ........ ........ ........ ........

    1        2        3        4        5   

Now place them on top of one another starting with 1 at the bottom and ending up
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值