QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21352. الوميض

Statistics

لعدم رضاه عن الإضاءة الخافتة في الحظيرة، ركّب Farmer John للتو ثريا جديدة فاخرة تضم $N$ مصابيح، $(3 \le N \le 16)$، مرتبة في دائرة.

تنبهر الأبقار بهذه الإضاءة الجديدة وتستمتع باللعبة التالية: عند الزمن $T$، تقلب حالة كل مصباح إذا كان جاره على اليسار مضاءً عند الزمن $T-1$. تواصل اللعبة مدة $B$ وحدة زمن، $(1 \le B \le 10^{15})$. لاحظ أن $B$ قد يكون أكبر من أن يتسع له عدد صحيح قياسي من 32 بت.

بمعرفة الحالات الابتدائية للمصابيح، حدد حالاتها النهائية بعد مرور $B$ وحدة زمن.

الإدخال

  • السطر 1: عددان صحيحان تفصل بينهما مسافة، $N$ و$B$.

  • الأسطر $2..1+N$: يحتوي السطر $i+1$ على الحالة الابتدائية للمصباح $i$، إما $0$ (مطفأ) أو $1$ (مضاء).

الإخراج

  • الأسطر $1..N$: يجب أن يحتوي السطر $i$ على الحالة النهائية للمصباح $i$، إما $0$ (مطفأ) أو $1$ (مضاء).

أمثلة

الإدخال 1

5 6
1
0
0
0
0

الإخراج 1

1
1
1
0
1

ملاحظة

توجد خمسة مصابيح. الأول مضاء في البداية والبقية مطفأة.

حالات المصابيح كما يلي:

  • الزمن $T=0$: 1 0 0 0 0

  • الزمن $T=1$: 1 1 0 0 0

  • الزمن $T=2$: 1 0 1 0 0

  • الزمن $T=3$: 1 1 1 1 0

  • الزمن $T=4$: 1 0 0 0 1

  • الزمن $T=5$: 0 1 0 0 1

  • الزمن $T=6$: 1 1 1 0 1

مؤلفا المسألة: Videh Seksaria وBrian Dean، 2013

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.