Logo
(追記) (追記ここまで)

33304번 - The Great Lever Challenge 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
20 초 2048 MB2000.000%

문제

This is a problem with public tests.

Do you like puzzle games? I bet you do! So, I've prepared a special challenge for you.

Welcome to a labyrinthine maze where a robotic marvel awaits your command. Your mission, should you choose to accept it, is to deftly guide this intrepid robot from its designated starting position to the ultimate destination. But how will you achieve this? The robot is controlled by a series of levers, each with unique properties that define the robot's movements throughout the maze.

Each lever possesses three key attributes:

  1. Length: this is the distance the robot will traverse upon activation of the lever.
  2. Dimension: this signifies the axis of movement: $x$ axis (horizontal) or $y$ axis (vertical).
  3. State: this defines the direction of movement: positive (+) or negative (-).

When you pull a lever, you change its state into its opposite. After that, the robot moves in the direction specified by the new state of the lever. When the new state is positive, the robot moves by the distance equal to the lever's length towards the positive end of the designated axis. Conversely, when the new state of the lever is negative, the robot moves towards the negative end. Beware, however! If the robot encounters a wall or the border of the maze, it comes to a halt, and will move again only after the next lever activation.

Your task is to transport the robot from the starting point to the finish line.

There are only 10ドル$ levels. Complete them all!

입력

The first line of input contains a single integer representing the number of the current test. In the next line, you will find two integers $n$ and $m$ (1ドル \leq n, m \leq 1000$), where $n$ denotes the number of rows and $m$ represents the number of columns in the maze. It is followed by a line with an integer $k$ (1ドル \leq k \leq 100$) which indicates the number of available levers.

Each lever will be described with a line in the format "<len><dim><state>", where <len> is an integer from 1ドル$ to 1000ドル,ドル <dim> is either "x" or "y", and <state> is either "-" or "+".

The next $n$ lines will depict the maze itself through strings of $m$ characters:

  • "#" denotes a wall,
  • "." signifies an empty space,
  • "@" indicates the starting position,
  • "$" marks the finishing position.

It is guaranteed that there will only be one start and one finish in each maze configuration, and every test is guaranteed to be solvable.

The axes are defined such that the $Ox$ axis extends from left to right, while the $Oy$ axis moves from top to bottom.

All tests for this problem are public. Be sure to access them through the "download samples" feature.

출력

Your output should consist of a sequence of lever indices that you will pull in the order necessary to successfully navigate the robot from its starting position to the finish line. The levers are numbered starting from 1ドル$ in the same order as given in the input.

The number of lever indices in the output should not exceed 10ドル^5$. It is guaranteed that each test can be solved with this additional constraint.

제한

예제 입력 1

1
10 10
2
2x-
2y-
@..#######
##..######
$.#..#####
#..#..####
##..#..###
###..#..##
####..#..#
#####..#.#
######...#
##########

예제 출력 1

1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1
2 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 2 2
1 1 2 2 1 1 2 2 1 1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 6: Nyatl’s Game Contest C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /