시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
10 초 (추가 시간 없음) | 1024 MB | 0 | 0 | 0 | 0.000% |
A research consortium has been looking for the best possible database for three years, but they are still having problems. The database stores values as records that hold $8$-bit binary strings. Unfortunately, their implementation of the function to set the value of a record is flawed.
Each record of the database is an $8$-bit binary string. The bits of the binary string are indexed from $0$ to $7$ from left to right. When an instruction to set a specific record to a new value $V$ is received, instead of setting the value to $V$ the database does the following:
Luckily, it turns out that no matter what the initial value is or what rotation values the database chooses, it is always possible to reset the value of a record to have all bits be $0$ with no more than $300$ uses of this operation. Implement a program to interact with the database that does this.
This is an interactive problem.
Initially, your program should read a single line containing an integer $\mathbf{T}$, the number of test cases. Then, $\mathbf{T}$ test cases must be processed.
At the beginning of each test case, the record in the database is set to a value that is not 00000000
. In each test case, your program must process up to $300$ exchanges.
The $i$-th exchange starts with you outputting a single line containing a single $8$-bit binary string to be used as the value $V$ for the operation above. Then, the judge program performs the operation as described and sends you a single line containing a single integer $\mathbf{N_i}$ representing the number of bits that are equal to $1$ in the updated value of the record.
Your solution is considered correct if and only if you succeed in setting the value of the record to 00000000
for all test cases.
If the judge receives an invalidly formatted or invalid line from your program at any moment, the judge will print a single number $-1$ and will not print any further output. If you receive a $-1$, you must finish correctly and without exceeding the time or memory limits to receive a Wrong Answer judgement. Otherwise, you will receive a judgement informing the exceeded resource or the incorrect termination condition.
The initial value of the record is chosen uniformly at random from all $8$-bit binary strings that are not 00000000
.
Each rotation value is chosen uniformly at random, and independently of all previous choices and interactions.
The judge is adversarial. This means, among other things, that the judge can change the initial value or rotation values as long as it is consistent with all interactions. The initial value is guaranteed to never be 00000000
.
1 3 0
00110011 00011001
Contest > Google > Code Jam > Google Code Jam 2022 > Round 1B C번