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

32439번 - Harmonics with Interference 스페셜 저지다국어

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

문제

The transmission of messages by electromagnetic means presents several challenges, such as interference from other natural or artificial signals that can corrupt a transmission.

A common strategy is to send additional information that allows a received message to be validated. Some more robust protocols even allow for the correction of some errors in the sent message.

Arthur and Bruna are testing a new transmission protocol on a device they have developed. A message $M,ドル which is a sequence of bits, is sent from Arthur to Bruna, along with a control sequence $N,ドル also represented as a sequence of bits. By composing the message $M$ and choosing the bits from $N,ドル Arthur ensures that the integer encoded by $M$ is divisible by the integer represented by $N$.

For each bit received by Bruna, if the bit was transmitted without problems, the value 0 or 1 will be stored in the receiving device. If there was any interference, the symbol * is stored in place of the bit. The result of the transmission will be stored in the pair $(M' , N' )$.

After the communication, if the message was sent successfully, Bruna can decode the original message $M$ (since $M = M'$). If there was a problem, due to the way the protocol works, it may still be possible to decode the message. If many bits were lost, Bruna simply discards the message. But for transmissions where at most 16ドル$ bits of the original pair $(M, N)$ were lost, Bruna would like to try to recover the message, avoiding retransmissions. She needs your help to recover one of the possible messages encoded by the received pair $(M' , N' )$.

For example, suppose Bruna received $M'=$111* and $N'=$1*. Two transmissions could have been made:

  1. $M=$1111 with $N=$11. In this case, the numbers 15ドル$ and 3ドル$ are represented by $M$ and $N,ドル respectively.
  2. $M=$1110 with $N=$10. In this case, the numbers 14ドル$ and 2ドル$ are represented by $M$ and $N,ドル respectively.

Your task is: given the representations of the information received, find a message $M$ that could have been sent by Arthur. If more than one message exists, you can print any message that could have been transmitted by Arthur.

입력

The first line of input will contain a sequence of characters representing $M',ドル with 1ドル ≤ |M' | ≤ 500$. The second line of input will contain a sequence of characters representing $N',ドル with 1ドル ≤ |N' | ≤ 16$. All characters in $N'$ and $M'$ will be either 0, 1, or *. In total, there will never be more than 16ドル$ * characters in the input. It is guaranteed that $N'$ always contains at least one bit 1ドル$.

출력

A single line should be printed, containing a message $M,ドル compatible with the information received by Bruna.

제한

예제 입력 1

111*
1*

예제 출력 1

1111

This case corresponds to the example given in the statement.

예제 입력 2

101**
11

예제 출력 2

10101

In this case, the different ways of choosing the unknown bits would result in messages corresponding to the integers 20ドル,ドル 21ドル,ドル 22ドル$ and 23ドル,ドル and only 21ドル,ドル represented by 10101, is divisible by 3ドル$.

힌트

출처

ICPC > Regionals > Latin America > Sub-Regional Brasil do ACM ICPC > Maratona de Programação da SBC 2024 H번

  • 스페셜 저지를 만든 사람: jhnah917
(追記) (追記ここまで)

출처

대학교 대회

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

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