아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

ASeDatAb

시간 제한10초메모리 제한1024 MB

요약
값을 오른쪽으로 회전한 뒤 XOR하는 블랙박스와 상호작용해 300번 이내로 8비트 레코드를 모두 0으로 만든다.
난이도

보통10점 중 6점

유형
비트 연산, 완전 탐색, 시뮬레이션
정답자
아직 제출이 없습니다

문제

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 88-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 88⁠-bit binary string. The bits of the binary string are indexed from 00 to 77 from left to right. When an instruction to set a specific record to a new value VV is received, instead of setting the value to VV the database does the following:

  1. Choose an integer rr between 00 and 77, inclusive, and let WW be like VV but rotated by rr to the right. That is, the ((i+r) mod 8)((i + r) \bmod 8)⁠-th bit of WW is the ii⁠-th bit of VV.
  2. Replace the current value XX of the record with XX XOR WW. That is, the new value of the record has a 11 as its ii⁠-th bit if and only if the ii⁠-th bits of XX and WW are different.
  3. Finally, return the number of bits that are 11 in the new value to the user.

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 00 with no more than 300300 uses of this operation. Implement a program to interact with the database that does this.

제한

  • 1≤T≤1001 \le \mathbf{T} \le 100.
  • −1≤N_i≤8-1 \le \mathbf{N\_i} \le 8 for all ii.

예제1

  1. 예제 1

    입력
    1
    
    3
    
    0
    
    예상 출력
    
    00110011
    
    00011001