QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 512 MB 총점: 100

#76. פסנתרן

통계

פסנתרן רוצה לנגן בפסנתר.

בפסנתר יש $10^{100}$ קלידים, והקלידים מסומנים משמאל לימין באותיות $A,B,C,D,E,F,G,A,B,\ldots$. הפסנתרן רוצה לקיים את התנאים הבאים:

  • הוא בוחר קליד $A$, ומתחיל לנגן בפסנתר בלחיצה על הקליד שבחר.
  • לאחר שהוא לוחץ על הקליד ה־$i$, בצעד הבא הוא יכול ללחוץ על הקליד ה־$i-1$ או על הקליד ה־$i+1$.
  • לאחר שהוא לוחץ על קליד $A$, הוא יכול גם להפסיק לנגן בפסנתר.
  • קליד ה־$A$ הראשון וקליד ה־$A$ האחרון שעליהם הוא מנגן אינם בהכרח אותו קליד.
  • עליו ללחוץ על קלידי $A$ (לא משנה אילו קלידי $A$) בדיוק $C_1$ פעמים.
  • באופן דומה, עליו ללחוץ על קלידי $B,C,D,E,F,G$ בדיוק $C_2,\ldots,C_7$ פעמים, בהתאמה.

קבעו אם אפשר לקיים את כל התנאים שלעיל.

קלט

$C_1\ C_2\ C_3\ C_4\ C_5\ C_6\ C_7$

  • $0 \le C_i \le 10^{10}$
  • $\sum C_i > 0$

פלט

הדפיסו YES אם אפשר לקיים את כל התנאים, ו־NO אחרת.

דוגמאות

קלט 1

2 1 1 1 1 1 1

פלט 1

YES

הערה

בדוגמה 1 הוא יכול לנגן $A,B,C,D,E,F,G,A$.

קלט 2

1 1 1 1 1 1 1

פלט 2

NO

קלט 3

3 1 0 10000000000 10000000000 0 1

פלט 3

NO

קלט 4

1 0 0 0 0 0 0

פלט 4

YES

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.