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

33309번 - We Were Here to Code 다국어투 스텝

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 2048 MB0000.000%

문제

This is an interactive problem with multiple runs.

Welcome, brave participants, to the ultimate challenge for your team that will test your collective problem-solving skills! How quickly can you comprehend your surroundings? Are you confident in your ability to coordinate effectively under pressure? Can you unite as a single, formidable entity and leverage each member's strengths? Let us embark on a journey to discover what you are truly capable of!

In this game, one participant will assume the role of the Communicator, while two others will become Explorers. An essential rule to bear in mind is that each participant is completely isolated from one another --- there is no direct communication or visibility! However, brainstorming and strategizing before the game commences is encouraged.

The Communicator sees the lock and the door. The lock consists of 10ドル$ rolling discs, each disc containing 1ドル$ to 10ドル$ sections of different colors. Only one section from each disc is visible at any time. The door will open when the lock displays the same colors in the visible sections. Initially, the lock is closed: some of the visible colors are different. However, it is possible to open the lock: there is a color that is present on all 10ドル$ discs. The total number of colors used in one lock cannot exceed 26ドル$.

To rotate the discs, a system of two parallel sequences of 30ドル$ slots is employed. Explorer 1ドル$ sets the first sequence, while Explorer 2ドル$ sets the second one. There are cards that can be placed in the slots. Each card has a number written on it.

The number may represent a binary mask of length 10ドル$ or a multiplier. If it represents a mask, each bit in the binary number corresponds to a disc; the 0ドル$-th bit denotes the first disc, while the last bit signifies the tenth disc. For example, the mask 1110000001 means "select discs 0, 7, 8, and 9".

The discs can be rotated clockwise. For example, consider a disc with five sections which have colors denoted by "RGBPY" in clockwise direction, with the first section "R" visible. If we rotate the disc clockwise by 1ドル$ section, the new configuration will be denoted by "YRGBP", with the new first section "Y" visible.

When the team wants to open the lock, they run a simulation of the following process:

  1. Consider the initial state of the discs. Consecutively look at slots 1,ドル 2, \ldots, 30$.
  2. If the $i$-th slot of both sequences is empty, do nothing.
  3. If only the $i$-th slot of the first sequence is filled with card $a_i,ドル rotate each disc selected by mask $a_i$ clockwise by 1ドル$ section.
  4. If only the $i$-th slot of the second sequence is filled with card $b_i,ドル do nothing.
  5. If the $i$-th slot of the first sequence is filled with card $a_i$ and the second slot with $b_i,ドル rotate each disc selected by mask $a_i$ clockwise by $b_i$ sections.

Importantly, this is only a simulation: it always starts from the initial state of the lock, and the changes to the lock's state disappear after the simulation.

The Communicator initially has a set of 1024ドル$ cards with numbers from 0ドル$ to 1023ドル$ written on them. Each number is written exactly once.

The challenge unfolds over several rounds. In each round, the Communicator will select 10ドル$ cards from the set and hand them to Explorer 1ドル,ドル then select 10ドル$ more cards and hand them to Explorer 2ドル$. After that, the Communicator will decide whose turn is next.

Each Explorer has a sequence of 30ドル$ slots, but only the first 10ドル$ untouched slots are available during a single round. The Explorer has access to the 10ドル$ slots and a screen displaying the current result of the simulation. At the beginning of their turn, they will receive cards from the Communicator and attempt to place them in the available slots. They can choose any subset of cards to place in any of the available slots, and observe the changes to the result of the simulation. (Remember that, after each simulation, the lock is restored to its initial state.) At the end of their turn, they are required to place all current cards into the slots, locking them in place and preventing any further removal or alteration.

One round consists of three turns: the Communicator's turn, the turn of the Explorer chosen by the Communicator, and the other Explorer's turn. If at the end of the round, the simulation results in opening the lock, the team wins. Otherwise, a new round begins with a turn for the Communicator. If the team does not win in three rounds, they lose.

입력

출력

제한

인터랙션 프로토콜

Your program will run multiple times.

The first line will contain a single integer indicating the active player: 0ドル$ for the Communicator, 1ドル$ for Explorer 1ドル,ドル and 2ドル$ for Explorer 2ドル$.

