QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#15313. Заміна

Statistiques

Дано двійковий рядок $s$ довжини $n$ ($01$-рядок). Вам потрібно замінити один символ у $s[2 \ldots n - 1]$ на $\oplus$ так, щоб кінцеве значення виразу було якомога більшим.

$\oplus$ позначає двійкову операцію виключного АБО (XOR). Після заміни обидві частини обабіч $\oplus$ розглядаються як двійкові числа.

Вхідні дані

Один тест містить декілька наборів даних.

Перший рядок вхідних даних містить кількість наборів даних $T$ ($1 \le T \le 10^5$), що позначає кількість наборів даних у цьому тесті.

Для кожного набору даних є один рядок, що містить двійковий рядок $s$ ($3 \le |s| \le 5 \cdot 10^5$).

Гарантується, що в одному тесті $\sum |s| \le 5 \cdot 10^5$.

Вихідні дані

Для кожного набору даних виведіть один рядок, що містить двійковий рядок, який представляє найбільший результат у двійковій формі (числовий рядок не може містити провідних символів $0$, за винятком однієї цифри $0$).

Приклади

Вхідні дані 1

5
010
0110
1000
10101
01000

Вихідні дані 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.