WIN IT ALL
All submissions for this problem are available.
Two players Shreyans and Shahrukh are playing the most famous cards game WinItAll. Initially just one card K is on the ground. Both the players initially have A and B number of cards and each player has T number of turns remaining. The cards are numbered from 1-9 and J,Q,K,A Shreyans has changed some rules in this game. According to his rules, if a player drops a card which is equal to the top most card on the ground then that player wins all the cards that are on the ground. First turn is of the player having maximum number of initial cards. Alternatively both the players play their turns.
If initially both the players have the same number of cards, Shahrukh plays first.
After T turns played by each player you have to find the player with maximum cards. If in the middle of the game a player has no card remaining, the game stops and the another player wins.
- The first line of the input contains an integer N denoting the number of games played . The description of N games follow.
- The first line of each test case contains four space seperated integers A B K T denoting the Number of cards Shreyans has, Number of cards Sharukh has, The only card which is initially on the ground and Max number of turns each player can play if the game doesn't stop in the middle.
- Next 2T number of lines of each test case contain the card dropped by both the players alternately.
For each test case, output Draw If both the players have same number of cards at the end.
or Shreyans if Player 1 wins
else Shahrukh on a seperate line.
- 1 ≤ N ≤ 100
- 1 ≤ A ≤ 100
- 1 ≤ B ≤ 100
- 1 ≤ T ≤ 100000
30 20 3 3
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions