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

32611번 - Dungeon of Darkness 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB86675.000%

문제

In his great quest to rescue princess Zelda and protect the kingdom of Hyrule from the clutches of the evil Ganondorf, you, the hero, have arrived in the Lost Woods to rescue an ancient sage. The spirits of the woods have decided to test your wits in a magic-infused dungeon. The dungeon consists of $n$ doors connecting two distinct rooms, each door marked by a glowing symbol on both sides (to simplify, each symbol is a number from 1ドル$ to $n$). Each room is shrouded in complete darkness, making you unable to see anything other than the symbols. You enter the dungeon through a magic door that disappears upon entry, and the sage waits for you after door $n$.

At the beginning of your quest, as well as every time you pass through a door, you see the symbols of all the doors that lead to and from the room which you are in. You also need to be quick of course, as the forces of Ganondorf do not wait. Going through doors a total of over 5ドル \cdot n$ times will be too slow and will cause Hyrule to fall to ruin!

인터랙션

This is an interactive problem. Your submission will be run against an interactor, which reads the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

The interactor first sends one line with an integer $n$ (1ドル \leq n \leq 1000$), the number of doors in the dungeon (of darkness). After that, the following process begins:

  • The interactor sends two lines:
    • One line with an integer $m$ (1ドル \leq m \leq n$), the number of doors that connect to the room you are in.
    • One line with $m$ integers $d$ (1ドル \leq d \leq n$), the symbols on each of these doors, in ascending order.
  • Then, your program should output a line with an integer $c$ (1ドル \leq c \leq n$), the door you choose to go through.

When you go through door $n,ドル the interaction will stop.

Make sure you flush the buffer after each write.

A testing tool is provided to help you develop your solution.

Walking through more than 5ドル \cdot n$ doors or walking through a door that does not exist in the current room will result in a wrong answer.

Additionally, it is guaranteed that there will always be a way to get to the sage from your current room.

입력

출력

제한

예제 입력 1

3
2
1 2
1
1
2
1 2
2
2 3

예제 출력 1

1
1
2
3

예제 입력 2

5
3
1 2 3
2
1 3
3
1 2 3
3
2 4 5
1
4
3
2 4 5

예제 출력 2

1
3
2
4
4
5

힌트

출처

University > Delft University of Technology > Freshmen Programming Contest 2023 D번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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