Orange Boy Can You Solve It Out? Ep. 56

思考题 during OI recovery

Rubbish Problem

Maybe you have heard of the evil problem Hilbert's Hedge Maze and here's another very fun problem!

You have n items arranged in rows. Each row contains r items and the items are arranged from left to right, from up to down. For example:

n=18 r=5
OOOOO
OOOOO
OOOOO
OOO
n=14 r=7
OOOOOOO
OOOOOOO

You want to start at any item and try to find a path(by moving up,down,left or right between the items) that visits each item once(and only once!) and finally ends at the k-th item (from the top-left). Is it possible?

Please refer to the examples for more details:

Examples

n=18 r=5 k=8
Ans=YES

the illustration below shows two possible drawings:

n=7 r=3 k=2
Ans=NO

the illustration below shows three INCORRECT drawings:

Constraints

Do as fast as u can!!!

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/1188
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录