QOJ.ac

QOJ

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

#21264. ריצת פרות

Statistics

John ו־Bessie המציאו אימון. אותו מיקום התחלה במסלול מעגלי $M$ ($2\le M\le1,000,000,000$), $N$ סבבים ($1\le N\le14$), $8N$ קלפים $X_i$ ($0\le X_i<M$).

בכל סבב $8$ עליונים בערימה נפרדת, FJ $4$ עליונים או תחתונים, Bessie מתוכם $2$ עליונים או תחתונים. FJ קורא עליון $X_{top}$, רצות $R*X_{top}$, $R$ כל המרחק עד כה; היא תחתון $X_{bottom}$, רצות $X_{bottom}$.

חושש עייפות בסוף רחוק. יותר מ־$K$ מהתחלה ($0\le K\le\lfloor M/2\rfloor$) לא יחזרו.

משחק נכון FJ מבטיח חזרה ללא תלות ב־Bessie. בכל סבב בחרו חצי שמבטיח מול כל בחירה עתידית. היא לפי הקלט, הבא. למרות בחירות נתונות, FJ חייב להצליח מול כל בחירה כאילו לא יודע עתיד.

קלט

  • שורה 1: שלמים $N,M,K$ ברווחים.
  • שורה 2: $N$ תווים, $i$ T היא $2$ עליונים בסבב $i$, אחרת B תחתונים.
  • שורות $3..2+N$: שמונה שלמים קלפים מלמעלה למטה.

פלט

  • שורה 1: $N$ תווים, $i$ T FJ $4$ עליונים, B תחתונים. כמה אפשרויות: ראשון לקסיקוגרפית, הקטן אלפביתית.

דוגמאות

קלט 1

2 2 0
TT
1 0 0 0 0 0 0 1
0 1 1 1 0 0 1 0

פלט 1

TB

הערה

סיום בדיוק התחלה. FJ לא יודע בחירות מראש, אחרת יכול תמיד חצי תחתון.

קרדיט: Mark Gordon, 2011

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.