QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#15313. Thay thế

Statistics

Cho một xâu nhị phân $s$ có độ dài $n$ (xâu $01$). Bạn cần thay thế một ký tự trong $s[2 \ldots n - 1]$ bằng $\oplus$, sao cho giá trị cuối cùng của biểu thức là lớn nhất có thể.

$\oplus$ biểu thị phép toán XOR nhị phân. Sau khi thay thế, cả hai vế của $\oplus$ đều được coi là các số nhị phân.

Dữ liệu vào

Một test đơn lẻ chứa nhiều bộ dữ liệu.

Dòng đầu tiên của dữ liệu vào là số lượng bộ dữ liệu $T$ ($1 \le T \le 10^5$), biểu thị số bộ dữ liệu trong test này.

Với mỗi bộ dữ liệu, có một dòng chứa một xâu nhị phân $s$ ($3 \le |s| \le 5 \cdot 10^5$).

Đảm bảo rằng trong một test đơn lẻ, $\sum |s| \le 5 \cdot 10^5$.

Dữ liệu ra

Với mỗi bộ dữ liệu, in ra một dòng chứa một xâu nhị phân biểu thị kết quả lớn nhất dưới dạng nhị phân (xâu số không được chứa các chữ số $0$ ở đầu ngoại trừ trường hợp số $0$ có một chữ số duy nhất).

Ví dụ

Dữ liệu vào 1

5
010
0110
1000
10101
01000

Dữ liệu ra 1

0
10
10
100
10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.