您当前的位置: 首页 >  ui

HeartFireY

暂无认证

  • 4浏览

    0关注

    334博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

2021牛客暑期多校训练营2.I Penguins BFS广搜 简单

HeartFireY 发布时间:2021-07-20 10:00:31 ,浏览量:4

2021牛客暑期多校训练营2.I Penguins BFS广搜 简单

火车上没法写,来补题了…

链接:https://ac.nowcoder.com/acm/contest/11253/I

题目描述

Lovely penguins is a tiny game in which the player controls two penguins.

img

The game holds in two 20 × 20 20×20 20×20 grids (the left one and the right one), and each has some blocked places.

We number the grid in x t h x^{th} xth row (starting from the up), y t h y^{th} yth column (starting from the left) ( x , y ) (x,y) (x,y)

The penguins move in four directions: up, down, left, right, exactly one step once. If its way is blocked, or it reaches the border, then this movement is omitted. The player also moves the penguins in four directions, but the behavior of the two penguins is mirrored:

  1. ​ L : left penguin moves to left, right penguin moves to right.
  2. ​ R : left penguin moves to right, right penguin moves to left.
  3. ​ U : both move upwards.
  4. ​ D : both move downwards.

An operation can be omitted on one penguin but works on another.

The left penguin starts from ( 20 , 20 ) (20,20) (20,20) and wants to move to ( 1 , 20 ) (1,20) (1,20).The right penguin starts from ( 20 , 1 ) (20,1) (20,1) and wants to move to ( 1 , 1 ) (1,1) (1,1).If both penguin reach there destination, thay win the game.

Find out the shortest way to win the game.If there are many shortest ways to win, find the one with minimum lexicographical order(D

关注
打赏
1662600635
查看更多评论
立即登录/注册

微信扫码登录

0.3184s