REDIRECT - Redirect
You are playing a game of Don't Die! standing on the first integer out of a list of n
integers, each representing a square (or tile) on the one-dimensional game board, a[1], a[2], a[3] ... a[n]
(you are at a_1
right now).
You have m
turns, if you fall off the list of integers in one of these turns, you will die and thus lose the game, otherwise if you are still alive by the end of all m
turns, you will win the game.
Each turn works like so: if you are standing at index i
, you have the choice of moving to either i + a[i]
or i + a[i] + 1
.
Additionally! There is one square in the game which is super-charged, should you get to that square, you can also go to i - a[i]
.
Determine if you can win the game.
Input
Your first line will contain two space-separated integers n
(0 < n <= 100,000
) and m
(0 < m <= 1,000,000,000
).
Your next line will contain n
space-separated integers, the i
-th of which representing a[i]
(1 <= a[i] <= 1,000,000,000
).
Your next line will contain a single integer between 1 (inclusive) and n
(inclusive), representing the index of the super-charged square (one-indexed).
Output
A single line containing either WINNER
(if you can win the game) or LOSER
(if no matter what you do, you will lose the game).
Input 1 3 2 1 2 3 2 Output 1 LOSER
Input 2 3 1 1 2 3 2 Output 2 WINNER
Input 3 2 10 1 1 2 Output 3 WINNER
Added by: | jslew |
Date: | 2021-11-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |