QOJ.ac

QOJ

Süre Sınırı: 1.0 s Bellek Sınırı: 1024 MB Toplam puan: 100 Hack'lenebilir ✓

#15313. الاستبدال

İstatistikler

أُعطيت سلسلة ثنائية $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.