# Description Input specification

Anuncio
```Caribbean Online Judge
3314 - The Fast Traveler (CNC - CLC)
Description
The fast traveler is a board game similar to ludo style in which players compete
to arrive first at the end of a way. Let&acute;s consider as a way a sequence of
squares. Each player begins with his/her piece in the first square (square 0). In
each turn, the player throws a dice and moves forward as many squares as the
value of the dice indicates. The value of each “throw” is represented by an
arrangement (in i position of the arrangement will be stored the ith value of the
thrown dice since the beginning of the game).
All squares have a whole value that represents the compulsory movement a
player should make when the piece lands in a square. The player should stay in
the same square if; his/her piece lands in a square 0. If it lands in a square with
a negative value, then the piece moves back as many squares as the value
indicates -in case of moving back beyond square 0, the piece should stay in the
first square of the game. If the piece lands in a square with a positive value, it
moves forward as many squares as the value indicates. The piece should land
in the penultimate square in case of landing beyond the last square of the game
or when the values of dices is higher than the number of squares until the end;
in this case, the player should pass the turn to the next one -even if the value of
the penultimate square is not 0. While moving, if the piece falls outside the
limits of the board, the player should adjust the piece to a valid position on it.
The game finishes when a player arrives at the last square of the way. It is
guaranteed that the last square always has a value of 0. The previous method
will simulate the game process and should determine the number that indicates
the winner player.
Input specification
The first input line has a whole number N (0 &lt; N &lt;= 50) that represents the
number of test cases. Each test case has 3 lines. The first has 3 whole
numbers J (1 &lt; J &lt;= 10) number of players, C (4 &lt; C &lt;= 100) number of board
-1-
Caribbean Online Judge
squares, and D (0 &lt; D &lt;= 100) number of dice throws. The next line has the
values of board squares and the last line has the values of dices thrown.
Output specification
Print the number of the winner for each test case. In case of having no winner,
print value 0.
Sample input
1
2 8 12
0 -1 5 -1 0 -2 4 0
3 2 8 2 9 5 2 9 6 4 8 1
Sample output
2
Hint(s)
La soluci&oacute;n de este problema es muy simple solo deben completar el juego y determinar qui&eacute;n es
el ganador. Los casos cr&iacute;ticos son aquellos en que no hay ganadores y est&aacute; dado porque ning&uacute;n
jugador llega al final del tablero.
Ej:
2 5 12
01530
1 2 11 5 7 3 10 7 7 3 4 4
En este caso la respuesta es 0 porque ambos jugadores permanecen en la casilla 4 del tablero
despu&eacute;s de la segunda ronda dado que nunca sale una tirada efectiva para poder posicionarse en
la &uacute;ltima casilla.
Source
rmille
2015-06-10
Time limit (ms)
5000
-2-
Caribbean Online Judge
Test limit (ms)
5000
Memory limit (kb)
268435456
Output limit (mb)
64
Size limit (bytes)
16384
Enabled languages
Bash C C# C++ C++11 Java
JavaScript-NodeJS Pascal Perl PHP
Prolog Python Ruby Text
-3-
```