During the Communicator's turn, the next line will provide $n$: the number of slots currently in use. If $n > 0,ドル there will be two more lines. The first of these lines will present $n$ integers: the cards in the first $n$ slots of the first sequence. The second line will list $n$ integers: the cards in the first $n$ slots of the second sequence.

Subsequently, you will receive a line with 10ドル$ characters from $A$ to $Z$. They denote the colors of the visible sections of the discs after we run the simulation. Different colors are labeled by different letters, the same color corresponds to the same letter. The mapping from actual colors to English letters does not change during a single run of your program, but it may change between runs.

The participant's program must output a line with 10ドル$ integers from 0ドル$ to 1023ドル$ for the cards assigned to Explorer 1ドル$. In the following line, output 10ドル$ integers from 0ドル$ to 1023ドル$ for the cards designated for Explorer 2ドル$. Finally, the participant's program should output either 1ドル$ to pass the turn to Explorer 1ドル,ドル or 2ドル$ to pass it to Explorer 2ドル$. Each card can be given away at most once during all runs.

During an Explorer's turn, at the beginning, the jury's program will output a line with 10ドル$ integers in ascending order representing the values of the cards passed to them. The next line will contain the colors of the discs after running the simulation, in the same format as for Communicator. The program may output two types of commands:

  • ? $v_1$ $v_2$ $\ldots$ $v_{10}$: Each $v_i$ denotes the card value placed in the $i$-th slot or $-1$ if that slot is empty. You will receive feedback on the new state of the slots in the form of a string of 10ドル$ characters representing their colors. The number of this type of queries must not exceed 200ドル$ among all runs of one test.
  • ! $v_1$ $v_2$ $\ldots$ $v_{10}$: This command concludes a turn, and must include the values associated with your cards in the same format. The final command must include all 10ドル$ cards given to the Explorer; empty slots are not allowed. After this command, the participant's program must terminate.

Keep in mind: the total number of rounds cannot exceed 3ドル$ (resulting in a maximum of 9ドル$ program runs). If the puzzle is not solved after 3ドル$ rounds, it will be judged as "Incorrect Solution".

예제 입력 1

0
0
ABCDEFGHIJ

예제 출력 1

0 1022 1020 1016 1008 992 960 896 768 512
1 2 3 4 5 6 7 8 9 10
1

예제 입력 2

1
0 512 768 896 960 992 1008 1016 1020 1022
FZAVTOBGJM
FZAVTOBGJM
FZZZAAVTTT
FFFFFFFFFF

예제 출력 2

? -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
? 1020 -1 1016 -1 992 -1 768 -1 512 -1
? 0 1022 1020 1016 1008 992 960 896 768 512
! 0 1022 1020 1016 1008 992 960 896 768 512

예제 입력 3

2
1 2 3 4 5 6 7 8 9 10
NNNNNNNNNN
NNNNNCFWZG
NNNFWNCZNW

예제 출력 3

? 1 -1 -1 -1 -1 5 -1 -1 -1 -1
? 10 9 8 7 6 5 4 3 2 1
! 1 2 3 4 5 6 7 8 9 10

예제 입력 4

0
10
0 1022 1020 1016 1008 992 960 896 768 512
1 2 3 4 5 6 7 8 9 10
BTBUBYBCBV

예제 출력 4

525 94 356 30 1019 34 737 925 351 370
939 946 467 209 434 493 978 824 698 439
2

예제 입력 5

2
209 434 439 467 493 698 824 939 946 978
ZBZQZJZMZG
ZBZQZJZMZG

예제 출력 5

? 978 946 939 824 698 493 467 439 434 209
! 939 946 467 209 434 493 978 824 698 439

예제 입력 6

1
30 34 94 351 356 370 525 737 925 1019
ITIXILIPIJ
ITIXLXPGXX
ITXXLJOXJG

예제 출력 6

? 30 -1 -1 -1 -1 1019 -1 -1 -1 -1
? 34 30 -1 -1 -1 370 1019 -1 -1 -1
! 525 94 356 30 1019 34 737 925 351 370

힌트

Despite the discs showing the same colors in run 2ドル,ドル the players don't win right there and then. To open the lock, you should finalize the choices of both Explorers, so that the lock opens on the Communicator's turn.

출처

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

채점 및 기타 정보

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

출처

대학교 대회

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

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