White-Shadow and war
All submissions for this problem are available.
A war has been started between the White and the Shadow forces in the galaxy. The galaxy is considered to be a single dimensional infinite stretch on both sides. Only one force can attack the other at a time. The first one to attack are the White forces and the alternating turns continue.
White have mobility of mw and shadow have mobility of ms. In each turn both the forces can move upto their mobility. (Ex. If a force is located at location 0 and have mobility of 10, then in its next turn it can move from -10 to 10 location.) Both the forces have their own attacking range described as aw and as respectively. In each turn after making the move, the force can attack the other force if it is in the attacking range of the force. (Ex. If the force with mobility of 5 is located at location 0 and has range of 10 while its enemy is at 15, it can attack its enemy in its turn by first moving to location 5 and then attacking).
Given the initial distance between the two forces D, find if White forces will win or Shadow forces will win or the battle would not be concluded if both play optimally.
Note that the force can attack in the same turn after making its move.
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- Each test case is described on a new line by 5 integers seperated by space D,mw,aw,ms,as
- T = 100000
- -1000000 <= D <= 1000000
- 1 <= mw,aw,ms,as <= 1000000
Input:100000300 40 30 50 405 10 12 10 51000 2 3 4 200.... Output:FIGHT FOREVERWHITESHADOW..
|Time Limit:||30 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.