QOJ.ac

QOJ

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

#21264. Kuhrennen

Statistics

John und Bessie entwickeln Bewegungsspiel. Gleicher Start auf Kreisbahn $M$ ($2\le M\le1,000,000,000$), $N$ Runden ($1\le N\le14$), $8N$ Karten $X_i$ ($0\le X_i<M$).

Je Runde oberste $8$ separat, FJ obere $4$ oder untere $4$, Bessie davon obere $2$ oder untere $2$. FJ ruft obere $X_{top}$, laufen $R*X_{top}$, $R$ bisherige Gesamtstrecke; Bessie untere $X_{bottom}$, laufen $X_{bottom}$.

Fürchtet Müdigkeit und weites Ende. Mehr als $K$ vom Start ($0\le K\le\lfloor M/2\rfloor$) können sie nicht heim.

Richtiges Spiel garantiert FJ Heimkehr unabhängig Bessie. Je Runde Hälfte, die gegen alle zukünftigen Entscheidungen Erfolg sichert. Sie spielt laut Eingabe, nächste Runde. Obwohl gegeben, muss FJ gegen jede Wahl bestehen, als kenne er Zukunft nicht.

Eingabe

  • Zeile 1: Ganzzahlen $N,M,K$ mit Leerzeichen.
  • Zeile 2: $N$ Zeichen, $i$-tes T Bessie obere $2$ in Runde $i$, sonst B untere $2$.
  • Zeilen $3..2+N$: acht Ganzzahlen, Karten von oben nach unten.

Ausgabe

  • Zeile 1: $N$ Zeichen, $i$-tes T FJ obere $4$, B untere $4$. Mehrere Möglichkeiten: lexikografisch erste, alphabetisch kleinste.

Beispiele

Eingabe 1

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

Ausgabe 1

TB

Hinweis

Ende genau Start. FJ kennt ihre Wahl vorher nicht; sonst hätte immer untere Hälfte genommen.

Credits: 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.